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 2015/04/21 11:33:30 UTC
[01/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Repository: syncope
Updated Branches:
refs/heads/master bfa7172ec -> eb9ea2a27
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/installer/src/main/java/org/apache/syncope/installer/files/OrmXml.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/files/OrmXml.java b/installer/src/main/java/org/apache/syncope/installer/files/OrmXml.java
deleted file mode 100644
index 8b8115b..0000000
--- a/installer/src/main/java/org/apache/syncope/installer/files/OrmXml.java
+++ /dev/null
@@ -1,381 +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.installer.files;
-
-public class OrmXml {
-
- public static final String PATH_DIR = "core/src/main/resources/META-INF";
-
- public static final String PATH_COMPLETE = PATH_DIR + "/orm.xml";
-
- public static final String ORACLE_ORM = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!--\n"
- + "Licensed to the Apache Software Foundation (ASF) under one\n"
- + "or more contributor license agreements. See the NOTICE file\n"
- + "distributed with this work for additional information\n"
- + "regarding copyright ownership. The ASF licenses this file\n"
- + "to you under the Apache License, Version 2.0 (the\n"
- + "\"License\"); you may not use this file except in compliance\n"
- + "with the License. You may obtain a copy of the License at\n" + "\n"
- + " http://www.apache.org/licenses/LICENSE-2.0\n" + "\n"
- + "Unless required by applicable law or agreed to in writing,\n"
- + "software distributed under the License is distributed on an\n"
- + "\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n"
- + "KIND, either express or implied. See the License for the\n"
- + "specific language governing permissions and limitations\n" + "under the License.\n" + "\n" + "-->\n"
- + "<entity-mappings xmlns=\"http://java.sun.com/xml/ns/persistence/orm\"\n"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
- + " xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence/orm \n"
- + " http://java.sun.com/xml/ns/persistence/orm_2_0.xsd\"\n"
- + " version=\"2.0\">\n" + "\n" + " <persistence-unit-metadata>\n"
- + " <persistence-unit-defaults>\n" + " <entity-listeners>\n"
- + " <entity-listener class=\"org.apache.syncope.core.persistence.validation.entity.EntityValidationListener\">\n"
- + " <pre-persist method-name=\"validate\"/>\n"
- + " <pre-update method-name=\"validate\"/>\n" + " </entity-listener>\n"
- + " </entity-listeners>\n" + " </persistence-unit-defaults>\n" + " </persistence-unit-metadata>\n"
- + " \n"
- + " <table-generator name=\"SEQ_UAttrValue\" pk-column-value=\"SEQ_UAttrValue\" initial-value=\"100\"/>\n"
- + " <table-generator name=\"SEQ_RAttrValue\" pk-column-value=\"SEQ_RAttrValue\" initial-value=\"100\"/>\n"
- + " <table-generator name=\"SEQ_MAttrValue\" pk-column-value=\"SEQ_MAttrValue\" initial-value=\"100\"/>\n"
- + " <table-generator name=\"SEQ_CAttrValue\" pk-column-value=\"SEQ_CAttrValue\" initial-value=\"100\"/>\n"
- + "\n" + " <entity class=\"org.apache.syncope.core.persistence.beans.user.SyncopeUser\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_SyncopeUser\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_SyncopeUser\" pk-column-value=\"SEQ_SyncopeUser\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.SyncopeRole\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_SyncopeRole\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_SyncopeRole\" pk-column-value=\"SEQ_SyncopeRole\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.membership.Membership\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_Membership\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_Membership\" pk-column-value=\"SEQ_Membership\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.user.UMapping\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_UMapping\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_UMapping\" pk-column-value=\"SEQ_UMapping\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.RMapping\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_RMapping\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_RMapping\" pk-column-value=\"SEQ_RMapping\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.user.UMappingItem\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_UMappingItem\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_UMappingItem\" pk-column-value=\"SEQ_UMappingItem\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.RMappingItem\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_RMappingItem\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_RMappingItem\" pk-column-value=\"SEQ_RMappingItem\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.ConnInstance\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_ConnInstance\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_ConnInstance\" pk-column-value=\"SEQ_ConnInstance\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttr\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_UAttr\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_UAttr\" pk-column-value=\"SEQ_UAttr\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttr\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_RAttr\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_RAttr\" pk-column-value=\"SEQ_RAttr\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttr\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_MAttr\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_MAttr\" pk-column-value=\"SEQ_MAttr\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttr\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_CAttr\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_CAttr\" pk-column-value=\"SEQ_CAttr\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttrValue\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_UAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttrUniqueValue\">\n" + " <table>\n"
- + " <unique-constraint>\n" + " <column-name>booleanValue</column-name>\n"
- + " <column-name>dateValue</column-name>\n" + " <column-name>stringValue</column-name>\n"
- + " <column-name>doubleValue</column-name>\n" + " <column-name>longValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n" + " </table>\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_UAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttrValue\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_RAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttrUniqueValue\">\n" + " <table>\n"
- + " <unique-constraint>\n" + " <column-name>booleanValue</column-name>\n"
- + " <column-name>dateValue</column-name>\n" + " <column-name>stringValue</column-name>\n"
- + " <column-name>doubleValue</column-name>\n" + " <column-name>longValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n" + " </table>\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_RAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttrValue\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_MAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttrUniqueValue\">\n"
- + " <table>\n" + " <unique-constraint>\n" + " <column-name>booleanValue</column-name>\n"
- + " <column-name>dateValue</column-name>\n" + " <column-name>stringValue</column-name>\n"
- + " <column-name>doubleValue</column-name>\n" + " <column-name>longValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n" + " </table>\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_MAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttrValue\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_CAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttrUniqueValue\">\n" + " <table>\n"
- + " <unique-constraint>\n" + " <column-name>booleanValue</column-name>\n"
- + " <column-name>dateValue</column-name>\n" + " <column-name>stringValue</column-name>\n"
- + " <column-name>doubleValue</column-name>\n" + " <column-name>longValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n" + " </table>\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_CAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.Task\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_Task\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_Task\" pk-column-value=\"SEQ_Task\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.TaskExec\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_TaskExec\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_TaskExec\" pk-column-value=\"SEQ_TaskExec\" initial-value=\"10\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.Policy\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_Policy\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_Policy\" pk-column-value=\"SEQ_Policy\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + " \n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.Report\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_Report\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_Report\" pk-column-value=\"SEQ_Report\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.ReportExec\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_ReportExec\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_ReportExec\" pk-column-value=\"SEQ_ReportExec\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.ReportletConfInstance\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_ReportletConfInstance\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_ReportletConfInstance\" pk-column-value=\"SEQ_ReportletConfInstance\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.Notification\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_Notification\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_Notification\" pk-column-value=\"SEQ_Notification\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.SecurityQuestion\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_SecurityQuestion\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_SecurityQuestion\" pk-column-value=\"SEQ_SecurityQuestion\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity> \n" + "</entity-mappings>\n" + "";
-
- public static final String SQLSERVER_ORM = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!--\n"
- + "Licensed to the Apache Software Foundation (ASF) under one\n"
- + "or more contributor license agreements. See the NOTICE file\n"
- + "distributed with this work for additional information\n"
- + "regarding copyright ownership. The ASF licenses this file\n"
- + "to you under the Apache License, Version 2.0 (the\n"
- + "\"License\"); you may not use this file except in compliance\n"
- + "with the License. You may obtain a copy of the License at\n" + "\n"
- + " http://www.apache.org/licenses/LICENSE-2.0\n" + "\n"
- + "Unless required by applicable law or agreed to in writing,\n"
- + "software distributed under the License is distributed on an\n"
- + "\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n"
- + "KIND, either express or implied. See the License for the\n"
- + "specific language governing permissions and limitations\n" + "under the License.\n" + "\n" + "-->\n"
- + "<entity-mappings xmlns=\"http://java.sun.com/xml/ns/persistence/orm\"\n"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
- + " xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence/orm \n"
- + " http://java.sun.com/xml/ns/persistence/orm_2_0.xsd\"\n"
- + " version=\"2.0\">\n" + " \n" + " <persistence-unit-metadata>\n"
- + " <persistence-unit-defaults>\n" + " <entity-listeners>\n"
- + " <entity-listener class=\"org.apache.syncope.core.persistence.validation.entity.EntityValidationListener\">\n"
- + " <pre-persist method-name=\"validate\"/>\n"
- + " <pre-update method-name=\"validate\"/>\n" + " </entity-listener>\n"
- + " </entity-listeners>\n" + " </persistence-unit-defaults>\n" + " </persistence-unit-metadata>\n"
- + " \n"
- + " <table-generator name=\"SEQ_UAttrValue\" pk-column-value=\"SEQ_UAttrValue\" initial-value=\"100\"/>\n"
- + " <table-generator name=\"SEQ_RAttrValue\" pk-column-value=\"SEQ_RAttrValue\" initial-value=\"100\"/>\n"
- + " <table-generator name=\"SEQ_MAttrValue\" pk-column-value=\"SEQ_MAttrValue\" initial-value=\"100\"/>\n"
- + " <table-generator name=\"SEQ_CAttrValue\" pk-column-value=\"SEQ_CAttrValue\" initial-value=\"100\"/>\n"
- + "\n" + " <entity class=\"org.apache.syncope.core.persistence.beans.user.SyncopeUser\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_SyncopeUser\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_SyncopeUser\" pk-column-value=\"SEQ_SyncopeUser\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.SyncopeRole\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_SyncopeRole\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_SyncopeRole\" pk-column-value=\"SEQ_SyncopeRole\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.membership.Membership\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_Membership\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_Membership\" pk-column-value=\"SEQ_Membership\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.user.UMapping\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_UMapping\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_UMapping\" pk-column-value=\"SEQ_UMapping\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.RMapping\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_RMapping\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_RMapping\" pk-column-value=\"SEQ_RMapping\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.user.UMappingItem\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_UMappingItem\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_UMappingItem\" pk-column-value=\"SEQ_UMappingItem\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.RMappingItem\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_RMappingItem\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_RMappingItem\" pk-column-value=\"SEQ_RMappingItem\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.ConnInstance\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_ConnInstance\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_ConnInstance\" pk-column-value=\"SEQ_ConnInstance\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttr\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_UAttr\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_UAttr\" pk-column-value=\"SEQ_UAttr\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttr\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_RAttr\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_RAttr\" pk-column-value=\"SEQ_RAttr\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttr\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_MAttr\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_MAttr\" pk-column-value=\"SEQ_MAttr\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttr\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_CAttr\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_CAttr\" pk-column-value=\"SEQ_CAttr\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + " \n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttrValue\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_UAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttrUniqueValue\">\n" + " <table>\n"
- + " <unique-constraint>\n" + " <column-name>booleanValue</column-name>\n"
- + " <column-name>dateValue</column-name>\n" + " <column-name>stringValue</column-name>\n"
- + " <column-name>doubleValue</column-name>\n" + " <column-name>longValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n" + " </table>\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_UAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttrValue\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_RAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttrUniqueValue\">\n" + " <table>\n"
- + " <unique-constraint>\n" + " <column-name>booleanValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>dateValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>stringValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>doubleValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>longValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n" + " </table>\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_RAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttrValue\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_MAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttrUniqueValue\">\n"
- + " <table>\n" + " <unique-constraint>\n" + " <column-name>booleanValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>dateValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>stringValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>doubleValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>longValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n" + " </table>\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_MAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttrValue\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_CAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttrUniqueValue\">\n" + " <table>\n"
- + " <unique-constraint>\n" + " <column-name>booleanValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>dateValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>stringValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>doubleValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n"
- + " <unique-constraint>\n" + " <column-name>longValue</column-name>\n"
- + " <column-name>schema_name</column-name>\n" + " </unique-constraint>\n" + " </table>\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_CAttrValue\" strategy=\"TABLE\"/>\n" + " </id>\n"
- + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.Task\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_Task\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_Task\" pk-column-value=\"SEQ_Task\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.TaskExec\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_TaskExec\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_TaskExec\" pk-column-value=\"SEQ_TaskExec\" initial-value=\"10\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + " \n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.Policy\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_Policy\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_Policy\" pk-column-value=\"SEQ_Policy\" initial-value=\"1000\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n" + "\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.Report\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n" + " <generated-value generator=\"SEQ_Report\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_Report\" pk-column-value=\"SEQ_Report\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.ReportExec\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_ReportExec\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_ReportExec\" pk-column-value=\"SEQ_ReportExec\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.ReportletConfInstance\">\n"
- + " <attributes>\n" + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_ReportletConfInstance\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_ReportletConfInstance\" pk-column-value=\"SEQ_ReportletConfInstance\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.Notification\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_Notification\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_Notification\" pk-column-value=\"SEQ_Notification\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity>\n"
- + " <entity class=\"org.apache.syncope.core.persistence.beans.SecurityQuestion\">\n" + " <attributes>\n"
- + " <id name=\"id\">\n"
- + " <generated-value generator=\"SEQ_SecurityQuestion\" strategy=\"TABLE\"/>\n"
- + " <table-generator name=\"SEQ_SecurityQuestion\" pk-column-value=\"SEQ_SecurityQuestion\" initial-value=\"100\"/>\n"
- + " </id>\n" + " </attributes>\n" + " </entity> \n" + "</entity-mappings>\n" + "";
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java b/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java
index 7e9f7b8..b44af43 100644
--- a/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java
+++ b/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java
@@ -30,6 +30,7 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.URL;
+import java.nio.charset.Charset;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
@@ -146,7 +147,7 @@ public class FileSystemUtils {
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
transformer.transform(new DOMSource(doc),
- new StreamResult(new OutputStreamWriter(out, "UTF-8")));
+ new StreamResult(new OutputStreamWriter(out, Charset.forName("UTF-8"))));
} finally {
IOUtils.closeQuietly(out);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e8381bf..054db15 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1196,6 +1196,7 @@ under the License.
<rulesets>
<rulesets>${rootpom.basedir}/src/main/resources/org/apache/syncope/pmd.xml</rulesets>
</rulesets>
+ <linkXRef>false</linkXRef>
<targetJdk>${targetJdk}</targetJdk>
</configuration>
</plugin>
@@ -1222,6 +1223,56 @@ under the License.
<plugins>
<plugin>
+ <groupId>org.gaul</groupId>
+ <artifactId>modernizer-maven-plugin</artifactId>
+ <version>1.3.0</version>
+ <configuration>
+ <javaVersion>${targetJdk}</javaVersion>
+ <ignorePackages>
+ <ignorePackage>org.apache.syncope.core.persistence.jpa.entity</ignorePackage>
+ </ignorePackages>
+ </configuration>
+ <executions>
+ <execution>
+ <id>modernizer</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>modernizer</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Enable with SYNCOPE-657
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>checkstyle-check</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>pmd-check</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ <goal>cpd-check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>-->
+
+ <plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/src/main/resources/org/apache/syncope/checkstyle.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/syncope/checkstyle.xml b/src/main/resources/org/apache/syncope/checkstyle.xml
index e824479..e912c8b 100644
--- a/src/main/resources/org/apache/syncope/checkstyle.xml
+++ b/src/main/resources/org/apache/syncope/checkstyle.xml
@@ -56,7 +56,7 @@ under the License.
<!-- Checks that a package-info.java file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
- <module name="JavadocPackage"/>
+ <!--<module name="JavadocPackage"/>-->
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
@@ -89,10 +89,16 @@ under the License.
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
- <module name="JavadocMethod"/>
+ <!--<module name="JavadocMethod">
+ <property name="scope" value="public"/>
+ <property name="allowMissingPropertyJavadoc" value="true"/>
+ </module>
<module name="JavadocType"/>
- <module name="JavadocVariable"/>
- <module name="JavadocStyle"/>
+ <module name="JavadocVariable">
+ <property name="scope" value="public"/>
+ <property name="ignoreNamePattern" value="LOG"/>
+ </module>
+ <module name="JavadocStyle"/>-->
<!-- Checks for Naming Conventions. -->
@@ -104,7 +110,9 @@ under the License.
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
- <module name="StaticVariableName"/>
+ <module name="StaticVariableName">
+ <property name="format" value="^[A-Z][A-Z0-9_]*$"/>
+ </module>
<module name="TypeName"/>
@@ -140,8 +148,8 @@ under the License.
<property name="max" value="120"/>
<property name="ignorePattern" value="^import"/>
</module>
- <module name="MethodLength"/>
- <module name="ParameterNumber"/>
+ <!--<module name="MethodLength"/>-->
+ <!--<module name="ParameterNumber"/>-->
<!-- Checks for whitespace -->
@@ -167,7 +175,9 @@ under the License.
<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
- <module name="EmptyBlock"/>
+ <module name="EmptyBlock">
+ <property name="option" value="text"/>
+ </module>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
@@ -176,7 +186,6 @@ under the License.
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!-- <module name="AvoidInlineConditionals"/>-->
- <!--module name="DoubleCheckedLocking"/--> <!-- MY FAVOURITE -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
@@ -196,7 +205,7 @@ under the License.
<!--<module name="DesignForExtension"/>-->
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
- <module name="InterfaceIsType"/>
+ <!--<module name="InterfaceIsType"/>-->
<module name="VisibilityModifier">
<property name="protectedAllowed" value="true"/>
</module>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/src/main/resources/org/apache/syncope/pmd.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/syncope/pmd.xml b/src/main/resources/org/apache/syncope/pmd.xml
index 28cfb4c..5190d40 100644
--- a/src/main/resources/org/apache/syncope/pmd.xml
+++ b/src/main/resources/org/apache/syncope/pmd.xml
@@ -23,27 +23,58 @@ under the License.
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
- <rule ref="rulesets/basic.xml"/>
- <rule ref="rulesets/naming.xml">
+ <rule ref="rulesets/java/basic.xml"/>
+ <rule ref="rulesets/java/naming.xml">
<exclude name="ShortVariable"/>
<exclude name="LongVariable"/>
+ <exclude name="ShortMethodName"/>
+ <exclude name="ShortClassName"/>
+ <exclude name="GenericsNaming"/>
</rule>
- <rule ref="rulesets/unusedcode.xml"/>
- <rule ref="rulesets/design.xml"/>
- <rule ref="rulesets/imports.xml"/>
- <rule ref="rulesets/strings.xml">
+ <rule ref="rulesets/java/unusedcode.xml"/>
+ <rule ref="rulesets/java/design.xml">
+ <exclude name="GodClass"/>
+ <exclude name="UseLocaleWithCaseConversions"/>
+ <exclude name="ConfusingTernary"/>
+ <exclude name="NonStaticInitializer"/>
+ <exclude name="AvoidConstantsInterface"/>
+ <exclude name="AvoidDeeplyNestedIfStmts"/>
+ </rule>
+ <rule ref="rulesets/java/imports.xml"/>
+ <rule ref="rulesets/java/strings.xml">
<exclude name="AvoidDuplicateLiterals"/>
+ <exclude name="AvoidStringBufferField"/>
+ </rule>
+ <rule ref="rulesets/java/codesize.xml">
+ <exclude name="TooManyFields"/>
+ <exclude name="TooManyMethods"/>
+ <exclude name="ExcessivePublicCount"/>
+ <exclude name="CyclomaticComplexity"/>
+ <exclude name="StdCyclomaticComplexity"/>
+ <exclude name="ModifiedCyclomaticComplexity"/>
+ <exclude name="NPathComplexity"/>
+ <exclude name="ExcessiveMethodLength"/>
</rule>
- <rule ref="rulesets/codesize.xml"/>
- <rule ref="rulesets/javabeans.xml">
+ <rule ref="rulesets/java/javabeans.xml">
<exclude name="BeanMembersShouldSerialize"/>
</rule>
- <rule ref="rulesets/coupling.xml"/>
- <rule ref="rulesets/controversial.xml">
+ <rule ref="rulesets/java/coupling.xml">
+ <exclude name="LoosePackageCoupling"/>
+ <exclude name="LawOfDemeter"/>
+ <exclude name="ExcessiveImports"/>
+ </rule>
+ <rule ref="rulesets/java/controversial.xml">
<exclude name="NullAssignment"/>
<exclude name="DataflowAnomalyAnalysis"/>
+ <exclude name="AtLeastOneConstructor"/>
+ <exclude name="OnlyOneReturn"/>
+ <exclude name="UseConcurrentHashMap"/>
+ <exclude name="AvoidLiteralsInIfCondition"/>
+ <exclude name="UseObjectForClearerAPI"/>
+ </rule>
+ <rule ref="rulesets/java/strictexception.xml">
+ <exclude name="AvoidCatchingGenericException"/>
</rule>
- <rule ref="rulesets/strictexception.xml"/>
- <rule ref="rulesets/typeresolution.xml"/>
+ <rule ref="rulesets/java/typeresolution.xml"/>
</ruleset>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/src/site/xdoc/architecture.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/architecture.xml b/src/site/xdoc/architecture.xml
index 024609e..9d5ddc2 100644
--- a/src/site/xdoc/architecture.xml
+++ b/src/site/xdoc/architecture.xml
@@ -88,7 +88,7 @@ under the License.
<subsection name="JPA persistence layer">
<p>
- All data in Apache Syncope (users, roles, attributes, resources, ...) is managed at a high level using a
+ All data in Apache Syncope (users, groups, attributes, resources, ...) is managed at a high level using a
standard JPA 2.0 approach and persisted to an underlying database.
</p>
<p>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/src/site/xdoc/features.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/features.xml b/src/site/xdoc/features.xml
index af2fc35..c503ab5 100644
--- a/src/site/xdoc/features.xml
+++ b/src/site/xdoc/features.xml
@@ -27,15 +27,15 @@ under the License.
</properties>
<body>
- <section name="Account and Role Administration">
+ <section name="Account and Group Administration">
<ul>
<li>Password management and Self-Service Operations</li>
<li>Configurable Password encryption</li>
<li>Attribute validators (Reg-Exp based and custom)</li>
<li>Account Policy management</li>
<li>Password Policy management</li>
- <li>User role-based provisioning</li>
- <li>Role provisioning</li>
+ <li>User group-based provisioning</li>
+ <li>Group provisioning</li>
<li>Account status information on external resources</li>
</ul>
</section>
@@ -71,9 +71,9 @@ under the License.
<ul>
<li>RESTFul interface</li>
<li>Web-based multilingual AJAX administration console</li>
- <li>Role-based administration</li>
+ <li>Group-based administration</li>
<li>Attribute schema, Derived attribute schema and Virtual Attribute schema management</li>
- <li>Role tree management</li>
+ <li>Group tree management</li>
<li>Schedulable Task execution</li>
</ul>
</section>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/src/site/xdoc/index.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index bc8b898..ee3af80 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -40,7 +40,7 @@ under the License.
<p>
<span style="font-weight: bold">Identity management</span> (or IdM) represents the joint result of business process and IT to manage user data on systems
- and applications. IdM involves considering user attributes, roles, resources and entitlements in trying to give a
+ and applications. IdM involves considering user attributes, groups, resources and entitlements in trying to give a
decent answer to the question bumping up every time in an IT administrator's mind:
</p>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/src/site/xdoc/security.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/security.xml b/src/site/xdoc/security.xml
index 716470d..fc5619e 100644
--- a/src/site/xdoc/security.xml
+++ b/src/site/xdoc/security.xml
@@ -63,7 +63,7 @@ under the License.
<subsection name="CVE-2014-0111: Remote code execution by an authenticated administrator">
<p>In the various places in which Apache Commons JEXL expressions are allowed (derived schema definition,
- user / role templates, account links of resource mappings) a malicious administrator can inject Java code
+ user / group templates, account links of resource mappings) a malicious administrator can inject Java code
that can be executed remotely by the JEE container running the Apache Syncope core.</p>
<p>
[35/57] syncope git commit: [SYNCOPE-119] (re)Introducing Roles
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/test/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/resources/content.xml b/core/persistence-jpa/src/test/resources/content.xml
index 339d706..4a52eb2 100644
--- a/core/persistence-jpa/src/test/resources/content.xml
+++ b/core/persistence-jpa/src/test/resources/content.xml
@@ -23,6 +23,25 @@ under the License.
<Realm id="3" name="even" parent_id="1"/>
<Realm id="4" name="two" parent_id="3"/>
+ <SyncopeRole id="1" name="User reviewer" criteria="fullname==*o*;fullname==*i*"/>
+ <SyncopeRole_entitlements entitlement="USER_READ" role_id="1"/>
+ <SyncopeRole_entitlements entitlement="USER_LIST" role_id="1"/>
+ <SyncopeRole_Realm role_id="1" realm_id="2"/>
+ <SyncopeRole_Realm role_id="1" realm_id="3"/>
+
+ <SyncopeRole id="2" name="User manager" criteria="username==rossini"/>
+ <SyncopeRole_entitlements entitlement="USER_READ" role_id="2"/>
+ <SyncopeRole_entitlements entitlement="USER_LIST" role_id="2"/>
+ <SyncopeRole_entitlements entitlement="WORKFLOW_FORM_CLAIM" role_id="2"/>
+ <SyncopeRole_entitlements entitlement="WORKFLOW_FORM_SUBMIT" role_id="2"/>
+ <SyncopeRole_Realm role_id="2" realm_id="4"/>
+
+ <SyncopeRole id="3" name="Other" criteria="id=gt=2;id=le=4"/>
+ <SyncopeRole_entitlements entitlement="SCHEMA_READ" role_id="3"/>
+ <SyncopeRole_entitlements entitlement="GROUP_READ" role_id="3"/>
+ <SyncopeRole_entitlements entitlement="WORKFLOW_FORM_CLAIM" role_id="3"/>
+ <SyncopeRole_Realm role_id="3" realm_id="2"/>
+
<SyncopeConf id="1"
creator="admin" lastModifier="admin"
creationDate="2014-06-20 11:00:00" lastChangeDate="2014-06-20 11:00:00"/>
@@ -451,13 +470,13 @@ under the License.
connectorName="net.tirasa.connid.bundles.soap.WebServiceConnector"
version="${connid.soap.version}"
jsonConf='[{"schema":{"name":"endpoint","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["http://localhost:${cargo.servlet.port}/wssample/services/provisioning"]},{"schema":{"name":"servicename","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["net.tirasa.connid.bundles.soap.provisioning.interfaces.Provisioning"]}]'/>
- <ConnInstance_capabilities ConnInstance_id="100" capabilities="ONE_PHASE_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="100" capabilities="ONE_PHASE_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="100" capabilities="ONE_PHASE_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="100" capabilities="TWO_PHASES_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="100" capabilities="TWO_PHASES_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="100" capabilities="TWO_PHASES_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="100" capabilities="SEARCH"/>
+ <ConnInstance_capabilities ConnInstance_id="100" capability="ONE_PHASE_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="100" capability="ONE_PHASE_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="100" capability="ONE_PHASE_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="100" capability="TWO_PHASES_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="100" capability="TWO_PHASES_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="100" capability="TWO_PHASES_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="100" capability="SEARCH"/>
<ConnInstance id="101" displayName="H2"
location="connid://${testconnectorserver.key}@localhost:${testconnectorserver.port}"
@@ -465,15 +484,15 @@ under the License.
connectorName="net.tirasa.connid.bundles.db.table.DatabaseTableConnector"
version="${connid.db.table.version}"
jsonConf='[{"schema":{"name":"disabledStatusValue","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"user","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["sa"]},{"schema":{"name":"keyColumn","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["id"]},{"schema":{"name":"retrievePassword","displayName":null,"helpMessage":null,"type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["true"]},{"schema":{"name":"cipherAlgorithm","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValu
es":null},"overridable":false,"values":["SHA1"]},{"schema":{"name":"enabledStatusValue","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["true"]},{"schema":{"name":"passwordColumn","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["password"]},{"schema":{"name":"jdbcDriver","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["org.h2.Driver"]},{"schema":{"name":"defaultStatusValue","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["true"]},{"schema":{"name":"table","displayName":null,"helpMessage":null,"type":"java.lang.String","required
":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["test"]},{"schema":{"name":"password","displayName":null,"helpMessage":null,"type":"org.identityconnectors.common.security.GuardedString","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["sa"]},{"schema":{"name":"statusColumn","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["status"]},{"schema":{"name":"jdbcUrlTemplate","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["${testdb.url}"]}]'/>
- <ConnInstance_capabilities ConnInstance_id="101" capabilities="AUTHENTICATE"/>
- <ConnInstance_capabilities ConnInstance_id="101" capabilities="ONE_PHASE_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="101" capabilities="ONE_PHASE_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="101" capabilities="ONE_PHASE_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="101" capabilities="TWO_PHASES_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="101" capabilities="TWO_PHASES_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="101" capabilities="TWO_PHASES_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="101" capabilities="SEARCH"/>
- <ConnInstance_capabilities ConnInstance_id="101" capabilities="SYNC"/>
+ <ConnInstance_capabilities ConnInstance_id="101" capability="AUTHENTICATE"/>
+ <ConnInstance_capabilities ConnInstance_id="101" capability="ONE_PHASE_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="101" capability="ONE_PHASE_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="101" capability="ONE_PHASE_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="101" capability="TWO_PHASES_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="101" capability="TWO_PHASES_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="101" capability="TWO_PHASES_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="101" capability="SEARCH"/>
+ <ConnInstance_capabilities ConnInstance_id="101" capability="SYNC"/>
<ConnInstance id="102" displayName="ConnInstance102"
location="${connid.location}"
@@ -482,13 +501,13 @@ under the License.
version="${connid.soap.version}"
connRequestTimeout="10"
jsonConf='[{"schema":{"name":"servicename","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["net.tirasa.connid.bundles.soap.provisioning.interfaces.Provisioning"]},{"schema":{"name":"endpoint","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":true,"values":["http://localhost:${cargo.servlet.port}/wssample/services/provisioning"]}]'/>
- <ConnInstance_capabilities ConnInstance_id="102" capabilities="ONE_PHASE_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="102" capabilities="ONE_PHASE_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="102" capabilities="ONE_PHASE_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="102" capabilities="TWO_PHASES_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="102" capabilities="TWO_PHASES_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="102" capabilities="TWO_PHASES_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="102" capabilities="SEARCH"/>
+ <ConnInstance_capabilities ConnInstance_id="102" capability="ONE_PHASE_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="102" capability="ONE_PHASE_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="102" capability="ONE_PHASE_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="102" capability="TWO_PHASES_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="102" capability="TWO_PHASES_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="102" capability="TWO_PHASES_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="102" capability="SEARCH"/>
<ConnInstance id="103" displayName="ConnInstance103"
location="${connid.location}"
@@ -503,24 +522,24 @@ under the License.
connectorName="net.tirasa.connid.bundles.csvdir.CSVDirConnector"
version="${connid.csvdir.version}"
jsonConf='[{"schema":{"name":"fields","displayName":"fields","helpMessage":"Column names separated by comma","type":"[Ljava.lang.String;","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["id","name","surname","email","password","theirgroup","membership","status","deleted"]},{"schema":{"name":"keyColumnNames","displayName":"Key column name","helpMessage":"Name of the column used to identify user uniquely","type":"[Ljava.lang.String;","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["name","surname"]},{"schema":{"name":"deleteColumnName","displayName":"Delete column name","helpMessage":"Name of the column used to specify users to be deleted","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["deleted"]},{"schema":{"name":"passwordColumnName","displayName":"Password column name","helpMessage":"Name
of the column used to specify user password","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["password"]},{"schema":{"name":"keyseparator","displayName":"Key separator","helpMessage":"Character used to separate keys in a multi-key scenario","type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[","]},{"schema":{"name":"ignoreHeader","displayName":"Ignore header","helpMessage":"Specify it first line file must be ignored","type":"java.lang.Boolean","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[false]},{"schema":{"name":"fieldDelimiter","displayName":"fieldDelimiter","helpMessage":"fieldDelimiter","type":"char","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[","]},{"schema":{"name":"quotationRequired","displayName":"Value quotation requi
red","helpMessage":"Specify if value quotation is required","type":"java.lang.Boolean","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[false]},{"schema":{"name":"statusColumn","displayName":"statusColumn","helpMessage":"Status column","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["status"]},{"schema":{"name":"sourcePath","displayName":"Source path","helpMessage":"Absolute path of a directory where are located CSV files to be processed","type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["${test.csvdir.path}"]},{"schema":{"name":"fileMask","displayName":"File mask","helpMessage":"Regular expression describing files to be processed","type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["test.csv"]}]'/>
- <ConnInstance_capabilities ConnInstance_id="104" capabilities="ONE_PHASE_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="104" capabilities="ONE_PHASE_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="104" capabilities="ONE_PHASE_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="104" capabilities="TWO_PHASES_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="104" capabilities="TWO_PHASES_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="104" capabilities="TWO_PHASES_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="104" capabilities="SEARCH"/>
- <ConnInstance_capabilities ConnInstance_id="104" capabilities="SYNC"/>
+ <ConnInstance_capabilities ConnInstance_id="104" capability="ONE_PHASE_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="104" capability="ONE_PHASE_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="104" capability="ONE_PHASE_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="104" capability="TWO_PHASES_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="104" capability="TWO_PHASES_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="104" capability="TWO_PHASES_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="104" capability="SEARCH"/>
+ <ConnInstance_capabilities ConnInstance_id="104" capability="SYNC"/>
<ConnInstance id="105" bundleName="net.tirasa.connid.bundles.ldap" displayName="ApacheDS"
location="${connid.location}"
connectorName="net.tirasa.connid.bundles.ldap.LdapConnector"
version="${connid.ldap.version}"
jsonConf='[{"schema":{"name":"synchronizePasswords","displayName":"Enable Password Synchronization","helpMessage":"If true, the connector will synchronize passwords. The Password Capture Plugin needs to be installed for password synchronization to work.","type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"maintainLdapGroupMembership","displayName":"Maintain LDAP Group Membership","helpMessage":"When enabled and a user is renamed or deleted, update any LDAP groups to which the user belongs to reflect the new name. Otherwise, the LDAP resource must maintain referential integrity with respect to group membership.","type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["true"]},{"schema":{"name":"host","displayName":"Host","helpMessage":"The name or IP address of the host where the LDAP server is running.","type":"jav
a.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["localhost"]},{"schema":{"name":"passwordHashAlgorithm","displayName":"Password Hash Algorithm","helpMessage":"Indicates the algorithm that the Identity system should use to hash the password. Currently supported values are SSHA, SHA, SSHA1, and SHA1. A blank value indicates that the system will not hash passwords. This will cause cleartext passwords to be stored in LDAP unless the LDAP server performs the hash (Netscape Directory Server and iPlanet Directory Server do).","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["SHA"]},{"schema":{"name":"blockSize","displayName":"Block Size","helpMessage":"The maximum number of accounts that can be in a block when retrieving accounts in blocks.","type":"int","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"valu
es":[]},{"schema":{"name":"useBlocks","displayName":"Use Blocks","helpMessage":"When performing operations on large numbers of accounts, the accounts are processed in blocks to reduce the amount of memory used by the operation. Select this option to process accounts in blocks.","type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[false]},{"schema":{"name":"usePagedResultControl","displayName":"Use Paged Result Control","helpMessage":"When enabled, the LDAP Paged Results control is preferred over the VLV control when retrieving accounts.","type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"port","displayName":"TCP Port","helpMessage":"TCP/IP port number used to communicate with the LDAP server.","type":"int","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[1389]},{"schema":{"nam
e":"vlvSortAttribute","displayName":"VLV Sort Attribute","helpMessage":"Specify the sort attribute to use for VLV indexes on the resource.","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"statusManagementClass","displayName":"Status management class ","helpMessage":"Class to be used to manage enabled/disabled status. If no class is specified then identity status management wont be possible.","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["net.tirasa.connid.bundles.ldap.commons.AttributeStatusManagement"]},{"schema":{"name":"accountObjectClasses","displayName":"Account Object Classes","helpMessage":"The object class or classes that will be used when creating new user objects in the LDAP tree. When entering more than one object class, each entry should be on its own line; do not use commas or semi-colons to s
eparate multiple object classes. Some object classes may require that you specify all object classes in the class hierarchy.","type":"[Ljava.lang.String;","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["inetOrgPerson"]},{"schema":{"name":"accountUserNameAttributes","displayName":"Account User Name Attributes","helpMessage":"Attribute or attributes which holds the account user name. They will be used when authenticating to find the LDAP entry for the user name to authenticate.","type":"[Ljava.lang.String;","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["uid"]},{"schema":{"name":"baseContextsToSynchronize","displayName":"Base Contexts to Synchronize","helpMessage":"One or more starting points in the LDAP tree that will be used to determine if a change should be synchronized. The base contexts attribute will be used to synchronize a change if this property is not set.","type":"[Lja
va.lang.String;","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["ou=people,o=isp","ou=groups,o=isp"]},{"schema":{"name":"accountSynchronizationFilter","displayName":"LDAP Filter for Accounts to Synchronize","helpMessage":"An optional LDAP filter for the objects to synchronize. Because the change log is for all objects, this filter updates only objects that match the specified filter. If you specify a filter, an object will be synchronized only if it matches the filter and includes a synchronized object class.","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"removeLogEntryObjectClassFromFilter","displayName":"Remove Log Entry Object Class from Filter","helpMessage":"If this property is set (the default), the filter used to fetch change log entries does not contain the \"changeLogEntry\" object class, expecting that there are no entri
es of other object types in the change log.","type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"passwordDecryptionKey","displayName":"Password Decryption Key","helpMessage":"The key to decrypt passwords with when performing password synchronization.","type":"org.identityconnectors.common.security.GuardedByteArray","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"readSchema","displayName":"Read Schema","helpMessage":"If true, the connector will read the schema from the server. If false, the connector will provide a default schema based on the object classes in the configuration. This property must be true in order to use extended object classes.","type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"ssl","displayName":"SSL","hel
pMessage":"Select the check box to connect to the LDAP server using SSL.","type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"passwordAttributeToSynchronize","displayName":"Password Attribute to Synchronize","helpMessage":"The name of the password attribute to synchronize when performing password synchronization.","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"accountSearchFilter","displayName":"LDAP Filter for Retrieving Accounts","helpMessage":"An optional LDAP filter to control which accounts are returned from the LDAP resource. If no filter is specified, only accounts that include all specified object classes are returned.","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["uid=*"]},{"schema":{"name":"passwordDec
ryptionInitializationVector","displayName":"Password Decryption Initialization Vector","helpMessage":"The initialization vector to decrypt passwords with when performing password synchronization.","type":"org.identityconnectors.common.security.GuardedByteArray","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"groupMemberAttribute","displayName":"Group Member Attribute","helpMessage":"The name of the group attribute that will be updated with the distinguished name of the user when the user is added to the group.","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"failover","displayName":"Failover Servers","helpMessage":"List all servers that should be used for failover in case the preferred server fails. If the preferred server fails, JNDI will connect to the next available server in the list. List all servers in the
form of \"ldap://ldap.example.com:389/\", which follows the standard LDAP v3 URLs described in RFC 2255. Only the host and port parts of the URL are relevant in this setting.","type":"[Ljava.lang.String;","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"modifiersNamesToFilterOut","displayName":"Filter Out Changes By","helpMessage":"The names (DNs) of directory administrators to filter from the changes. Changes with the attribute \"modifiersName\" that match entries in this list will be filtered out. The standard value is the administrator name used by this adapter, to prevent loops. Entries should be of the format \"cn=Directory Manager\".","type":"[Ljava.lang.String;","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"groupNameAttributes","displayName":"Group Name Attributes","helpMessage":"Attribute or attributes which holds the group nam
e.","type":"[Ljava.lang.String;","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["cn"]},{"schema":{"name":"uidAttribute","displayName":"Uid Attribute","helpMessage":"The name of the LDAP attribute which is mapped to the Uid attribute.","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["cn"]},{"schema":{"name":"respectResourcePasswordPolicyChangeAfterReset","displayName":"Respect Resource Password Policy Change-After-Reset","helpMessage":"When this resource is specified in a Login Module (i.e., this resource is a pass-through authentication target) and the resource password policy is configured for change-after-reset, a user whose resource account password has been administratively reset will be required to change that password after successfully authenticating.","type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overrida
ble":false,"values":["false"]},{"schema":{"name":"filterWithOrInsteadOfAnd","displayName":"Filter with Or Instead of And","helpMessage":"Normally the the filter used to fetch change log entries is an and-based filter retrieving an interval of change entries. If this property is set, the filter will or together the required change numbers instead.","type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"principal","displayName":"Principal","helpMessage":"The distinguished name with which to authenticate to the LDAP server.","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["uid=admin,ou=system"]},{"schema":{"name":"changeLogBlockSize","displayName":"Change Log Block Size","helpMessage":"The number of change log entries to fetch per query.","type":"int","required":true,"order":0,"confidential":false,"defaultValues":null},
"overridable":false,"values":[100]},{"schema":{"name":"baseContexts","displayName":"Base Contexts","helpMessage":"One or more starting points in the LDAP tree that will be used when searching the tree. Searches are performed when discovering users from the LDAP server or when looking for the groups of which a user is a member.","type":"[Ljava.lang.String;","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["ou=people,o=isp","ou=groups,o=isp"]},{"schema":{"name":"passwordAttribute","displayName":"Password Attribute","helpMessage":"The name of the LDAP attribute which holds the password. When changing an user password, the new password is set to this attribute.","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["userpassword"]},{"schema":{"name":"changeNumberAttribute","displayName":"Change Number Attribute","helpMessage":"The name of the change number attribute
in the change log entry.","type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["changeNumber"]},{"schema":{"name":"objectClassesToSynchronize","displayName":"Object Classes to Synchronize","helpMessage":"The object classes to synchronize. The change log is for all objects; this filters updates to just the listed object classes. You should not list the superclasses of an object class unless you intend to synchronize objects with any of the superclass values. For example, if only \"inetOrgPerson\" objects should be synchronized, but the superclasses of \"inetOrgPerson\" (\"person\", \"organizationalperson\" and \"top\") should be filtered out, then list only \"inetOrgPerson\" here. All objects in LDAP are subclassed from \"top\". For this reason, you should never list \"top\", otherwise no object would be filtered.","type":"[Ljava.lang.String;","required":true,"order":0,"confidential":false,"defaultValues":null},
"overridable":false,"values":["inetOrgPerson","groupOfUniqueNames"]},{"schema":{"name":"credentials","displayName":"Password","helpMessage":"Password for the principal.","type":"org.identityconnectors.common.security.GuardedString","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["secret"]},{"schema":{"name":"attributesToSynchronize","displayName":"Attributes to Synchronize","helpMessage":"The names of the attributes to synchronize. This ignores updates from the change log if they do not update any of the named attributes. For example, if only \"department\" is listed, then only changes that affect \"department\" will be processed. All other updates are ignored. If blank (the default), then all changes are processed.","type":"[Ljava.lang.String;","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"maintainPosixGroupMembership","displayName":"Maintain POSIX Group M
embership","helpMessage":"When enabled and a user is renamed or deleted, update any POSIX groups to which the user belongs to reflect the new name. Otherwise, the LDAP resource must maintain referential integrity with respect to group membership.","type":"boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["truemaintainLdapGroupMembership"]}]'/>
- <ConnInstance_capabilities ConnInstance_id="105" capabilities="ONE_PHASE_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="105" capabilities="ONE_PHASE_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="105" capabilities="ONE_PHASE_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="105" capabilities="SEARCH"/>
+ <ConnInstance_capabilities ConnInstance_id="105" capability="ONE_PHASE_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="105" capability="ONE_PHASE_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="105" capability="ONE_PHASE_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="105" capability="SEARCH"/>
<ConnInstance id="106" displayName="H2-test2"
location="connid://${testconnectorserver.key}@localhost:${testconnectorserver.port}"
@@ -528,23 +547,23 @@ under the License.
connectorName="net.tirasa.connid.bundles.db.table.DatabaseTableConnector"
version="${connid.db.table.version}"
jsonConf='[{"schema":{"name":"disabledStatusValue","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"user","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["sa"]},{"schema":{"name":"keyColumn","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["id"]},{"schema":{"name":"cipherAlgorithm","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["SHA1"]},{"schema":{"name":"enabledStatusValue","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"
defaultValues":null},"overridable":false,"values":["true"]},{"schema":{"name":"passwordColumn","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["password"]},{"schema":{"name":"jdbcDriver","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["org.h2.Driver"]},{"schema":{"name":"retrievePassword","displayName":null,"helpMessage":null,"type":"java.lang.Boolean","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["true"]},{"schema":{"name":"defaultStatusValue","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["true"]},{"schema":{"name":"password","displayName":null,"helpMessage":null,"type":"org.identityco
nnectors.common.security.GuardedString","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["sa"]},{"schema":{"name":"statusColumn","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["status"]},{"schema":{"name":"jdbcUrlTemplate","displayName":null,"helpMessage":null,"type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["${testdb.url}"]},{"schema":{"name":"table","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["test2"]}]'/>
- <ConnInstance_capabilities ConnInstance_id="106" capabilities="ONE_PHASE_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="106" capabilities="ONE_PHASE_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="106" capabilities="SEARCH"/>
- <ConnInstance_capabilities ConnInstance_id="106" capabilities="SYNC"/>
+ <ConnInstance_capabilities ConnInstance_id="106" capability="ONE_PHASE_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="106" capability="ONE_PHASE_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="106" capability="SEARCH"/>
+ <ConnInstance_capabilities ConnInstance_id="106" capability="SYNC"/>
<ConnInstance id="107" bundleName="net.tirasa.connid.bundles.db.table"
location="connid://${testconnectorserver.key}@localhost:${testconnectorserver.port}"
connectorName="net.tirasa.connid.bundles.db.table.DatabaseTableConnector"
displayName="H2-testsync" version="${connid.db.table.version}"
jsonConf='[{"schema":{"name":"changeLogColumn","displayName":"Change Log Column (Sync)","helpMessage":"=<b>Change Log Column</b><br>The change log column store the latest change time. Providing this value the Sync capabilities are activated.","type":"java.lang.String","required":false,"order":21,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"nativeTimestamps","displayName":"Native Timestamps ","helpMessage":"<b>Native Timestamps</b><br>Select to retrieve Timestamp data type of the columns in java.sql.Timestamp format from the database table.","type":"boolean","required":false,"order":18,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"cipherAlgorithm","displayName":"Password cipher algorithm (defaults to CLEARTEXT)","helpMessage":"Cipher algorithm used to encode password before to store it onto the database table.\nSpecify one of th
e values among CLEARTEXT,AES, MD5, SHA1, SHA256 or a custom implementation identified by its class name.","type":"java.lang.String","required":false,"order":24,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"enabledStatusValue","displayName":"Enabled Status Value","helpMessage":"<b>Enabled Status Value</b><br>Enter the value for enabled status.","type":"java.lang.String","required":false,"order":12,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"retrievePassword","displayName":"Retrieve password","helpMessage":"Specify if password must be retrieved by default.","type":"boolean","required":true,"order":27,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"datasource","displayName":"Datasource Path","helpMessage":"<b>JDBC Data Source Name/Path</b><br>Enter the JDBC Data Source Name/Path to connect to the Or
acle server. If specified, connector will only try to connect using Datasource and ignore other resource parameters specified.<br>the example value is: <CODE>jdbc/SampleDataSourceName</CODE>","type":"java.lang.String","required":false,"order":22,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"allNative","displayName":"All native","helpMessage":"<b>All native</b><br>Select to retrieve all data type of the columns in a native format from the database table.","type":"boolean","required":false,"order":19,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"user","displayName":"User","helpMessage":"<b>User</b><br>Enter the name of the mandatory Database user with permission to account table.","type":"java.lang.String","required":false,"order":4,"confidential":false,"defaultValues":null},"overridable":false,"values":["sa"]},{"schema":{"name"
:"pwdEncodeToLowerCase","displayName":"Force password encoding to lower case","helpMessage":"Force password encoding to lower case.","type":"boolean","required":false,"order":26,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"jdbcUrlTemplate","displayName":"JDBC Connection URL","helpMessage":"<b>JDBC Connection URL</b><br>Specify the JDBC Driver Connection URL.<br> Oracle template is jdbc:oracle:thin:@[host]:[port(1521)]:[DB].<br> MySQL template is jdbc:mysql://[host]:[port(3306)]/[db], for more info, read the JDBC driver documentation.<br>Could be empty if datasource is provided.","type":"java.lang.String","required":false,"order":15,"confidential":false,"defaultValues":null},"overridable":false,"values":["${testdb.url}"]},{"schema":{"name":"keyColumn","displayName":"Key Column","helpMessage":"<b>Key Column</b><br>This mandatory column value will be used as the unique identi
fier for rows in the table.<br>","type":"java.lang.String","required":true,"order":8,"confidential":false,"defaultValues":null},"overridable":false,"values":["id"]},{"schema":{"name":"validConnectionQuery","displayName":"Validate Connection Query","helpMessage":"<b>Validate Connection Query</b><br>There can be specified the check connection alive query. If empty, default implementation will test it using the switch on/off the autocommit. Some select 1 from dummy table could be more efficient.","type":"java.lang.String","required":false,"order":20,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"rethrowAllSQLExceptions","displayName":"Rethrow all SQLExceptions","helpMessage":"If this is not checked, SQL statements which throw SQLExceptions with a 0 ErrorCode will be have the exception caught and suppressed. Check it to have exceptions with 0 ErrorCodes rethrown.","type":"boolean","required":false,"order":17,"confid
ential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"passwordColumn","displayName":"Password Column","helpMessage":"<b>Password Column</b><br>Enter the name of the column in the table that will hold the password values. If empty, no validation on resource and passwords are activated.","type":"java.lang.String","required":false,"order":9,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"jndiProperties","displayName":"Initial JNDI Properties","helpMessage":"<b>Initial JNDI Properties</b><br>Could be empty or enter the JDBC JNDI Initial context factory, context provider in a format: key = value.","type":"[Ljava.lang.String;","required":false,"order":23,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"password","displayName":"User Password","helpMessage":"<b>User Password</b><br>Enter a user account tha
t has permission to access accounts table.","type":"org.identityconnectors.common.security.GuardedString","required":false,"order":5,"confidential":true,"defaultValues":null},"overridable":false,"values":["sa"]},{"schema":{"name":"host","displayName":"Host","helpMessage":"<b>Host</b><br>Enter the name of the host where the database is running.","type":"java.lang.String","required":false,"order":2,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"port","displayName":"Port","helpMessage":"<b>TCP Port</b><br>Enter the port number the database server is listening on.","type":"java.lang.String","required":false,"order":3,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"statusColumn","displayName":"Status Column","helpMessage":"<b>Status Column</b><br>Enter the name of the column in the table that will hold the status values. If empty enabled and
disabled operation wont be performed.","type":"java.lang.String","required":false,"order":10,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"pwdEncodeToUpperCase","displayName":"Force password encoding to upper case","helpMessage":"Force password encoding to upper case.","type":"boolean","required":false,"order":25,"confidential":false,"defaultValues":null},"overridable":false,"values":["false"]},{"schema":{"name":"enableEmptyString","displayName":"Enable writing empty string","helpMessage":"<b>Enable writing empty string</b><br>Select to enable support for writing an empty strings, instead of a NULL value, in character based columns defined as not-null in the table schema. This option does not influence the way strings are written for Oracle based tables. By default empty strings are written as a NULL value.","type":"boolean","required":false,"order":16,"confidential":false,"defaultValues":null},"overridable":false,"
values":["false"]},{"schema":{"name":"database","displayName":"Database","helpMessage":"<b>Database</b><br>Enter the name of the database on the database server that contains the table.","type":"java.lang.String","required":false,"order":6,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"defaultStatusValue","displayName":"Default Status Value","helpMessage":"<b>Default Status Value</b><br>Enter the value for status in case of status not specified.","type":"java.lang.String","required":false,"order":13,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"table","displayName":"Table","helpMessage":"<b>Table</b><br>Enter the name of the table in the database that contains the accounts.","type":"java.lang.String","required":true,"order":7,"confidential":false,"defaultValues":null},"overridable":false,"values":["testsync"]},{"schema":{"name":"disab
ledStatusValue","displayName":"Disabled Status Value","helpMessage":"<b>Disabled Status Value</b><br>Enter the value for disabled status.","type":"java.lang.String","required":false,"order":11,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"jdbcDriver","displayName":"JDBC Driver","helpMessage":"<b>JDBC Driver</b><br>Specify the JDBC Driver class name. Oracle is oracle.jdbc.driver.OracleDriver. MySQL is org.gjt.mm.mysql.Driver.<br>Could be empty if datasource is provided.","type":"java.lang.String","required":false,"order":14,"confidential":false,"defaultValues":null},"overridable":false,"values":["org.h2.Driver"]},{"schema":{"name":"quoting","displayName":"Name Quoting","helpMessage":"<b>Name Quoting</b><br>Select whether database column names for this resource should be quoted, and the quoting characters. By default, database column names are not quoted (None). For other selec
tions (Single, Double, Back, or Brackets), column names will appear between single quotes, double quotes, back quotes, or brackets in the SQL generated to access the database.","type":"java.lang.String","required":false,"order":1,"confidential":false,"defaultValues":null},"overridable":false,"values":[]},{"schema":{"name":"cipherKey","displayName":"Password cipher key","helpMessage":"Specify key in case of reversible algorithm.","type":"java.lang.String","required":false,"order":25,"confidential":false,"defaultValues":null},"overridable":false,"values":[]}]'/>
- <ConnInstance_capabilities ConnInstance_id="107" capabilities="ONE_PHASE_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="107" capabilities="TWO_PHASES_CREATE"/>
- <ConnInstance_capabilities ConnInstance_id="107" capabilities="ONE_PHASE_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="107" capabilities="TWO_PHASES_UPDATE"/>
- <ConnInstance_capabilities ConnInstance_id="107" capabilities="ONE_PHASE_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="107" capabilities="TWO_PHASES_DELETE"/>
- <ConnInstance_capabilities ConnInstance_id="107" capabilities="SEARCH"/>
+ <ConnInstance_capabilities ConnInstance_id="107" capability="ONE_PHASE_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="107" capability="TWO_PHASES_CREATE"/>
+ <ConnInstance_capabilities ConnInstance_id="107" capability="ONE_PHASE_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="107" capability="TWO_PHASES_UPDATE"/>
+ <ConnInstance_capabilities ConnInstance_id="107" capability="ONE_PHASE_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="107" capability="TWO_PHASES_DELETE"/>
+ <ConnInstance_capabilities ConnInstance_id="107" capability="SEARCH"/>
<ExternalResource name="ws-target-resource-1" connector_id="100"
randomPwdIfNotProvided="0" enforceMandatoryCondition="0" propagationMode="TWO_PHASES"
@@ -610,7 +629,7 @@ under the License.
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource_PropActions externalResource_name="resource-ldap"
- action="org.apache.syncope.core.provisioning.java.propagation.LDAPMembershipPropagationActions"/>
+ actionClassName="org.apache.syncope.core.provisioning.java.propagation.LDAPMembershipPropagationActions"/>
<ExternalResource name="ws-target-resource-nopropagation" connector_id="103"
randomPwdIfNotProvided="0" enforceMandatoryCondition="1" propagationMode="TWO_PHASES"
propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
@@ -997,20 +1016,20 @@ under the License.
<Notification id="1" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1"
sender="admin@syncope.apache.org" subject="Password Reset request" template="requestPasswordReset"
traceLevel="FAILURES" userAbout="token!=$null"/>
- <Notification_events Notification_id="1" events="[CUSTOM]:[]:[]:[requestPasswordReset]:[SUCCESS]"/>
+ <Notification_events Notification_id="1" event="[CUSTOM]:[]:[]:[requestPasswordReset]:[SUCCESS]"/>
<Notification id="2" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1"
sender="admin@syncope.apache.org" subject="Password Reset successful" template="confirmPasswordReset"
traceLevel="FAILURES" userAbout="token!=$null"/>
- <Notification_events Notification_id="2" events="[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"/>
+ <Notification_events Notification_id="2" event="[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"/>
<Notification id="10" sender="test@syncope.apache.org" subject="Test subject" template="test" selfAsRecipient="0"
traceLevel="FAILURES"
userAbout="fullname==*o*;fullname==*i*"
recipients="$groups==7"
recipientAttrType="UserPlainSchema" recipientAttrName="email" active="1"/>
- <Notification_events Notification_id="10" events="[CUSTOM]:[]:[]:[unexisting1]:[FAILURE]"/>
- <Notification_events Notification_id="10" events="[CUSTOM]:[]:[]:[unexisting2]:[SUCCESS]"/>
+ <Notification_events Notification_id="10" event="[CUSTOM]:[]:[]:[unexisting1]:[FAILURE]"/>
+ <Notification_events Notification_id="10" event="[CUSTOM]:[]:[]:[unexisting2]:[SUCCESS]"/>
<NotificationTask_recipients notificationtask_id="8" address="recipient@prova.org"/>
@@ -1028,6 +1047,11 @@ under the License.
<Entitlement name="REALM_CREATE"/>
<Entitlement name="REALM_UPDATE"/>
<Entitlement name="REALM_DELETE"/>
+ <Entitlement name="ROLE_LIST"/>
+ <Entitlement name="ROLE_CREATE"/>
+ <Entitlement name="ROLE_READ"/>
+ <Entitlement name="ROLE_UPDATE"/>
+ <Entitlement name="ROLE_DELETE"/>
<Entitlement name="SCHEMA_LIST"/>
<Entitlement name="SCHEMA_CREATE"/>
<Entitlement name="SCHEMA_READ"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RoleDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RoleDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RoleDataBinder.java
new file mode 100644
index 0000000..7631543
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RoleDataBinder.java
@@ -0,0 +1,31 @@
+/*
+ * 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.provisioning.api.data;
+
+import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.core.persistence.api.entity.Role;
+
+public interface RoleDataBinder {
+
+ Role create(RoleTO roleTO);
+
+ void update(Role role, RoleTO roleTO);
+
+ RoleTO getRoleTO(Role role);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java
new file mode 100644
index 0000000..842bf35
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java
@@ -0,0 +1,96 @@
+/*
+ * 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.provisioning.java.data;
+
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+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.data.RoleDataBinder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RoleDataBinderImpl implements RoleDataBinder {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RoleDataBinder.class);
+
+ @Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
+ private EntityFactory entityFactory;
+
+ @Override
+ public Role create(final RoleTO roleTO) {
+ Role role = entityFactory.newEntity(Role.class);
+ update(role, roleTO);
+ return role;
+ }
+
+ @Override
+ public void update(final Role role, final RoleTO roleTO) {
+ role.setName(roleTO.getName());
+ role.setCriteria(roleTO.getCriteria());
+
+ role.getEntitlements().clear();
+ role.getEntitlements().addAll(roleTO.getEntitlements());
+
+ role.getRealms().clear();
+ CollectionUtils.forAllDo(roleTO.getRealms(), new Closure<String>() {
+
+ @Override
+ public void execute(final String realmFullPath) {
+ Realm realm = realmDAO.find(realmFullPath);
+ if (realm == null) {
+ LOG.warn("Invalid realm full path {}, ignoring", realmFullPath);
+ } else {
+ role.addRealm(realm);
+ }
+ }
+ });
+ }
+
+ @Override
+ public RoleTO getRoleTO(final Role role) {
+ RoleTO roleTO = new RoleTO();
+
+ roleTO.setKey(role.getKey());
+ roleTO.setName(role.getName());
+ roleTO.setCriteria(role.getCriteria());
+ roleTO.getEntitlements().addAll(role.getEntitlements());
+
+ CollectionUtils.collect(role.getRealms(), new Transformer<Realm, String>() {
+
+ @Override
+ public String transform(final Realm input) {
+ return input.getFullPath();
+ }
+ }, roleTO.getRealms());
+
+ return roleTO;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RoleServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RoleServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RoleServiceImpl.java
new file mode 100644
index 0000000..33403fd
--- /dev/null
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RoleServiceImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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 java.net.URI;
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.service.RoleService;
+import org.apache.syncope.core.logic.RoleLogic;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class RoleServiceImpl extends AbstractServiceImpl implements RoleService {
+
+ @Autowired
+ private RoleLogic logic;
+
+ @Override
+ public List<RoleTO> list() {
+ return logic.list();
+ }
+
+ @Override
+ public RoleTO read(final Long roleKey) {
+ return logic.read(roleKey);
+ }
+
+ @Override
+ public Response create(final RoleTO roleTO) {
+ RoleTO created = logic.create(roleTO);
+ URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(created.getKey())).build();
+ return Response.created(location).
+ header(RESTHeaders.RESOURCE_ID, created.getKey()).
+ build();
+ }
+
+ @Override
+ public void update(final Long roleKey, final RoleTO roleTO) {
+ roleTO.setKey(roleKey);
+ logic.update(roleTO);
+ }
+
+ @Override
+ public void delete(final Long roleKey) {
+ logic.delete(roleKey);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
index ed264d5..cd8ce6f 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
@@ -59,6 +59,7 @@ import org.apache.syncope.common.rest.api.service.ReportService;
import org.apache.syncope.common.rest.api.service.ResourceService;
import org.apache.syncope.common.rest.api.service.GroupService;
import org.apache.syncope.common.rest.api.service.RealmService;
+import org.apache.syncope.common.rest.api.service.RoleService;
import org.apache.syncope.common.rest.api.service.SchemaService;
import org.apache.syncope.common.rest.api.service.SecurityQuestionService;
import org.apache.syncope.common.rest.api.service.SyncopeService;
@@ -149,6 +150,8 @@ public abstract class AbstractITCase {
protected static RealmService realmService;
+ protected static RoleService roleService;
+
protected static UserService userService;
protected static UserSelfService userSelfService;
@@ -218,6 +221,7 @@ public abstract class AbstractITCase {
syncopeService = adminClient.getService(SyncopeService.class);
realmService = adminClient.getService(RealmService.class);
+ roleService = adminClient.getService(RoleService.class);
userService = adminClient.getService(UserService.class);
userSelfService = adminClient.getService(UserSelfService.class);
userWorkflowService = adminClient.getService(UserWorkflowService.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java
new file mode 100644
index 0000000..a39be36
--- /dev/null
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java
@@ -0,0 +1,124 @@
+/*
+ * 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.fit.core.reference;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.client.lib.SyncopeClient;
+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.Entitlement;
+import org.apache.syncope.common.rest.api.service.RoleService;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.JVM)
+public class RoleITCase extends AbstractITCase {
+
+ @Test
+ public void list() {
+ List<RoleTO> roleTOs = roleService.list();
+ assertNotNull(roleTOs);
+ assertFalse(roleTOs.isEmpty());
+ for (RoleTO instance : roleTOs) {
+ assertNotNull(instance);
+ }
+ }
+
+ @Test
+ public void read() {
+ RoleTO roleTO = roleService.read(3L);
+ assertNotNull(roleTO);
+ assertTrue(roleTO.getEntitlements().contains(Entitlement.GROUP_READ));
+ }
+
+ private RoleTO buildRoleTO(final String name) {
+ RoleTO role = new RoleTO();
+ role.setName(name + getUUIDString());
+ role.setCriteria(SyncopeClient.getUserSearchConditionBuilder().inGroups(2L).query());
+ role.getRealms().add("/even");
+ role.getEntitlements().add(Entitlement.LOG_SET_LEVEL);
+
+ return role;
+ }
+
+ @Test
+ public void create() {
+ RoleTO role = new RoleTO();
+ role.setName("new" + getUUIDString());
+ role.setCriteria(SyncopeClient.getUserSearchConditionBuilder().inGroups(2L).query());
+ role.getRealms().add("/");
+ role.getRealms().add("/even/two");
+ role.getEntitlements().add(Entitlement.LOG_LIST);
+ role.getEntitlements().add(Entitlement.LOG_SET_LEVEL);
+
+ Response response = roleService.create(role);
+
+ RoleTO actual = getObject(response.getLocation(), RoleService.class, RoleTO.class);
+ assertNotNull(actual);
+ }
+
+ @Test
+ public void update() {
+ RoleTO role = buildRoleTO("update");
+ Response response = roleService.create(role);
+
+ RoleTO actual = getObject(response.getLocation(), RoleService.class, RoleTO.class);
+ assertNotNull(actual);
+
+ role = actual;
+ assertFalse(role.getEntitlements().contains(Entitlement.WORKFLOW_TASK_LIST));
+ assertFalse(role.getRealms().contains("/even/two"));
+
+ role.getEntitlements().add(Entitlement.WORKFLOW_TASK_LIST);
+ role.getRealms().add("/even/two");
+
+ roleService.update(role.getKey(), role);
+
+ actual = roleService.read(role.getKey());
+ assertTrue(actual.getEntitlements().contains(Entitlement.WORKFLOW_TASK_LIST));
+ assertTrue(actual.getRealms().contains("/even/two"));
+ }
+
+ @Test
+ public void delete() {
+ RoleTO role = buildRoleTO("delete");
+ Response response = roleService.create(role);
+
+ RoleTO actual = getObject(response.getLocation(), RoleService.class, RoleTO.class);
+ assertNotNull(actual);
+
+ roleService.delete(actual.getKey());
+
+ try {
+ roleService.read(actual.getKey());
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(ClientExceptionType.NotFound, e.getType());
+ }
+ }
+}
[57/57] syncope git commit: [SYNCOPE-119] Better integration with
changes from SYNCOPE-654
Posted by il...@apache.org.
[SYNCOPE-119] Better integration with changes from SYNCOPE-654
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/eb9ea2a2
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/eb9ea2a2
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/eb9ea2a2
Branch: refs/heads/master
Commit: eb9ea2a279000f8c52780404e410efc888078dee
Parents: 4115c57
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 21 11:29:57 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 21 11:29:57 2015 +0200
----------------------------------------------------------------------
.../apache/syncope/client/lib/RestClientFactoryBean.java | 4 +++-
.../java/org/apache/syncope/client/lib/SyncopeClient.java | 9 +++++++--
.../main/java/org/apache/syncope/core/logic/UserLogic.java | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/eb9ea2a2/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
----------------------------------------------------------------------
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java b/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
index f7a00df..754a745 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
@@ -28,6 +28,8 @@ import org.apache.cxf.jaxrs.client.WebClient;
*/
public class RestClientFactoryBean extends JAXRSClientFactoryBean {
+ public static final String HEADER_SPLIT_PROPERTY = "org.apache.cxf.http.header.split";
+
/**
* Creates an anonymous instance of the given service class, for the given content type.
*
@@ -63,7 +65,7 @@ public class RestClientFactoryBean extends JAXRSClientFactoryBean {
final T serviceInstance = create(serviceClass);
WebClient.client(serviceInstance).type(mediaType).accept(mediaType);
WebClient.getConfig(WebClient.client(serviceInstance)).
- getRequestContext().put("org.apache.cxf.http.header.split", true);
+ getRequestContext().put(HEADER_SPLIT_PROPERTY, true);
return serviceInstance;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/eb9ea2a2/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
----------------------------------------------------------------------
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
index c921272..4949740 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
@@ -110,7 +110,12 @@ public class SyncopeClient {
@SuppressWarnings("unchecked")
public Pair<Map<Entitlement, Set<String>>, UserTO> self() {
- Response response = getService(UserSelfService.class).read();
+ // Explicitly disable header value split because it interferes with JSON deserialization below
+ UserSelfService serviceInstance = getService(UserSelfService.class);
+ WebClient.getConfig(WebClient.client(serviceInstance)).
+ getRequestContext().put(RestClientFactoryBean.HEADER_SPLIT_PROPERTY, false);
+
+ Response response = serviceInstance.read();
if (response.getStatusInfo().getStatusCode() != Response.Status.OK.getStatusCode()) {
Exception ex = exceptionMapper.fromResponse(response);
if (ex != null) {
@@ -121,7 +126,7 @@ public class SyncopeClient {
try {
return new ImmutablePair<>(
(Map<Entitlement, Set<String>>) new ObjectMapper().readValue(
- response.getHeaderString(RESTHeaders.OWNED_ENTITLEMENTS).replaceAll("%2C", ","),
+ response.getHeaderString(RESTHeaders.OWNED_ENTITLEMENTS),
new TypeReference<HashMap<Entitlement, Set<String>>>() {
}),
response.readEntity(UserTO.class));
http://git-wip-us.apache.org/repos/asf/syncope/blob/eb9ea2a2/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index 10a3650..4929d62 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@ -140,7 +140,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
@Transactional(readOnly = true)
public Pair<String, UserTO> readSelf() {
return ImmutablePair.of(
- POJOHelper.serialize(AuthContextUtils.getAuthorizations()).replaceAll(",", "%2C"),
+ POJOHelper.serialize(AuthContextUtils.getAuthorizations()),
binder.getAuthenticatedUserTO());
}
[11/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARole.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARole.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARole.java
deleted file mode 100644
index 2990ad4..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARole.java
+++ /dev/null
@@ -1,593 +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.role;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.persistence.Basic;
-import javax.persistence.Cacheable;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
-import javax.validation.Valid;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.Schema;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
-import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.persistence.jpa.validation.entity.RoleCheck;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractSubject;
-import org.apache.syncope.core.persistence.jpa.entity.JPAAccountPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.JPAEntitlement;
-import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
-import org.apache.syncope.core.persistence.jpa.entity.JPAPasswordPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
-
-@Entity
-@Table(name = JPARole.TABLE, uniqueConstraints =
- @UniqueConstraint(columnNames = { "name", "parent_id" }))
-@Cacheable
-@RoleCheck
-public class JPARole extends AbstractSubject<RPlainAttr, RDerAttr, RVirAttr> implements Role {
-
- private static final long serialVersionUID = -5281258853142421875L;
-
- public static final String TABLE = "SyncopeRole";
-
- @Id
- private Long id;
-
- @NotNull
- private String name;
-
- @ManyToOne(optional = true)
- private JPARole parent;
-
- @ManyToOne(optional = true)
- private JPAUser userOwner;
-
- @ManyToOne(optional = true)
- private JPARole roleOwner;
-
- @ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(joinColumns =
- @JoinColumn(name = "role_id"),
- inverseJoinColumns =
- @JoinColumn(name = "entitlement_name"))
- private Set<JPAEntitlement> entitlements;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- @Valid
- private List<JPARPlainAttrTemplate> rAttrTemplates;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- @Valid
- private List<JPARDerAttrTemplate> rDerAttrTemplates;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- @Valid
- private List<JPARVirAttrTemplate> rVirAttrTemplates;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- @Valid
- private List<JPAMPlainAttrTemplate> mAttrTemplates;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- @Valid
- private List<JPAMDerAttrTemplate> mDerAttrTemplates;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- @Valid
- private List<JPAMVirAttrTemplate> mVirAttrTemplates;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- @Valid
- private List<JPARPlainAttr> plainAttrs;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- @Valid
- private List<JPARDerAttr> derAttrs;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- @Valid
- private List<JPARVirAttr> virAttrs;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritOwner;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritTemplates;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritPlainAttrs;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritDerAttrs;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritVirAttrs;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritPasswordPolicy;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritAccountPolicy;
-
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
- private JPAPasswordPolicy passwordPolicy;
-
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
- private JPAAccountPolicy accountPolicy;
-
- /**
- * Provisioning external resources.
- */
- @ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(joinColumns =
- @JoinColumn(name = "role_id"),
- inverseJoinColumns =
- @JoinColumn(name = "resource_name"))
- @Valid
- private Set<JPAExternalResource> resources;
-
- public JPARole() {
- super();
-
- entitlements = new HashSet<>();
-
- rAttrTemplates = new ArrayList<>();
- rDerAttrTemplates = new ArrayList<>();
- rVirAttrTemplates = new ArrayList<>();
- mAttrTemplates = new ArrayList<>();
- mDerAttrTemplates = new ArrayList<>();
- mVirAttrTemplates = new ArrayList<>();
-
- plainAttrs = new ArrayList<>();
- derAttrs = new ArrayList<>();
- virAttrs = new ArrayList<>();
-
- inheritOwner = getBooleanAsInteger(false);
- inheritTemplates = getBooleanAsInteger(false);
- inheritPlainAttrs = getBooleanAsInteger(false);
- inheritDerAttrs = getBooleanAsInteger(false);
- inheritVirAttrs = getBooleanAsInteger(false);
- inheritPasswordPolicy = getBooleanAsInteger(false);
- inheritAccountPolicy = getBooleanAsInteger(false);
-
- resources = new HashSet<>();
- }
-
- @Override
- public Long getKey() {
- return id;
- }
-
- @Override
- protected Set<? extends ExternalResource> internalGetResources() {
- return resources;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public Role getParent() {
- return parent;
- }
-
- @Override
- public void setParent(final Role parent) {
- checkType(parent, JPARole.class);
- this.parent = (JPARole) parent;
- }
-
- @Override
- public boolean isInheritOwner() {
- return isBooleanAsInteger(inheritOwner);
- }
-
- @Override
- public void setInheritOwner(final boolean inheritOwner) {
- this.inheritOwner = getBooleanAsInteger(inheritOwner);
- }
-
- @Override
- public User getUserOwner() {
- return userOwner;
- }
-
- @Override
- public void setUserOwner(final User userOwner) {
- checkType(userOwner, JPAUser.class);
- this.userOwner = (JPAUser) userOwner;
- }
-
- @Override
- public JPARole getRoleOwner() {
- return roleOwner;
- }
-
- @Override
- public void setRoleOwner(final Role roleOwner) {
- checkType(roleOwner, JPARole.class);
- this.roleOwner = (JPARole) roleOwner;
- }
-
- @Override
- public boolean addEntitlement(final Entitlement entitlement) {
- checkType(entitlement, JPAEntitlement.class);
- return entitlements.add((JPAEntitlement) entitlement);
- }
-
- @Override
- public boolean removeEntitlement(final Entitlement entitlement) {
- checkType(entitlement, JPAEntitlement.class);
- return entitlements.remove((JPAEntitlement) entitlement);
- }
-
- @Override
- public Set<? extends Entitlement> getEntitlements() {
- return entitlements;
- }
-
- @Override
- public boolean isInheritTemplates() {
- return isBooleanAsInteger(inheritTemplates);
- }
-
- @Override
- public void setInheritTemplates(final boolean inheritAttrTemplates) {
- this.inheritTemplates = getBooleanAsInteger(inheritAttrTemplates);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends AttrTemplate<K>, K extends Schema> List<T> getAttrTemplates(final Class<T> reference) {
- List<T> result = new ArrayList<>();
-
- if (RPlainAttrTemplate.class.isAssignableFrom(reference)) {
- result = (List<T>) rAttrTemplates;
- } else if (RDerAttrTemplate.class.isAssignableFrom(reference)) {
- result = (List<T>) rDerAttrTemplates;
- } else if (RVirAttrTemplate.class.isAssignableFrom(reference)) {
- result = (List<T>) rVirAttrTemplates;
- } else if (MPlainAttrTemplate.class.isAssignableFrom(reference)) {
- result = (List<T>) mAttrTemplates;
- } else if (MDerAttrTemplate.class.isAssignableFrom(reference)) {
- result = (List<T>) mDerAttrTemplates;
- } else if (MVirAttrTemplate.class.isAssignableFrom(reference)) {
- result = (List<T>) mVirAttrTemplates;
- }
-
- return result;
- }
-
- @Override
- public <T extends AttrTemplate<K>, K extends Schema> T getAttrTemplate(
- final Class<T> reference, final String schemaName) {
-
- T result = null;
-
- for (T template : findInheritedTemplates(reference)) {
- if (schemaName.equals(template.getSchema().getKey())) {
- result = template;
- }
- }
-
- return result;
- }
-
- @Override
- public <T extends AttrTemplate<K>, K extends Schema> List<K> getAttrTemplateSchemas(final Class<T> reference) {
- final List<K> result = new ArrayList<>();
-
- for (T template : findInheritedTemplates(reference)) {
- result.add(template.getSchema());
- }
-
- return result;
- }
-
- @Override
- public <T extends AttrTemplate<K>, K extends Schema> List<T> findInheritedTemplates(final Class<T> reference) {
- final List<T> result = new ArrayList<>(getAttrTemplates(reference));
-
- if (isInheritTemplates() && getParent() != null) {
- result.addAll(getParent().findInheritedTemplates(reference));
- }
-
- return result;
- }
-
- @Override
- public boolean addPlainAttr(final RPlainAttr attr) {
- checkType(attr, JPARPlainAttr.class);
- return plainAttrs.add((JPARPlainAttr) attr);
- }
-
- @Override
- public boolean removePlainAttr(final RPlainAttr attr) {
- checkType(attr, JPARPlainAttr.class);
- return plainAttrs.remove((JPARPlainAttr) attr);
- }
-
- @Override
- public List<? extends RPlainAttr> getPlainAttrs() {
- return plainAttrs;
- }
-
- @Override
- public boolean addDerAttr(final RDerAttr attr) {
- checkType(attr, JPARDerAttr.class);
- return derAttrs.add((JPARDerAttr) attr);
- }
-
- @Override
- public boolean removeDerAttr(final RDerAttr attr) {
- checkType(attr, JPARDerAttr.class);
- return derAttrs.remove((JPARDerAttr) attr);
- }
-
- @Override
- public List<? extends RDerAttr> getDerAttrs() {
- return derAttrs;
- }
-
- @Override
- public boolean addVirAttr(final RVirAttr attr) {
- checkType(attr, JPARVirAttr.class);
- return virAttrs.add((JPARVirAttr) attr);
- }
-
- @Override
- public boolean removeVirAttr(final RVirAttr attr) {
- checkType(attr, JPARVirAttr.class);
- return virAttrs.remove((JPARVirAttr) attr);
- }
-
- @Override
- public List<? extends RVirAttr> getVirAttrs() {
- return virAttrs;
- }
-
- @Override
- public boolean isInheritPlainAttrs() {
- return isBooleanAsInteger(inheritPlainAttrs);
- }
-
- @Override
- public void setInheritPlainAttrs(final boolean inheritPlainAttrs) {
- this.inheritPlainAttrs = getBooleanAsInteger(inheritPlainAttrs);
- }
-
- /**
- * Get all inherited attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- @Override
- public List<? extends RPlainAttr> findLastInheritedAncestorPlainAttrs() {
- final Map<JPARPlainSchema, RPlainAttr> result = new HashMap<>();
-
- if (!isInheritPlainAttrs()) {
- return plainAttrs;
- }
- if (isInheritPlainAttrs() && getParent() != null) {
- final Map<PlainSchema, RPlainAttr> attrMap = getPlainAttrMap();
-
- // Add inherit attributes
- for (RPlainAttr attr : getParent().findLastInheritedAncestorPlainAttrs()) {
- if (attrMap.containsKey(attr.getSchema())) {
- result.remove((JPARPlainSchema) attr.getSchema());
- }
- result.put((JPARPlainSchema) attr.getSchema(), attr);
- }
- }
- return new ArrayList<>(result.values());
- }
-
- @Override
- public boolean isInheritDerAttrs() {
- return isBooleanAsInteger(inheritDerAttrs);
- }
-
- @Override
- public void setInheritDerAttrs(final boolean inheritDerAttrs) {
- this.inheritDerAttrs = getBooleanAsInteger(inheritDerAttrs);
-
- }
-
- /**
- * Get all inherited derived attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- @Override
- public List<? extends RDerAttr> findLastInheritedAncestorDerAttrs() {
- final Map<RDerSchema, RDerAttr> result = new HashMap<>();
-
- if (!isInheritDerAttrs()) {
- return derAttrs;
- }
- if (isInheritDerAttrs() && getParent() != null) {
- Map<DerSchema, RDerAttr> derAttrMap = getDerAttrMap();
-
- // Add inherit derived attributes
- for (RDerAttr attr : getParent().findLastInheritedAncestorDerAttrs()) {
- if (derAttrMap.containsKey(attr.getSchema())) {
- result.remove(attr.getSchema());
- }
- result.put(attr.getSchema(), attr);
- }
- }
- return new ArrayList<>(result.values());
- }
-
- @Override
- public boolean isInheritVirAttrs() {
- return isBooleanAsInteger(inheritVirAttrs);
- }
-
- @Override
- public void setInheritVirAttrs(final boolean inheritVirAttrs) {
- this.inheritVirAttrs = getBooleanAsInteger(inheritVirAttrs);
-
- }
-
- /**
- * Get all inherited virtual attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- @Override
- public List<? extends RVirAttr> findLastInheritedAncestorVirAttrs() {
- final Map<RVirSchema, RVirAttr> result = new HashMap<>();
-
- if (!isInheritVirAttrs()) {
- return virAttrs;
- }
-
- if (isInheritVirAttrs() && getParent() != null) {
- Map<VirSchema, RVirAttr> virAttrMap = getVirAttrMap();
-
- // Add inherit virtual attributes
- for (RVirAttr attr : getParent().findLastInheritedAncestorVirAttrs()) {
- if (virAttrMap.containsKey(attr.getSchema())) {
- result.remove(attr.getSchema());
- }
- result.put(attr.getSchema(), attr);
- }
- }
- return new ArrayList<>(result.values());
- }
-
- /**
- * Get first valid password policy.
- *
- * @return parent password policy if isInheritPasswordPolicy is 'true' and parent is not null, local password policy
- * otherwise
- */
- @Override
- public PasswordPolicy getPasswordPolicy() {
- return isInheritPasswordPolicy() && getParent() != null
- ? getParent().getPasswordPolicy()
- : passwordPolicy;
- }
-
- @Override
- public void setPasswordPolicy(final PasswordPolicy passwordPolicy) {
- checkType(passwordPolicy, JPAPasswordPolicy.class);
- this.passwordPolicy = (JPAPasswordPolicy) passwordPolicy;
- }
-
- @Override
- public boolean isInheritPasswordPolicy() {
- return isBooleanAsInteger(inheritPasswordPolicy);
- }
-
- @Override
- public void setInheritPasswordPolicy(final boolean inheritPasswordPolicy) {
- this.inheritPasswordPolicy = getBooleanAsInteger(inheritPasswordPolicy);
- }
-
- /**
- * Get first valid account policy.
- *
- * @return parent account policy if isInheritAccountPolicy is 'true' and parent is not null, local account policy
- * otherwise.
- */
- @Override
- public AccountPolicy getAccountPolicy() {
- return isInheritAccountPolicy() && getParent() != null
- ? getParent().getAccountPolicy()
- : accountPolicy;
- }
-
- @Override
- public void setAccountPolicy(final AccountPolicy accountPolicy) {
- checkType(accountPolicy, JPAAccountPolicy.class);
- this.accountPolicy = (JPAAccountPolicy) accountPolicy;
- }
-
- @Override
- public boolean isInheritAccountPolicy() {
- return isBooleanAsInteger(inheritAccountPolicy);
- }
-
- @Override
- public void setInheritAccountPolicy(boolean inheritAccountPolicy) {
- this.inheritAccountPolicy = getBooleanAsInteger(inheritAccountPolicy);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPushTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPushTask.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPushTask.java
index 041e206..c627dd2 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPushTask.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPushTask.java
@@ -46,7 +46,7 @@ public class JPAPushTask extends AbstractProvisioningTask implements PushTask {
private String userFilter;
- private String roleFilter;
+ private String groupFilter;
/**
* Default constructor.
@@ -71,12 +71,12 @@ public class JPAPushTask extends AbstractProvisioningTask implements PushTask {
}
@Override
- public String getRoleFilter() {
- return roleFilter;
+ public String getGroupFilter() {
+ return groupFilter;
}
@Override
- public void setRoleFilter(final String roleFilter) {
- this.roleFilter = roleFilter;
+ public void setGroupFilter(final String filter) {
+ this.groupFilter = filter;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java
index 7d142b2..b26bb0c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java
@@ -31,7 +31,7 @@ import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
@@ -55,7 +55,7 @@ public class JPASyncTask extends AbstractProvisioningTask implements SyncTask {
private String userTemplate;
@Lob
- private String roleTemplate;
+ private String groupTemplate;
@Basic
@Min(0)
@@ -87,15 +87,15 @@ public class JPASyncTask extends AbstractProvisioningTask implements SyncTask {
}
@Override
- public RoleTO getRoleTemplate() {
+ public GroupTO getGroupTemplate() {
return userTemplate == null
- ? new RoleTO()
- : POJOHelper.deserialize(roleTemplate, RoleTO.class);
+ ? new GroupTO()
+ : POJOHelper.deserialize(groupTemplate, GroupTO.class);
}
@Override
- public void setRoleTemplate(final RoleTO roleTemplate) {
- this.roleTemplate = POJOHelper.serialize(roleTemplate);
+ public void setGroupTemplate(final GroupTO groupTemplate) {
+ this.groupTemplate = POJOHelper.serialize(groupTemplate);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
index 8b1e798..704c3b7 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
@@ -53,7 +53,7 @@ import javax.validation.constraints.NotNull;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
@@ -211,12 +211,12 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
}
@Override
- public Membership getMembership(final Long roleKey) {
+ public Membership getMembership(final Long groupKey) {
Membership result = null;
Membership membership;
for (Iterator<? extends Membership> itor = getMemberships().iterator(); result == null && itor.hasNext();) {
membership = itor.next();
- if (membership.getRole() != null && roleKey.equals(membership.getRole().getKey())) {
+ if (membership.getGroup() != null && groupKey.equals(membership.getGroup().getKey())) {
result = membership;
}
}
@@ -229,12 +229,12 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
}
@Override
- public List<Role> getRoles() {
- List<Role> result = new ArrayList<>();
+ public List<Group> getGroups() {
+ List<Group> result = new ArrayList<>();
for (Membership membership : memberships) {
- if (membership.getRole() != null) {
- result.add(membership.getRole());
+ if (membership.getGroup() != null) {
+ result.add(membership.getGroup());
}
}
@@ -242,12 +242,12 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
}
@Override
- public Set<Long> getRoleKeys() {
- List<Role> roles = getRoles();
+ public Set<Long> getGroupKeys() {
+ List<Group> groups = getGroups();
- Set<Long> result = new HashSet<>(roles.size());
- for (Role role : roles) {
- result.add(role.getKey());
+ Set<Long> result = new HashSet<>(groups.size());
+ for (Group group : groups) {
+ result.add(group.getKey());
}
return result;
@@ -257,8 +257,8 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
public Set<ExternalResource> getResources() {
Set<ExternalResource> result = new HashSet<>();
result.addAll(super.getResources());
- for (Role role : getRoles()) {
- result.addAll(role.getResources());
+ for (Group group : getGroups()) {
+ result.addAll(group.getResources());
}
return result;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
index 2cc90f0..5737287 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
@@ -78,10 +78,10 @@ public class ExternalResourceValidator extends AbstractValidator<ExternalResourc
final MappingItem accountId = mapping.getAccountIdItem();
if (mapping instanceof UMapping
- && AttributableType.ROLE == accountId.getIntMappingType().getAttributableType()) {
+ && AttributableType.GROUP == accountId.getIntMappingType().getAttributableType()) {
context.buildConstraintViolationWithTemplate(
getTemplate(EntityViolationType.InvalidMapping,
- "Role attribute as accountId is not permitted")).
+ "Group attribute as accountId is not permitted")).
addPropertyNode("attributableType").addConstraintViolation();
return false;
}
@@ -137,6 +137,6 @@ public class ExternalResourceValidator extends AbstractValidator<ExternalResourc
}
}
- return isValid(resource.getUmapping(), context) && isValid(resource.getRmapping(), context);
+ return isValid(resource.getUmapping(), context) && isValid(resource.getGmapping(), context);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupCheck.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupCheck.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupCheck.java
new file mode 100644
index 0000000..b7bd229
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupCheck.java
@@ -0,0 +1,41 @@
+/*
+ * 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.validation.entity;
+
+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;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = GroupValidator.class)
+@Documented
+public @interface GroupCheck {
+
+ String message() default "{org.apache.syncope.core.persistence.validation.group}";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupValidator.java
new file mode 100644
index 0000000..078217f
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupValidator.java
@@ -0,0 +1,44 @@
+/*
+ * 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.validation.entity;
+
+import javax.validation.ConstraintValidatorContext;
+import org.apache.syncope.common.lib.types.EntityViolationType;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+
+public class GroupValidator extends AbstractValidator<GroupCheck, Group> {
+
+ @Override
+ public boolean isValid(final Group object, final ConstraintValidatorContext context) {
+ context.disableDefaultConstraintViolation();
+
+ boolean isValid = true;
+
+ if (object.getUserOwner() != null && object.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();
+ }
+
+ return isValid;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/PlainAttrValueValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/PlainAttrValueValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/PlainAttrValueValidator.java
index 6069882..ae2e3ae 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/PlainAttrValueValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/PlainAttrValueValidator.java
@@ -24,7 +24,7 @@ import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema;
public class PlainAttrValueValidator extends AbstractValidator<PlainAttrValueCheck, PlainAttrValue> {
@@ -78,8 +78,8 @@ public class PlainAttrValueValidator extends AbstractValidator<PlainAttrValueChe
EntityViolationType violationType = attrSchema instanceof UPlainSchema
? EntityViolationType.InvalidUPlainSchema
- : attrSchema instanceof RPlainSchema
- ? EntityViolationType.InvalidRPlainSchema
+ : attrSchema instanceof GPlainSchema
+ ? EntityViolationType.InvalidGPlainSchema
: attrSchema instanceof MPlainSchema
? EntityViolationType.InvalidMPlainSchema
: EntityViolationType.InvalidCPlainSchema;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleCheck.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleCheck.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleCheck.java
deleted file mode 100644
index 04cfd63..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleCheck.java
+++ /dev/null
@@ -1,41 +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.validation.entity;
-
-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;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = RoleValidator.class)
-@Documented
-public @interface RoleCheck {
-
- String message() default "{org.apache.syncope.core.persistence.validation.role}";
-
- Class<?>[] groups() default {};
-
- Class<? extends Payload>[] payload() default {};
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleValidator.java
deleted file mode 100644
index 2f46ca0..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleValidator.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.validation.entity;
-
-import javax.validation.ConstraintValidatorContext;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-
-public class RoleValidator extends AbstractValidator<RoleCheck, Role> {
-
- @Override
- public boolean isValid(final Role object, final ConstraintValidatorContext context) {
- context.disableDefaultConstraintViolation();
-
- boolean isValid = true;
-
- if (object.getUserOwner() != null && object.getRoleOwner() != null) {
- isValid = false;
-
- context.buildConstraintViolationWithTemplate(
- getTemplate(EntityViolationType.InvalidRoleOwner,
- "A role must either be owned by an user or a role, not both")).
- addPropertyNode("owner").addConstraintViolation();
- }
-
- return isValid;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
index 216c891..cf7e53d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
@@ -31,15 +31,15 @@ import org.apache.syncope.core.persistence.api.entity.conf.CPlainSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema;
import org.apache.syncope.core.persistence.api.entity.user.UVirSchema;
import org.apache.syncope.core.persistence.jpa.entity.conf.JPAConf;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Object> {
@@ -55,7 +55,7 @@ public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Obje
static {
initUnallowedSchemaNames(JPAUser.class, UNALLOWED_USCHEMA_NAMES);
initUnallowedSchemaNames(JPAMembership.class, UNALLOWED_MSCHEMA_NAMES);
- initUnallowedSchemaNames(JPARole.class, UNALLOWED_RSCHEMA_NAMES);
+ initUnallowedSchemaNames(JPAGroup.class, UNALLOWED_RSCHEMA_NAMES);
initUnallowedSchemaNames(JPAConf.class, UNALLOWED_CSCHEMA_NAMES);
}
@@ -96,14 +96,14 @@ public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Obje
} else if (object instanceof MVirSchema) {
schemaName = ((MVirSchema) object).getKey();
unallowedNames = UNALLOWED_MSCHEMA_NAMES;
- } else if (object instanceof RPlainSchema) {
- schemaName = ((RPlainSchema) object).getKey();
+ } else if (object instanceof GPlainSchema) {
+ schemaName = ((GPlainSchema) object).getKey();
unallowedNames = UNALLOWED_RSCHEMA_NAMES;
- } else if (object instanceof RDerSchema) {
- schemaName = ((RDerSchema) object).getKey();
+ } else if (object instanceof GDerSchema) {
+ schemaName = ((GDerSchema) object).getKey();
unallowedNames = UNALLOWED_RSCHEMA_NAMES;
- } else if (object instanceof RVirSchema) {
- schemaName = ((RVirSchema) object).getKey();
+ } else if (object instanceof GVirSchema) {
+ schemaName = ((GVirSchema) object).getKey();
unallowedNames = UNALLOWED_RSCHEMA_NAMES;
} else if (object instanceof CPlainSchema) {
schemaName = ((CPlainSchema) object).getKey();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java
index 2790a12..0b5ac42 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java
@@ -30,7 +30,7 @@ import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Policy;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+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.misc.policy.AccountPolicyEnforcer;
import org.apache.syncope.core.misc.policy.AccountPolicyException;
@@ -153,9 +153,9 @@ public class UserValidator extends AbstractValidator<UserCheck, User> {
}
}
- // add role policies
- for (Role role : user.getRoles()) {
- policy = role.getPasswordPolicy();
+ // add group policies
+ for (Group group : user.getGroups()) {
+ policy = group.getPasswordPolicy();
if (policy != null) {
policies.add(policy);
}
@@ -181,9 +181,9 @@ public class UserValidator extends AbstractValidator<UserCheck, User> {
}
}
- // add role policies
- for (Role role : user.getRoles()) {
- policy = role.getAccountPolicy();
+ // add group policies
+ for (Group group : user.getGroups()) {
+ policy = group.getAccountPolicy();
if (policy != null) {
policies.add(policy);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
index a4b949d..f10b6c5 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
@@ -35,7 +35,7 @@ under the License.
</persistence-unit-metadata>
<table-generator name="SEQ_UPlainAttrValue" pk-column-value="SEQ_UPlainAttrValue" initial-value="100"/>
- <table-generator name="SEQ_RPlainAttrValue" pk-column-value="SEQ_RPlainAttrValue" initial-value="100"/>
+ <table-generator name="SEQ_GPlainAttrValue" pk-column-value="SEQ_GPlainAttrValue" initial-value="100"/>
<table-generator name="SEQ_MAttrPlainValue" pk-column-value="SEQ_MAttrPlainValue" initial-value="100"/>
<table-generator name="SEQ_CAttrPlainValue" pk-column-value="SEQ_CAttrPlainValue" initial-value="100"/>
@@ -48,11 +48,11 @@ under the License.
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARole">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup">
<attributes>
<id name="id">
- <generated-value generator="SEQ_Role" strategy="TABLE"/>
- <table-generator name="SEQ_Role" pk-column-value="SEQ_Role" initial-value="100"/>
+ <generated-value generator="SEQ_Group" strategy="TABLE"/>
+ <table-generator name="SEQ_Group" pk-column-value="SEQ_Group" initial-value="100"/>
</id>
</attributes>
</entity>
@@ -74,11 +74,11 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMapping">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RMapping" strategy="TABLE"/>
- <table-generator name="SEQ_RMapping" pk-column-value="SEQ_RMapping" initial-value="100"/>
+ <generated-value generator="SEQ_GMapping" strategy="TABLE"/>
+ <table-generator name="SEQ_GMapping" pk-column-value="SEQ_GMapping" initial-value="100"/>
</id>
</attributes>
</entity>
@@ -90,11 +90,11 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RMappingItem" strategy="TABLE"/>
- <table-generator name="SEQ_RMappingItem" pk-column-value="SEQ_RMappingItem" initial-value="1000"/>
+ <generated-value generator="SEQ_GMappingItem" strategy="TABLE"/>
+ <table-generator name="SEQ_GMappingItem" pk-column-value="SEQ_GMappingItem" initial-value="1000"/>
</id>
</attributes>
</entity>
@@ -116,19 +116,19 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttr" strategy="TABLE"/>
- <table-generator name="SEQ_RPlainAttr" pk-column-value="SEQ_RPlainAttr" initial-value="1000"/>
+ <generated-value generator="SEQ_GPlainAttr" strategy="TABLE"/>
+ <table-generator name="SEQ_GPlainAttr" pk-column-value="SEQ_GPlainAttr" initial-value="1000"/>
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttrTemplate" strategy="TABLE"/>
- <table-generator name="SEQ_RPlainAttrTemplate" pk-column-value="SEQ_RPlainAttrTemplate" initial-value="1000"/>
+ <generated-value generator="SEQ_GPlainAttrTemplate" strategy="TABLE"/>
+ <table-generator name="SEQ_GPlainAttrTemplate" pk-column-value="SEQ_GPlainAttrTemplate" initial-value="1000"/>
</id>
</attributes>
</entity>
@@ -181,14 +181,14 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/>
+ <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue">
<table>
<unique-constraint>
<column-name>booleanValue</column-name>
@@ -201,7 +201,7 @@ under the License.
</table>
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/>
+ <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
</id>
</attributes>
</entity>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
index a4b949d..f10b6c5 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
@@ -35,7 +35,7 @@ under the License.
</persistence-unit-metadata>
<table-generator name="SEQ_UPlainAttrValue" pk-column-value="SEQ_UPlainAttrValue" initial-value="100"/>
- <table-generator name="SEQ_RPlainAttrValue" pk-column-value="SEQ_RPlainAttrValue" initial-value="100"/>
+ <table-generator name="SEQ_GPlainAttrValue" pk-column-value="SEQ_GPlainAttrValue" initial-value="100"/>
<table-generator name="SEQ_MAttrPlainValue" pk-column-value="SEQ_MAttrPlainValue" initial-value="100"/>
<table-generator name="SEQ_CAttrPlainValue" pk-column-value="SEQ_CAttrPlainValue" initial-value="100"/>
@@ -48,11 +48,11 @@ under the License.
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARole">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup">
<attributes>
<id name="id">
- <generated-value generator="SEQ_Role" strategy="TABLE"/>
- <table-generator name="SEQ_Role" pk-column-value="SEQ_Role" initial-value="100"/>
+ <generated-value generator="SEQ_Group" strategy="TABLE"/>
+ <table-generator name="SEQ_Group" pk-column-value="SEQ_Group" initial-value="100"/>
</id>
</attributes>
</entity>
@@ -74,11 +74,11 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMapping">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RMapping" strategy="TABLE"/>
- <table-generator name="SEQ_RMapping" pk-column-value="SEQ_RMapping" initial-value="100"/>
+ <generated-value generator="SEQ_GMapping" strategy="TABLE"/>
+ <table-generator name="SEQ_GMapping" pk-column-value="SEQ_GMapping" initial-value="100"/>
</id>
</attributes>
</entity>
@@ -90,11 +90,11 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RMappingItem" strategy="TABLE"/>
- <table-generator name="SEQ_RMappingItem" pk-column-value="SEQ_RMappingItem" initial-value="1000"/>
+ <generated-value generator="SEQ_GMappingItem" strategy="TABLE"/>
+ <table-generator name="SEQ_GMappingItem" pk-column-value="SEQ_GMappingItem" initial-value="1000"/>
</id>
</attributes>
</entity>
@@ -116,19 +116,19 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttr" strategy="TABLE"/>
- <table-generator name="SEQ_RPlainAttr" pk-column-value="SEQ_RPlainAttr" initial-value="1000"/>
+ <generated-value generator="SEQ_GPlainAttr" strategy="TABLE"/>
+ <table-generator name="SEQ_GPlainAttr" pk-column-value="SEQ_GPlainAttr" initial-value="1000"/>
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttrTemplate" strategy="TABLE"/>
- <table-generator name="SEQ_RPlainAttrTemplate" pk-column-value="SEQ_RPlainAttrTemplate" initial-value="1000"/>
+ <generated-value generator="SEQ_GPlainAttrTemplate" strategy="TABLE"/>
+ <table-generator name="SEQ_GPlainAttrTemplate" pk-column-value="SEQ_GPlainAttrTemplate" initial-value="1000"/>
</id>
</attributes>
</entity>
@@ -181,14 +181,14 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/>
+ <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue">
<table>
<unique-constraint>
<column-name>booleanValue</column-name>
@@ -201,7 +201,7 @@ under the License.
</table>
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/>
+ <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
</id>
</attributes>
</entity>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
index 7217d68..d0959c8 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
@@ -35,7 +35,7 @@ under the License.
</persistence-unit-metadata>
<table-generator name="SEQ_UPlainAttrValue" pk-column-value="SEQ_UPlainAttrValue" initial-value="100"/>
- <table-generator name="SEQ_RPlainAttrValue" pk-column-value="SEQ_RPlainAttrValue" initial-value="100"/>
+ <table-generator name="SEQ_GPlainAttrValue" pk-column-value="SEQ_GPlainAttrValue" initial-value="100"/>
<table-generator name="SEQ_MAttrPlainValue" pk-column-value="SEQ_MAttrPlainValue" initial-value="100"/>
<table-generator name="SEQ_CAttrPlainValue" pk-column-value="SEQ_CAttrPlainValue" initial-value="100"/>
@@ -48,11 +48,11 @@ under the License.
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARole">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup">
<attributes>
<id name="id">
- <generated-value generator="SEQ_Role" strategy="TABLE"/>
- <table-generator name="SEQ_Role" pk-column-value="SEQ_Role" initial-value="100"/>
+ <generated-value generator="SEQ_Group" strategy="TABLE"/>
+ <table-generator name="SEQ_Group" pk-column-value="SEQ_Group" initial-value="100"/>
</id>
</attributes>
</entity>
@@ -74,11 +74,11 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMapping">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RMapping" strategy="TABLE"/>
- <table-generator name="SEQ_RMapping" pk-column-value="SEQ_RMapping" initial-value="100"/>
+ <generated-value generator="SEQ_GMapping" strategy="TABLE"/>
+ <table-generator name="SEQ_GMapping" pk-column-value="SEQ_GMapping" initial-value="100"/>
</id>
</attributes>
</entity>
@@ -90,11 +90,11 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RMappingItem" strategy="TABLE"/>
- <table-generator name="SEQ_RMappingItem" pk-column-value="SEQ_RMappingItem" initial-value="1000"/>
+ <generated-value generator="SEQ_GMappingItem" strategy="TABLE"/>
+ <table-generator name="SEQ_GMappingItem" pk-column-value="SEQ_GMappingItem" initial-value="1000"/>
</id>
</attributes>
</entity>
@@ -116,19 +116,19 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttr" strategy="TABLE"/>
- <table-generator name="SEQ_RPlainAttr" pk-column-value="SEQ_RPlainAttr" initial-value="1000"/>
+ <generated-value generator="SEQ_GPlainAttr" strategy="TABLE"/>
+ <table-generator name="SEQ_GPlainAttr" pk-column-value="SEQ_GPlainAttr" initial-value="1000"/>
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttrTemplate" strategy="TABLE"/>
- <table-generator name="SEQ_RPlainAttrTemplate" pk-column-value="SEQ_RPlainAttrTemplate" initial-value="1000"/>
+ <generated-value generator="SEQ_GPlainAttrTemplate" strategy="TABLE"/>
+ <table-generator name="SEQ_GPlainAttrTemplate" pk-column-value="SEQ_GPlainAttrTemplate" initial-value="1000"/>
</id>
</attributes>
</entity>
@@ -193,14 +193,14 @@ under the License.
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue">
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/>
+ <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
</id>
</attributes>
</entity>
- <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue">
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue">
<table>
<unique-constraint>
<column-name>booleanValue</column-name>
@@ -225,7 +225,7 @@ under the License.
</table>
<attributes>
<id name="id">
- <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/>
+ <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
</id>
</attributes>
</entity>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/content.xml b/core/persistence-jpa/src/main/resources/content.xml
index b0257b1..7630245 100644
--- a/core/persistence-jpa/src/main/resources/content.xml
+++ b/core/persistence-jpa/src/main/resources/content.xml
@@ -83,9 +83,9 @@ under the License.
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
<CPlainSchema name="self.user.layout" type="String"
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
- <CPlainSchema name="admin.role.layout" type="String"
+ <CPlainSchema name="admin.group.layout" type="String"
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
- <CPlainSchema name="self.role.layout" type="String"
+ <CPlainSchema name="self.group.layout" type="String"
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
<CPlainSchema name="admin.membership.layout" type="String"
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
@@ -120,11 +120,11 @@ under the License.
<Entitlement name="USER_UPDATE"/>
<Entitlement name="USER_DELETE"/>
<Entitlement name="USER_VIEW"/>
- <Entitlement name="ROLE_LIST"/>
- <Entitlement name="ROLE_CREATE"/>
- <Entitlement name="ROLE_READ"/>
- <Entitlement name="ROLE_UPDATE"/>
- <Entitlement name="ROLE_DELETE"/>
+ <Entitlement name="GROUP_LIST"/>
+ <Entitlement name="GROUP_CREATE"/>
+ <Entitlement name="GROUP_READ"/>
+ <Entitlement name="GROUP_UPDATE"/>
+ <Entitlement name="GROUP_DELETE"/>
<Entitlement name="RESOURCE_LIST"/>
<Entitlement name="RESOURCE_CREATE"/>
<Entitlement name="RESOURCE_READ"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/indexes.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/indexes.xml b/core/persistence-jpa/src/main/resources/indexes.xml
index effcb7b..abd3a76 100644
--- a/core/persistence-jpa/src/main/resources/indexes.xml
+++ b/core/persistence-jpa/src/main/resources/indexes.xml
@@ -31,10 +31,10 @@ under the License.
<entry key="MPlainAttrValue_longvalueIndex">CREATE INDEX MAttrValue_longvalueIndex ON MPlainAttrValue(longvalue)</entry>
<entry key="MPlainAttrValue_doublevalueIndex">CREATE INDEX MAttrValue_doublevalueIndex ON MPlainAttrValue(doublevalue)</entry>
<entry key="MPlainAttrValue_booleanvalueIndex">CREATE INDEX MAttrValue_booleanvalueIndex ON MPlainAttrValue(booleanvalue)</entry>
- <entry key="RPlainAttrValue_stringvalueIndex">CREATE INDEX RAttrValue_stringvalueIndex ON RPlainAttrValue(stringvalue)</entry>
- <entry key="RPlainAttrValue_datevalueIndex">CREATE INDEX RAttrValue_datevalueIndex ON RPlainAttrValue(datevalue)</entry>
- <entry key="RPlainAttrValue_longvalueIndex">CREATE INDEX RAttrValue_longvalueIndex ON RPlainAttrValue(longvalue)</entry>
- <entry key="RPlainAttrValue_doublevalueIndex">CREATE INDEX RAttrValue_doublevalueIndex ON RPlainAttrValue(doublevalue)</entry>
- <entry key="RPlainAttrValue_booleanvalueIndex">CREATE INDEX RAttrValue_booleanvalueIndex ON RPlainAttrValue(booleanvalue)</entry>
+ <entry key="GPlainAttrValue_stringvalueIndex">CREATE INDEX GAttrValue_stringvalueIndex ON GPlainAttrValue(stringvalue)</entry>
+ <entry key="GPlainAttrValue_datevalueIndex">CREATE INDEX GAttrValue_datevalueIndex ON GPlainAttrValue(datevalue)</entry>
+ <entry key="GPlainAttrValue_longvalueIndex">CREATE INDEX GAttrValue_longvalueIndex ON GPlainAttrValue(longvalue)</entry>
+ <entry key="GPlainAttrValue_doublevalueIndex">CREATE INDEX GAttrValue_doublevalueIndex ON GPlainAttrValue(doublevalue)</entry>
+ <entry key="GPlainAttrValue_booleanvalueIndex">CREATE INDEX GAttrValue_booleanvalueIndex ON GPlainAttrValue(booleanvalue)</entry>
<entry key="Task_executedIndex">CREATE INDEX Task_executedIndex ON Task(executed)</entry>
</properties>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/views.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/views.xml b/core/persistence-jpa/src/main/resources/views.xml
index 2e029c8..aa0ec48 100644
--- a/core/persistence-jpa/src/main/resources/views.xml
+++ b/core/persistence-jpa/src/main/resources/views.xml
@@ -68,9 +68,9 @@ under the License.
<entry key="user_search_membership">
CREATE VIEW user_search_membership AS
- SELECT m.user_id AS subject_id, r.id AS role_id, r.name AS role_name
- FROM Membership m, SyncopeRole r
- WHERE m.role_id = r.id
+ SELECT m.user_id AS subject_id, r.id AS group_id, r.name AS group_name
+ FROM Membership m, SyncopeGroup r
+ WHERE m.group_id = r.id
</entry>
<entry key="user_search_resource">
CREATE VIEW user_search_resource AS
@@ -78,20 +78,20 @@ under the License.
SELECT st.user_id AS subject_id, st.resource_name AS resource_name
FROM SyncopeUser_ExternalResource st
</entry>
- <entry key="user_search_role_resource">
- CREATE VIEW user_search_role_resource AS
+ <entry key="user_search_group_resource">
+ CREATE VIEW user_search_group_resource AS
SELECT m.user_id AS subject_id, st.resource_name AS resource_name
- FROM Membership m, SyncopeRole r, SyncopeRole_ExternalResource st
- WHERE m.role_id = r.id AND st.role_id = r.id
+ FROM Membership m, SyncopeGroup r, SyncopeGroup_ExternalResource st
+ WHERE m.group_id = r.id AND st.group_id = r.id
</entry>
- <entry key="role_search">
- CREATE VIEW role_search AS
+ <entry key="group_search">
+ CREATE VIEW group_search AS
- SELECT r.id as subject_id, r.* FROM SyncopeRole r
+ SELECT r.id as subject_id, r.* FROM SyncopeGroup r
</entry>
- <entry key="role_search_unique_attr">
- CREATE VIEW role_search_unique_attr AS
+ <entry key="group_search_unique_attr">
+ CREATE VIEW group_search_unique_attr AS
SELECT ra.owner_id AS subject_id,
rat.schema_name AS schema_name,
@@ -100,12 +100,12 @@ under the License.
rav.doublevalue AS doublevalue,
rav.longvalue AS longvalue,
rav.stringvalue AS stringvalue
- FROM RPlainAttrUniqueValue rav, RPlainAttr ra, RPlainAttrTemplate rat
+ FROM GPlainAttrUniqueValue rav, GPlainAttr ra, GPlainAttrTemplate rat
WHERE rav.attribute_id = ra.id
AND ra.template_id = rat.id
</entry>
- <entry key="role_search_attr">
- CREATE VIEW role_search_attr AS
+ <entry key="group_search_attr">
+ CREATE VIEW group_search_attr AS
SELECT ra.owner_id AS subject_id,
rat.schema_name AS schema_name,
@@ -114,36 +114,36 @@ under the License.
rav.doublevalue AS doublevalue,
rav.longvalue AS longvalue,
rav.stringvalue AS stringvalue
- FROM RPlainAttrValue rav, RPlainAttr ra, RPlainAttrTemplate rat
+ FROM GPlainAttrValue rav, GPlainAttr ra, GPlainAttrTemplate rat
WHERE rav.attribute_id = ra.id
AND ra.template_id = rat.id
</entry>
- <entry key="role_search_null_attr">
- CREATE VIEW role_search_null_attr AS
+ <entry key="group_search_null_attr">
+ CREATE VIEW group_search_null_attr AS
SELECT r.id AS subject_id,
- RPlainSchema.name AS schema_name,
+ GPlainSchema.name AS schema_name,
NULL AS booleanvalue,
NULL AS datevalue,
NULL AS doublevalue,
NULL AS longvalue,
NULL AS stringvalue
- FROM SyncopeRole r CROSS JOIN RPlainSchema
- LEFT OUTER JOIN RPlainAttr ra ON (ra.owner_id = r.id)
- LEFT OUTER JOIN RPlainAttrTemplate rat ON (RPlainSchema.name = rat.schema_name AND ra.template_id = rat.id)
+ FROM SyncopeGroup r CROSS JOIN GPlainSchema
+ LEFT OUTER JOIN GPlainAttr ra ON (ra.owner_id = r.id)
+ LEFT OUTER JOIN GPlainAttrTemplate rat ON (GPlainSchema.name = rat.schema_name AND ra.template_id = rat.id)
WHERE ra.id IS NULL
</entry>
- <entry key="role_search_resource">
- CREATE VIEW role_search_resource AS
+ <entry key="group_search_resource">
+ CREATE VIEW group_search_resource AS
- SELECT st.role_id AS subject_id, st.resource_name AS resource_name
- FROM SyncopeRole_ExternalResource st
+ SELECT st.group_id AS subject_id, st.resource_name AS resource_name
+ FROM SyncopeGroup_ExternalResource st
</entry>
- <entry key="role_search_entitlements">
- CREATE VIEW role_search_entitlements AS
+ <entry key="group_search_entitlements">
+ CREATE VIEW group_search_entitlements AS
- SELECT st.role_id AS subject_id, st.entitlement_name AS entitlement_name
- FROM SyncopeRole_Entitlement st
+ SELECT st.group_id AS subject_id, st.entitlement_name AS entitlement_name
+ FROM SyncopeGroup_Entitlement st
</entry>
</properties>
[54/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
[SYNCOPE-119] New security model implemented
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/65d652af
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/65d652af
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/65d652af
Branch: refs/heads/master
Commit: 65d652af618a54292bb8dcf5cf93147bb6b83c52
Parents: 18958ba
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Apr 20 16:29:53 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Apr 20 16:29:53 2015 +0200
----------------------------------------------------------------------
.../apache/syncope/client/cli/SyncopeAdm.java | 8 -
.../client/cli/commands/EntitlementCommand.java | 70 --
.../client/cli/commands/PolicyCommand.java | 2 +-
.../client/console/commons/JexlHelpUtil.java | 61 --
.../client/console/commons/JexlHelpUtils.java | 61 ++
.../console/commons/PreferenceManager.java | 9 +-
.../client/console/commons/PreviewUtil.java | 62 --
.../client/console/commons/PreviewUtils.java | 62 ++
.../console/pages/DerSchemaModalPage.java | 6 +-
.../console/pages/PlainSchemaModalPage.java | 6 +-
.../client/console/pages/PolicyModalPage.java | 2 +-
.../syncope/client/console/pages/Reports.java | 6 +-
.../syncope/client/console/pages/Schema.java | 31 +-
.../client/console/panels/DerAttrsPanel.java | 2 +-
.../console/panels/GroupDetailsPanel.java | 6 +-
.../console/panels/LoggerCategoryPanel.java | 21 +-
.../client/console/panels/MembershipsPanel.java | 12 +-
.../client/console/panels/PlainAttrsPanel.java | 8 +-
.../console/panels/ResourceMappingPanel.java | 6 +-
.../client/console/panels/ResourcesPanel.java | 2 +-
.../client/console/panels/UserDetailsPanel.java | 10 +-
.../client/console/panels/VirAttrsPanel.java | 2 +-
.../client/console/rest/PolicyRestClient.java | 16 +-
.../markup/html/form/BinaryFieldPanel.java | 4 +-
.../syncope/client/lib/SyncopeClient.java | 42 +-
.../client/lib/SyncopeClientFactoryBean.java | 13 +-
client/pom.xml | 3 +-
.../common/lib/AttributableOperations.java | 88 +-
.../syncope/common/lib/CollectionUtils2.java | 25 +
.../syncope/common/lib/SyncopeConstants.java | 8 +-
.../common/lib/mod/AbstractSubjectMod.java | 10 +
.../apache/syncope/common/lib/mod/GroupMod.java | 89 +-
.../apache/syncope/common/lib/mod/UserMod.java | 31 +-
.../report/AbstractSubjectReportletConf.java | 14 +-
.../common/lib/report/GroupReportletConf.java | 1 -
.../search/GroupFiqlSearchConditionBuilder.java | 23 -
.../common/lib/search/GroupProperty.java | 6 -
.../syncope/common/lib/search/SpecialAttr.java | 28 +-
.../common/lib/to/AbstractAttributableTO.java | 45 +-
.../syncope/common/lib/to/AbstractPolicyTO.java | 20 +-
.../common/lib/to/AbstractSubjectTO.java | 10 +
.../syncope/common/lib/to/AccountPolicyTO.java | 15 +-
.../syncope/common/lib/to/BulkActionResult.java | 7 +-
.../syncope/common/lib/to/ConnObjectTO.java | 15 +-
.../apache/syncope/common/lib/to/GroupTO.java | 136 ---
.../apache/syncope/common/lib/to/MappingTO.java | 26 +-
.../syncope/common/lib/to/MembershipTO.java | 10 +-
.../syncope/common/lib/to/PasswordPolicyTO.java | 16 +-
.../apache/syncope/common/lib/to/RoleTO.java | 10 -
.../syncope/common/lib/to/SyncPolicyTO.java | 14 +-
.../syncope/common/lib/to/SyncTaskTO.java | 10 +
.../apache/syncope/common/lib/to/SyncopeTO.java | 9 +
.../apache/syncope/common/lib/to/UserTO.java | 11 +-
.../syncope/common/lib/to/WorkflowFormTO.java | 5 +-
.../common/lib/types/AccountPolicySpec.java | 12 +-
.../common/lib/types/AuditLoggerName.java | 9 +-
.../common/lib/types/ClientExceptionType.java | 5 +-
.../syncope/common/lib/types/Entitlement.java | 9 +-
.../syncope/common/lib/types/PolicyType.java | 38 +-
.../syncope/common/lib/wrap/EntitlementTO.java | 30 -
.../syncope/common/rest/api/RESTHeaders.java | 2 +
.../rest/api/service/EntitlementService.java | 53 --
.../common/rest/api/service/GroupService.java | 69 +-
.../common/rest/api/service/PolicyService.java | 12 -
.../rest/api/service/UserSelfService.java | 5 +-
.../common/rest/api/service/UserService.java | 44 +-
.../core/logic/AbstractSubjectLogic.java | 35 +-
.../syncope/core/logic/ConnectorLogic.java | 38 +-
.../syncope/core/logic/EntitlementLogic.java | 60 --
.../apache/syncope/core/logic/GroupLogic.java | 211 ++---
.../apache/syncope/core/logic/LoggerLogic.java | 33 +-
.../apache/syncope/core/logic/PolicyLogic.java | 34 +-
.../syncope/core/logic/ResourceLogic.java | 44 +-
.../apache/syncope/core/logic/SchemaLogic.java | 81 +-
.../core/logic/SecurityQuestionLogic.java | 2 +-
.../apache/syncope/core/logic/SyncopeLogic.java | 5 +
.../apache/syncope/core/logic/TaskLogic.java | 97 +-
.../apache/syncope/core/logic/UserLogic.java | 147 +---
.../syncope/core/logic/UserWorkflowLogic.java | 16 +-
.../logic/notification/NotificationJob.java | 4 +-
.../core/logic/report/GroupReportlet.java | 40 +-
.../syncope/core/logic/report/ReportJob.java | 6 +-
.../core/logic/report/UserReportlet.java | 31 +-
.../resources/report/groupReportlet2csv.xsl | 12 -
.../main/resources/report/groupReportlet2fo.xsl | 43 -
.../resources/report/groupReportlet2html.xsl | 36 -
.../syncope/core/logic/NotificationTest.java | 50 +-
.../syncope/core/misc/ConnObjectUtil.java | 763 ----------------
.../syncope/core/misc/ConnObjectUtils.java | 746 ++++++++++++++++
.../apache/syncope/core/misc/ExceptionUtil.java | 47 -
.../syncope/core/misc/ExceptionUtils2.java | 47 +
.../apache/syncope/core/misc/MappingUtil.java | 738 ----------------
.../apache/syncope/core/misc/MappingUtils.java | 735 ++++++++++++++++
.../apache/syncope/core/misc/RealmUtils.java | 61 ++
.../apache/syncope/core/misc/jexl/JexlUtil.java | 285 ------
.../syncope/core/misc/jexl/JexlUtils.java | 285 ++++++
.../core/misc/policy/AccountPolicyEnforcer.java | 4 +-
.../core/misc/policy/PolicyEvaluator.java | 7 +-
.../core/misc/search/SearchCondVisitor.java | 7 -
.../core/misc/security/AuthContextUtil.java | 74 --
.../core/misc/security/AuthContextUtils.java | 73 ++
.../core/misc/security/PasswordGenerator.java | 56 +-
.../core/misc/security/SecureRandomUtil.java | 48 -
.../core/misc/security/SecureRandomUtils.java | 48 +
.../security/SyncopeAuthenticationProvider.java | 47 +-
.../misc/security/SyncopeGrantedAuthority.java | 76 ++
.../security/SyncopeUserDetailsService.java | 85 +-
.../misc/security/UnauthorizedException.java | 30 +
.../security/UnauthorizedGroupException.java | 42 -
.../misc/search/SearchCondConverterTest.java | 14 -
.../persistence/api/GroupEntitlementUtil.java | 92 --
.../core/persistence/api/dao/DerSchemaDAO.java | 4 +-
.../persistence/api/dao/EntitlementDAO.java | 38 -
.../core/persistence/api/dao/GroupDAO.java | 32 +-
.../persistence/api/dao/PlainSchemaDAO.java | 4 +-
.../core/persistence/api/dao/PolicyDAO.java | 8 -
.../core/persistence/api/dao/RealmDAO.java | 5 +
.../core/persistence/api/dao/SubjectDAO.java | 10 +-
.../persistence/api/dao/SubjectSearchDAO.java | 16 +-
.../core/persistence/api/dao/UserDAO.java | 6 +-
.../core/persistence/api/dao/VirSchemaDAO.java | 4 +-
.../api/entity/AttributableUtil.java | 91 --
.../api/entity/AttributableUtilFactory.java | 33 -
.../api/entity/AttributableUtils.java | 91 ++
.../api/entity/AttributableUtilsFactory.java | 33 +
.../persistence/api/entity/Entitlement.java | 29 -
.../persistence/api/entity/EntityFactory.java | 2 -
.../core/persistence/api/entity/PlainAttr.java | 2 +-
.../core/persistence/api/entity/Role.java | 4 -
.../core/persistence/api/entity/Subject.java | 4 +
.../persistence/api/entity/group/Group.java | 105 +--
.../persistence/api/entity/task/SyncTask.java | 5 +
.../persistence/api/entity/task/TaskUtil.java | 36 -
.../api/entity/task/TaskUtilFactory.java | 33 -
.../persistence/api/entity/task/TaskUtils.java | 36 +
.../api/entity/task/TaskUtilsFactory.java | 33 +
.../core/persistence/api/entity/user/User.java | 7 +
core/persistence-jpa/pom.xml | 5 +
.../jpa/content/ContentLoaderHandler.java | 4 +-
.../persistence/jpa/dao/AbstractSubjectDAO.java | 53 +-
.../core/persistence/jpa/dao/JPAConfDAO.java | 6 +-
.../persistence/jpa/dao/JPADerSchemaDAO.java | 4 +-
.../persistence/jpa/dao/JPAEntitlementDAO.java | 88 --
.../jpa/dao/JPAExternalResourceDAO.java | 6 -
.../core/persistence/jpa/dao/JPAGroupDAO.java | 293 ++-----
.../persistence/jpa/dao/JPAPlainSchemaDAO.java | 4 +-
.../core/persistence/jpa/dao/JPAPolicyDAO.java | 84 +-
.../core/persistence/jpa/dao/JPARealmDAO.java | 63 +-
.../core/persistence/jpa/dao/JPARoleDAO.java | 5 +
.../jpa/dao/JPASubjectSearchDAO.java | 118 +--
.../core/persistence/jpa/dao/JPAUserDAO.java | 69 +-
.../persistence/jpa/dao/JPAVirSchemaDAO.java | 4 +-
.../jpa/entity/AbstractAttributable.java | 37 -
.../persistence/jpa/entity/AbstractDerAttr.java | 4 +-
.../jpa/entity/AbstractPlainAttr.java | 4 +-
.../persistence/jpa/entity/AbstractSubject.java | 19 +
.../jpa/entity/AnnotatedEntityListener.java | 4 +-
.../jpa/entity/JPAAccountPolicy.java | 12 +-
.../jpa/entity/JPAAttributableUtil.java | 879 -------------------
.../jpa/entity/JPAAttributableUtils.java | 879 +++++++++++++++++++
.../persistence/jpa/entity/JPAEntitlement.java | 62 --
.../jpa/entity/JPAEntityFactory.java | 32 +-
.../jpa/entity/JPAExternalResource.java | 6 +-
.../jpa/entity/JPAPasswordPolicy.java | 9 +-
.../persistence/jpa/entity/JPAPushPolicy.java | 5 +-
.../core/persistence/jpa/entity/JPARealm.java | 11 +-
.../core/persistence/jpa/entity/JPARole.java | 12 -
.../persistence/jpa/entity/JPASyncPolicy.java | 9 +-
.../jpa/entity/JPAttributableUtilFactory.java | 81 --
.../jpa/entity/JPAttributableUtilsFactory.java | 81 ++
.../persistence/jpa/entity/group/JPAGroup.java | 336 +------
.../jpa/entity/membership/JPAMembership.java | 30 +-
.../jpa/entity/task/JPASyncTask.java | 17 +
.../jpa/entity/task/JPATaskUtil.java | 152 ----
.../jpa/entity/task/JPATaskUtilFactory.java | 91 --
.../jpa/entity/task/JPATaskUtils.java | 152 ++++
.../jpa/entity/task/JPATaskUtilsFactory.java | 91 ++
.../persistence/jpa/entity/user/JPAUser.java | 39 +-
.../entity/ConnInstanceValidator.java | 8 +-
.../jpa/validation/entity/RealmValidator.java | 3 +-
.../jpa/validation/entity/UserValidator.java | 47 +-
.../src/main/resources/content.xml | 83 +-
.../src/main/resources/views.xml | 6 -
.../core/persistence/jpa/AbstractTest.java | 4 +-
.../core/persistence/jpa/entity/AttrTest.java | 14 +-
.../jpa/entity/AttributableSearchTest.java | 138 ++-
.../core/persistence/jpa/entity/ConfTest.java | 4 +-
.../persistence/jpa/entity/DerSchemaTest.java | 4 +-
.../persistence/jpa/entity/EntitlementTest.java | 72 --
.../core/persistence/jpa/entity/GroupTest.java | 77 +-
.../persistence/jpa/entity/PlainSchemaTest.java | 2 +-
.../core/persistence/jpa/entity/PolicyTest.java | 20 +-
.../core/persistence/jpa/entity/RealmTest.java | 11 +-
.../core/persistence/jpa/entity/RoleTest.java | 16 -
.../core/persistence/jpa/entity/UserTest.java | 45 +-
.../persistence/jpa/entity/VirSchemaTest.java | 4 +-
.../persistence/jpa/relationship/AttrTest.java | 2 +-
.../relationship/AttributableSearchTest.java | 10 +-
.../jpa/relationship/DerSchemaTest.java | 2 +-
.../jpa/relationship/EntitlementTest.java | 57 --
.../persistence/jpa/relationship/GroupTest.java | 43 +-
.../jpa/relationship/PlainSchemaTest.java | 6 +-
.../src/test/resources/content.xml | 281 ++----
.../src/test/resources/simplelogger.properties | 4 +
.../provisioning/api/ConnIdBundleManager.java | 6 +-
.../core/provisioning/api/ConnPoolConfUtil.java | 69 --
.../provisioning/api/ConnPoolConfUtils.java | 69 ++
.../api/GroupProvisioningManager.java | 7 +-
.../provisioning/api/ProvisioningManager.java | 6 +-
.../syncope/core/provisioning/api/URIUtil.java | 61 --
.../syncope/core/provisioning/api/URIUtils.java | 61 ++
.../api/UserProvisioningManager.java | 16 +-
.../provisioning/api/data/SchemaDataBinder.java | 6 +-
.../provisioning/api/data/TaskDataBinder.java | 8 +-
.../api/propagation/PropagationManager.java | 154 ++--
.../java/ConnIdBundleManagerImpl.java | 18 +-
.../provisioning/java/ConnectorFacadeProxy.java | 7 +-
.../java/DefaultGroupProvisioningManager.java | 61 +-
.../java/DefaultUserProvisioningManager.java | 106 ++-
.../core/provisioning/java/VirAttrHandler.java | 46 +-
.../java/cache/DisabledVirAttrCache.java | 4 +
.../java/cache/MemoryVirAttrCache.java | 22 +-
.../data/AbstractAttributableDataBinder.java | 156 ++--
.../java/data/ConfigurationDataBinderImpl.java | 4 +-
.../java/data/ConnInstanceDataBinderImpl.java | 37 +-
.../java/data/GroupDataBinderImpl.java | 211 +----
.../java/data/PolicyDataBinderImpl.java | 44 +-
.../java/data/ResourceDataBinderImpl.java | 67 +-
.../java/data/RoleDataBinderImpl.java | 21 +-
.../java/data/SchemaDataBinderImpl.java | 12 +-
.../java/data/TaskDataBinderImpl.java | 62 +-
.../java/data/UserDataBinderImpl.java | 137 ++-
.../provisioning/java/job/AbstractTaskJob.java | 4 +-
.../notification/NotificationManagerImpl.java | 32 +-
.../AbstractPropagationTaskExecutor.java | 20 +-
.../propagation/DefaultPropagationReporter.java | 10 +-
.../LDAPMembershipPropagationActions.java | 10 +-
.../propagation/PropagationManagerImpl.java | 331 ++-----
.../java/sync/AbstractProvisioningJob.java | 29 +-
.../java/sync/AbstractPushResultHandler.java | 26 +-
.../java/sync/AbstractSyncResultHandler.java | 118 ++-
.../java/sync/AbstractSyncopeResultHandler.java | 14 +-
.../java/sync/GroupPushResultHandlerImpl.java | 16 +-
.../java/sync/GroupSyncResultHandlerImpl.java | 22 +-
.../java/sync/LDAPMembershipSyncActions.java | 7 +-
.../provisioning/java/sync/PushJobImpl.java | 59 +-
.../provisioning/java/sync/SyncJobImpl.java | 17 +-
.../provisioning/java/sync/SyncUtilities.java | 419 ---------
.../core/provisioning/java/sync/SyncUtils.java | 403 +++++++++
.../java/sync/UserPushResultHandlerImpl.java | 16 +-
.../java/sync/UserSyncResultHandlerImpl.java | 24 +-
.../src/main/resources/provisioning.properties | 1 +
.../src/main/resources/provisioningContext.xml | 2 +-
.../rest/cxf/RestServiceExceptionMapper.java | 9 +-
.../rest/cxf/service/AbstractServiceImpl.java | 4 +-
.../rest/cxf/service/ConnectorServiceImpl.java | 35 +-
.../cxf/service/EntitlementServiceImpl.java | 44 -
.../core/rest/cxf/service/GroupServiceImpl.java | 92 +-
.../rest/cxf/service/PolicyServiceImpl.java | 34 +-
.../core/rest/cxf/service/RealmServiceImpl.java | 9 +-
.../rest/cxf/service/ResourceServiceImpl.java | 22 +-
.../core/rest/cxf/service/TaskServiceImpl.java | 43 +-
.../rest/cxf/service/UserSelfServiceImpl.java | 11 +-
.../core/rest/cxf/service/UserServiceImpl.java | 108 ++-
.../activiti/ActivitiUserWorkflowAdapter.java | 49 +-
.../activiti/SyncopeGroupQueryImpl.java | 26 +-
.../workflow/activiti/SyncopeUserManager.java | 6 +-
.../workflow/activiti/SyncopeUserQueryImpl.java | 26 +-
.../core/workflow/api/UserWorkflowAdapter.java | 10 +-
.../java/AbstractUserWorkflowAdapter.java | 6 +-
.../java/DefaultUserWorkflowAdapter.java | 21 +-
.../core/logic/init/CamelRouteLoader.java | 28 -
.../camel/CamelGroupProvisioningManager.java | 17 +-
.../camel/CamelUserProvisioningManager.java | 37 +-
.../processor/GroupCreateInSyncProcessor.java | 15 +-
.../camel/processor/GroupCreateProcessor.java | 10 +-
.../camel/processor/GroupDeleteProcessor.java | 19 +-
.../processor/GroupDeprovisionProcessor.java | 8 +-
.../camel/processor/GroupUpdateProcessor.java | 10 +-
.../processor/UserConfirmPwdResetProcessor.java | 2 +-
.../camel/processor/UserCreateProcessor.java | 20 +-
.../camel/processor/UserDeleteProcessor.java | 2 +-
.../processor/UserDeprovisionProcessor.java | 14 +-
.../processor/UserInnerSuspendProcessor.java | 12 +-
.../processor/UserSetStatusInSyncProcessor.java | 4 -
.../UserStatusPropagationProcessor.java | 14 +-
.../processor/UserUpdateInSyncProcessor.java | 14 +-
.../camel/processor/UserUpdateProcessor.java | 12 +-
.../src/main/resources/provisioning.properties | 1 +
.../fit/core/reference/TestSyncActions.java | 6 +-
.../main/resources/all/provisioning.properties | 1 +
.../src/main/resources/log4j2.xml | 3 +
.../src/main/resources/provisioning.properties | 1 +
.../fit/core/reference/AbstractITCase.java | 20 +-
.../core/reference/AuthenticationITCase.java | 266 +++---
.../fit/core/reference/CamelRouteITCase.java | 58 +-
.../fit/core/reference/ConfigurationITCase.java | 5 +-
.../fit/core/reference/ConnectorITCase.java | 2 +-
.../syncope/fit/core/reference/GroupITCase.java | 259 +-----
.../fit/core/reference/NotificationITCase.java | 2 +-
.../core/reference/NotificationTaskITCase.java | 2 +-
.../fit/core/reference/PlainSchemaITCase.java | 2 +-
.../fit/core/reference/PolicyITCase.java | 63 +-
.../fit/core/reference/PushTaskITCase.java | 2 +-
.../syncope/fit/core/reference/RealmITCase.java | 3 +-
.../syncope/fit/core/reference/RoleITCase.java | 6 +-
.../fit/core/reference/SearchITCase.java | 54 +-
.../fit/core/reference/SyncTaskITCase.java | 46 +-
.../syncope/fit/core/reference/UserITCase.java | 138 ++-
.../fit/core/reference/UserSelfITCase.java | 32 +-
.../fit/core/reference/UserWorkflowITCase.java | 10 +-
.../fit/core/reference/VirAttrITCase.java | 26 +-
installer/src/main/resources/izpack/install.xml | 2 +-
pom.xml | 4 +-
314 files changed, 7359 insertions(+), 9938 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java b/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java
index 2bb802f..9774a30 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java
@@ -21,7 +21,6 @@ package org.apache.syncope.client.cli;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.ParameterException;
import org.apache.syncope.client.cli.commands.ConfigurationCommand;
-import org.apache.syncope.client.cli.commands.EntitlementCommand;
import org.apache.syncope.client.cli.commands.LoggerCommand;
import org.apache.syncope.client.cli.commands.NotificationCommand;
import org.apache.syncope.client.cli.commands.PolicyCommand;
@@ -54,8 +53,6 @@ public class SyncopeAdm {
private static PolicyCommand policyCommand;
- private static EntitlementCommand entitlementCommand;
-
public static void main(final String[] args) {
LOG.debug("Starting with args \n");
@@ -96,9 +93,6 @@ public class SyncopeAdm {
policyCommand = new PolicyCommand();
jcommander.addCommand(policyCommand);
LOG.debug("Added PolicyCommand");
- entitlementCommand = new EntitlementCommand();
- jcommander.addCommand(entitlementCommand);
- LOG.debug("Added EntitlementCommand");
}
private static void executeCommand() {
@@ -116,8 +110,6 @@ public class SyncopeAdm {
reportCommand.execute();
} else if ("policy".equalsIgnoreCase(command)) {
policyCommand.execute();
- } else if ("entitlement".equalsIgnoreCase(command)) {
- entitlementCommand.execute();
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/cli/src/main/java/org/apache/syncope/client/cli/commands/EntitlementCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/EntitlementCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/EntitlementCommand.java
deleted file mode 100644
index e0058ab..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/EntitlementCommand.java
+++ /dev/null
@@ -1,70 +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.cli.commands;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.wrap.EntitlementTO;
-import org.apache.syncope.common.rest.api.service.EntitlementService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Parameters(
- commandNames = "entitlement",
- optionPrefixes = "-",
- separators = "=",
- commandDescription = "Apache Syncope entitlement service")
-public class EntitlementCommand extends AbstractCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(EntitlementCommand.class);
-
- private final String helpMessage = "Usage: entitlement [options]\n"
- + " Options:\n"
- + " -h, --help \n"
- + " -l, --list \n"
- + " -lo, --list-own \n";
-
- @Parameter(names = { "-lo", "--list-own" })
- public boolean listOwn = false;
-
- @Override
- public void execute() {
- final EntitlementService entitlementService = SyncopeServices.get(EntitlementService.class);
- LOG.debug("Entitlement service successfully created");
-
- if (help) {
- LOG.debug("- entitlement help command");
- System.out.println(helpMessage);
- } else if (list) {
- System.out.println("All entitlement:");
- for (final EntitlementTO entitlementTO : entitlementService.getAllEntitlements()) {
- System.out.println(" *** " + entitlementTO.getElement());
- }
- } else if (listOwn) {
- System.out.println("All own entitlement:");
- for (final EntitlementTO entitlementTO : entitlementService.getOwnEntitlements()) {
- System.out.println(" *** " + entitlementTO.getElement());
- }
- } else {
- System.out.println(helpMessage);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
index c2bcb5f..086ab25 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
@@ -79,7 +79,7 @@ public class PolicyCommand extends AbstractCommand {
} catch (final IllegalArgumentException ex) {
System.out.println(" - Error: " + policyType + " isn't a valid policy type, try with:");
for (final PolicyType type : PolicyType.values()) {
- System.out.println(" *** " + type.name() + ": " + type.getDescription());
+ System.out.println(" *** " + type.name());
}
}
} else if (policyIdToRead > -1L) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtil.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtil.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtil.java
deleted file mode 100644
index 5cfd3ce..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtil.java
+++ /dev/null
@@ -1,61 +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 org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.link.ExternalLink;
-
-public final class JexlHelpUtil {
-
- private static final String JEXL_SYNTAX_URL = "http://commons.apache.org/jexl/reference/syntax.html";
-
- private JexlHelpUtil() {
- // private constructor for static utility class
- }
-
- public static WebMarkupContainer getJexlHelpWebContainer(final String wicketId) {
- final WebMarkupContainer jexlHelp = new WebMarkupContainer(wicketId);
- jexlHelp.setVisible(false);
- jexlHelp.setOutputMarkupPlaceholderTag(true);
- jexlHelp.setOutputMarkupId(true);
- jexlHelp.add(new ExternalLink("jexlLink", JEXL_SYNTAX_URL));
- return jexlHelp;
- }
-
- public static AjaxLink<Void> getAjaxLink(final WebMarkupContainer wmc, final String wicketId) {
- AjaxLink<Void> questionMarkJexlHelp = new AjaxLink<Void>(wicketId) {
-
- private static final long serialVersionUID = -1838017408000591382L;
-
- private boolean toogle = false;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- // using bitwise inversion as suggested by
- // http://pmd.sourceforge.net/pmd-4.2.5/rules/controversial.html#BooleanInversion
- toogle ^= true;
- wmc.setVisible(toogle);
- target.add(wmc);
- }
- };
- return questionMarkJexlHelp;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtils.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtils.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtils.java
new file mode 100644
index 0000000..b29d180
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtils.java
@@ -0,0 +1,61 @@
+/*
+ * 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 org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.link.ExternalLink;
+
+public final class JexlHelpUtils {
+
+ private static final String JEXL_SYNTAX_URL = "http://commons.apache.org/jexl/reference/syntax.html";
+
+ private JexlHelpUtils() {
+ // private constructor for static utility class
+ }
+
+ public static WebMarkupContainer getJexlHelpWebContainer(final String wicketId) {
+ final WebMarkupContainer jexlHelp = new WebMarkupContainer(wicketId);
+ jexlHelp.setVisible(false);
+ jexlHelp.setOutputMarkupPlaceholderTag(true);
+ jexlHelp.setOutputMarkupId(true);
+ jexlHelp.add(new ExternalLink("jexlLink", JEXL_SYNTAX_URL));
+ return jexlHelp;
+ }
+
+ public static AjaxLink<Void> getAjaxLink(final WebMarkupContainer wmc, final String wicketId) {
+ AjaxLink<Void> questionMarkJexlHelp = new AjaxLink<Void>(wicketId) {
+
+ private static final long serialVersionUID = -1838017408000591382L;
+
+ private boolean toogle = false;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ // using bitwise inversion as suggested by
+ // http://pmd.sourceforge.net/pmd-4.2.5/rules/controversial.html#BooleanInversion
+ toogle ^= true;
+ wmc.setVisible(toogle);
+ target.add(wmc);
+ }
+ };
+ return questionMarkJexlHelp;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/commons/PreferenceManager.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/PreferenceManager.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/PreferenceManager.java
index c9b27fc..a4e246e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/PreferenceManager.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/PreferenceManager.java
@@ -27,7 +27,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Response;
@@ -130,15 +129,15 @@ public class PreferenceManager {
}
public void set(final Request request, final Response response, final Map<String, List<String>> prefs) {
- String prefString = cookieUtils.load(PREFMAN_KEY);
+ Map<String, String> current = new HashMap<>();
- final Map<String, String> current = new HashMap<String, String>();
+ String prefString = cookieUtils.load(PREFMAN_KEY);
if (prefString != null) {
current.putAll(getPrefs(new String(Base64.decodeBase64(prefString.getBytes()))));
}
// after retrieved previous setting in order to overwrite the key ...
- for (Entry<String, List<String>> entry : prefs.entrySet()) {
+ for (Map.Entry<String, List<String>> entry : prefs.entrySet()) {
current.put(entry.getKey(), StringUtils.collectionToDelimitedString(entry.getValue(), ";"));
}
@@ -152,7 +151,7 @@ public class PreferenceManager {
public void set(final Request request, final Response response, final String key, final String value) {
String prefString = cookieUtils.load(PREFMAN_KEY);
- final Map<String, String> current = new HashMap<String, String>();
+ final Map<String, String> current = new HashMap<>();
if (prefString != null) {
current.putAll(getPrefs(new String(Base64.decodeBase64(prefString.getBytes()))));
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/commons/PreviewUtil.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/PreviewUtil.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/PreviewUtil.java
deleted file mode 100644
index 98e47c0..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/PreviewUtil.java
+++ /dev/null
@@ -1,62 +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.lang.reflect.InvocationTargetException;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.console.init.ImplementationClassNamesLoader;
-import org.apache.syncope.client.console.wicket.markup.html.form.preview.AbstractBinaryPreviewer;
-import org.apache.wicket.Component;
-import org.apache.wicket.util.crypt.Base64;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.ClassUtils;
-
-@org.springframework.stereotype.Component
-public class PreviewUtil {
-
- @Autowired
- private ImplementationClassNamesLoader implementationClassNamesLoader;
-
- public Component getPreviewer(final String mimeType, final String file)
- throws InstantiationException, IllegalAccessException, InvocationTargetException {
-
- final Class<? extends AbstractBinaryPreviewer> previewer = StringUtils.isBlank(file)
- ? null
- : implementationClassNamesLoader.getPreviewerClass(mimeType);
-
- return previewer == null
- ? null
- : ClassUtils.getConstructorIfAvailable(previewer, String.class, String.class, byte[].class).
- newInstance(new Object[] { "previewer", mimeType, Base64.decodeBase64(file) }).
- preview();
- }
-
- public Component getPreviewer(final String mimeType, final byte[] file)
- throws InstantiationException, IllegalAccessException, InvocationTargetException {
-
- final Class<? extends AbstractBinaryPreviewer> previewer =
- implementationClassNamesLoader.getPreviewerClass(mimeType);
-
- return previewer == null
- ? null
- : ClassUtils.getConstructorIfAvailable(previewer, String.class, String.class, byte[].class).
- newInstance(new Object[] { "previewer", mimeType, file }).
- preview();
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/commons/PreviewUtils.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/PreviewUtils.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/PreviewUtils.java
new file mode 100644
index 0000000..12c93d4
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/PreviewUtils.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.commons;
+
+import java.lang.reflect.InvocationTargetException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.init.ImplementationClassNamesLoader;
+import org.apache.syncope.client.console.wicket.markup.html.form.preview.AbstractBinaryPreviewer;
+import org.apache.wicket.Component;
+import org.apache.wicket.util.crypt.Base64;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ClassUtils;
+
+@org.springframework.stereotype.Component
+public class PreviewUtils {
+
+ @Autowired
+ private ImplementationClassNamesLoader implementationClassNamesLoader;
+
+ public Component getPreviewer(final String mimeType, final String file)
+ throws InstantiationException, IllegalAccessException, InvocationTargetException {
+
+ final Class<? extends AbstractBinaryPreviewer> previewer = StringUtils.isBlank(file)
+ ? null
+ : implementationClassNamesLoader.getPreviewerClass(mimeType);
+
+ return previewer == null
+ ? null
+ : ClassUtils.getConstructorIfAvailable(previewer, String.class, String.class, byte[].class).
+ newInstance(new Object[] { "previewer", mimeType, Base64.decodeBase64(file) }).
+ preview();
+ }
+
+ public Component getPreviewer(final String mimeType, final byte[] file)
+ throws InstantiationException, IllegalAccessException, InvocationTargetException {
+
+ final Class<? extends AbstractBinaryPreviewer> previewer =
+ implementationClassNamesLoader.getPreviewerClass(mimeType);
+
+ return previewer == null
+ ? null
+ : ClassUtils.getConstructorIfAvailable(previewer, String.class, String.class, byte[].class).
+ newInstance(new Object[] { "previewer", mimeType, file }).
+ preview();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/pages/DerSchemaModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/DerSchemaModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/DerSchemaModalPage.java
index 98f4fbb..1abe744 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/DerSchemaModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/DerSchemaModalPage.java
@@ -19,7 +19,7 @@
package org.apache.syncope.client.console.pages;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.JexlHelpUtil;
+import org.apache.syncope.client.console.commons.JexlHelpUtils;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.DerSchemaTO;
@@ -68,9 +68,9 @@ public class DerSchemaModalPage extends AbstractSchemaModalPage<DerSchemaTO> {
new PropertyModel<String>(schema, "expression"));
expression.addRequiredLabel();
- final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
+ final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("jexlHelp");
- final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
+ final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
schemaForm.add(questionMarkJexlHelp);
questionMarkJexlHelp.add(jexlHelp);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/pages/PlainSchemaModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/PlainSchemaModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/PlainSchemaModalPage.java
index bad0ae7..3adba7d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/PlainSchemaModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/PlainSchemaModalPage.java
@@ -25,7 +25,7 @@ import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.JexlHelpUtil;
+import org.apache.syncope.client.console.commons.JexlHelpUtils;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
@@ -218,9 +218,9 @@ public class PlainSchemaModalPage extends AbstractSchemaModalPage<PlainSchemaTO>
});
schemaForm.add(mandatoryCondition);
- final WebMarkupContainer pwdJexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
+ final WebMarkupContainer pwdJexlHelp = JexlHelpUtils.getJexlHelpWebContainer("jexlHelp");
- final AjaxLink<Void> pwdQuestionMarkJexlHelp = JexlHelpUtil.getAjaxLink(pwdJexlHelp, "questionMarkJexlHelp");
+ final AjaxLink<Void> pwdQuestionMarkJexlHelp = JexlHelpUtils.getAjaxLink(pwdJexlHelp, "questionMarkJexlHelp");
schemaForm.add(pwdQuestionMarkJexlHelp);
pwdQuestionMarkJexlHelp.add(pwdJexlHelp);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/pages/PolicyModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/PolicyModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/PolicyModalPage.java
index 8daecb7..ead376a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/PolicyModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/PolicyModalPage.java
@@ -72,7 +72,7 @@ import org.apache.wicket.spring.injection.annot.SpringBean;
/**
* Modal window with Resource form.
*/
-public class PolicyModalPage<T extends AbstractPolicyTO> extends BaseModalPage {
+public class PolicyModalPage<T extends AbstractPolicyTO<?>> extends BaseModalPage {
private static final long serialVersionUID = -7325772767481076679L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/pages/Reports.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Reports.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Reports.java
index a7b9c6c..e484701 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Reports.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Reports.java
@@ -22,7 +22,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.PreferenceManager;
import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
@@ -328,7 +328,7 @@ public class Reports extends BasePage {
for (String toBeRemoved : eventSelectionChanged.getToBeRemoved()) {
if (events.contains(toBeRemoved)) {
- final Map.Entry<EventCategoryTO, Result> eventCategory =
+ Pair<EventCategoryTO, Result> eventCategory =
AuditLoggerName.parseEventCategory(toBeRemoved);
final AuditLoggerName auditLoggerName = new AuditLoggerName(
@@ -346,7 +346,7 @@ public class Reports extends BasePage {
for (String toBeAdded : eventSelectionChanged.getToBeAdded()) {
if (!events.contains(toBeAdded)) {
- final Map.Entry<EventCategoryTO, Result> eventCategory =
+ Pair<EventCategoryTO, Result> eventCategory =
AuditLoggerName.parseEventCategory(toBeAdded);
final AuditLoggerName auditLoggerName = new AuditLoggerName(
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/pages/Schema.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Schema.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Schema.java
index 9bfba54..cffb7cd 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Schema.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Schema.java
@@ -19,7 +19,6 @@
package org.apache.syncope.client.console.pages;
import java.lang.reflect.Field;
-import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -29,6 +28,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.PreferenceManager;
import org.apache.syncope.client.console.commons.SchemaModalPageFactory;
@@ -95,31 +96,31 @@ public class Schema extends BasePage {
}
};
- private static final Map<Map.Entry<AttributableType, SchemaType>, String> PAGINATOR_ROWS_KEYS =
- new HashMap<Map.Entry<AttributableType, SchemaType>, String>() {
+ private static final Map<Pair<AttributableType, SchemaType>, String> PAGINATOR_ROWS_KEYS =
+ new HashMap<Pair<AttributableType, SchemaType>, String>() {
private static final long serialVersionUID = 3109256773218160485L;
{
- put(new SimpleEntry<>(AttributableType.CONFIGURATION, SchemaType.PLAIN),
+ put(new ImmutablePair<>(AttributableType.CONFIGURATION, SchemaType.PLAIN),
Constants.PREF_CONF_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.USER, SchemaType.PLAIN),
+ put(new ImmutablePair<>(AttributableType.USER, SchemaType.PLAIN),
Constants.PREF_USER_PLAIN_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.USER, SchemaType.DERIVED),
+ put(new ImmutablePair<>(AttributableType.USER, SchemaType.DERIVED),
Constants.PREF_USER_DER_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.USER, SchemaType.VIRTUAL),
+ put(new ImmutablePair<>(AttributableType.USER, SchemaType.VIRTUAL),
Constants.PREF_USER_VIR_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.MEMBERSHIP, SchemaType.PLAIN),
+ put(new ImmutablePair<>(AttributableType.MEMBERSHIP, SchemaType.PLAIN),
Constants.PREF_MEMBERSHIP_PLAIN_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.MEMBERSHIP, SchemaType.DERIVED),
+ put(new ImmutablePair<>(AttributableType.MEMBERSHIP, SchemaType.DERIVED),
Constants.PREF_MEMBERSHIP_DER_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.MEMBERSHIP, SchemaType.VIRTUAL),
+ put(new ImmutablePair<>(AttributableType.MEMBERSHIP, SchemaType.VIRTUAL),
Constants.PREF_MEMBERSHIP_VIR_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.GROUP, SchemaType.PLAIN),
+ put(new ImmutablePair<>(AttributableType.GROUP, SchemaType.PLAIN),
Constants.PREF_GROUP_PLAIN_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.GROUP, SchemaType.DERIVED),
+ put(new ImmutablePair<>(AttributableType.GROUP, SchemaType.DERIVED),
Constants.PREF_GROUP_DER_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.GROUP, SchemaType.VIRTUAL),
+ put(new ImmutablePair<>(AttributableType.GROUP, SchemaType.VIRTUAL),
Constants.PREF_GROUP_VIR_SCHEMA_PAGINATOR_ROWS);
}
};
@@ -304,7 +305,7 @@ public class Schema extends BasePage {
final AjaxFallbackDefaultDataTable dataTable,
final String formname, final SchemaTypePanel schemaTypePanel, final String rowsPerPagePrefName) {
- Form<Void> form = new Form<Void>(formname);
+ Form<Void> form = new Form<>(formname);
final DropDownChoice<Integer> rowChooser = new DropDownChoice<Integer>("rowsChooser",
new PropertyModel<Integer>(schemaTypePanel, "pageRows"), prefMan.getPaginatorChoices(),
@@ -449,7 +450,7 @@ public class Schema extends BasePage {
setWindowClosedCallback(editSchemaWin, schemaContainer);
final String paginatorRowsKey = PAGINATOR_ROWS_KEYS.get(
- new SimpleEntry<AttributableType, SchemaType>(attrType, schemaType));
+ new ImmutablePair<AttributableType, SchemaType>(attrType, schemaType));
pageRows = prefMan.getPaginatorRows(getRequest(), paginatorRowsKey);
List<IColumn> tableCols = getColumns(schemaContainer, editSchemaWin, attrType,
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/panels/DerAttrsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerAttrsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerAttrsPanel.java
index c8872b5..8be459a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerAttrsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerAttrsPanel.java
@@ -100,7 +100,7 @@ public class DerAttrsPanel extends Panel {
} else if (entityTO instanceof UserTO) {
derSchemaNames = schemaRestClient.getDerSchemaNames(AttributableType.USER);
} else {
- derSchemaNames = groupRestClient.read(((MembershipTO) entityTO).getGroupId()).getMDerAttrTemplates();
+ derSchemaNames = groupRestClient.read(((MembershipTO) entityTO).getGroupKey()).getMDerAttrTemplates();
}
return derSchemaNames;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDetailsPanel.java
index 4af9d25..7662e4a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDetailsPanel.java
@@ -19,7 +19,7 @@
package org.apache.syncope.client.console.panels;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.JexlHelpUtil;
+import org.apache.syncope.client.console.commons.JexlHelpUtils;
import org.apache.syncope.client.console.pages.GroupSelectModalPage;
import org.apache.syncope.client.console.pages.UserOwnerSelectModalPage;
import org.apache.syncope.client.console.panels.AttrTemplatesPanel.GroupAttrTemplatesChange;
@@ -142,9 +142,9 @@ public class GroupDetailsPanel extends Panel {
final AjaxTextFieldPanel name =
new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(groupTO, "key"));
- final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
+ final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("jexlHelp");
- final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
+ final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
this.add(questionMarkJexlHelp);
questionMarkJexlHelp.add(jexlHelp);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/panels/LoggerCategoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/LoggerCategoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/LoggerCategoryPanel.java
index aa3c3eb..70e0361 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/LoggerCategoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/LoggerCategoryPanel.java
@@ -24,9 +24,9 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.panels.SelectedEventsPanel.EventSelectionChanged;
import org.apache.syncope.client.console.panels.SelectedEventsPanel.InspectSelectedEvent;
@@ -52,16 +52,9 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.ResourceModel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public abstract class LoggerCategoryPanel extends Panel {
- /**
- * Logger.
- */
- private static final Logger LOG = LoggerFactory.getLogger(LoggerCategoryPanel.class);
-
private static final long serialVersionUID = 6429053774964787734L;
private final List<EventCategoryTO> eventCategoryTOs;
@@ -207,7 +200,7 @@ public abstract class LoggerCategoryPanel extends Panel {
@Override
public void onClick(final AjaxRequestTarget target) {
if (StringUtils.isNotBlank(custom.getModelObject())) {
- final Map.Entry<EventCategoryTO, AuditElements.Result> parsed =
+ final Pair<EventCategoryTO, AuditElements.Result> parsed =
AuditLoggerName.parseEventCategory(custom.getModelObject());
final String eventString = AuditLoggerName.buildEvent(
@@ -233,12 +226,12 @@ public abstract class LoggerCategoryPanel extends Panel {
private static final long serialVersionUID = -3722207913631435502L;
@Override
- public void onClick(AjaxRequestTarget target) {
+ public void onClick(final AjaxRequestTarget target) {
if (StringUtils.isNotBlank(custom.getModelObject())) {
- final Map.Entry<EventCategoryTO, AuditElements.Result> parsed =
+ Pair<EventCategoryTO, AuditElements.Result> parsed =
AuditLoggerName.parseEventCategory(custom.getModelObject());
- final String eventString = AuditLoggerName.buildEvent(
+ String eventString = AuditLoggerName.buildEvent(
parsed.getKey().getType(),
null,
null,
@@ -351,9 +344,9 @@ public abstract class LoggerCategoryPanel extends Panel {
// update objects ....
eventCategoryTO.getEvents().clear();
- final InspectSelectedEvent inspectSelectedEvent = (InspectSelectedEvent) event.getPayload();
+ InspectSelectedEvent inspectSelectedEvent = (InspectSelectedEvent) event.getPayload();
- final Map.Entry<EventCategoryTO, AuditElements.Result> categoryEvent =
+ Pair<EventCategoryTO, AuditElements.Result> categoryEvent =
AuditLoggerName.parseEventCategory(inspectSelectedEvent.getEvent());
eventCategoryTO.setType(categoryEvent.getKey().getType());
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/panels/MembershipsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/MembershipsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/MembershipsPanel.java
index 9136462..fa0a9bc 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/MembershipsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/MembershipsPanel.java
@@ -126,12 +126,12 @@ public class MembershipsPanel extends Panel {
PageReference pageRef = getPage().getPageReference();
for (MembershipTO membTO : membView.getList()) {
- if (membTO.getGroupId() == groupTO.getKey()) {
+ if (membTO.getGroupKey() == groupTO.getKey()) {
return new MembershipModalPage(pageRef, membWin, membTO, mode);
}
}
MembershipTO membTO = new MembershipTO();
- membTO.setGroupId(groupTO.getKey());
+ membTO.setGroupKey(groupTO.getKey());
membTO.setGroupName(groupTO.getName());
return new MembershipModalPage(pageRef, membWin, membTO, mode);
@@ -159,7 +159,7 @@ public class MembershipsPanel extends Panel {
protected void populateItem(final ListItem<MembershipTO> item) {
final MembershipTO membershipTO = (MembershipTO) item.getDefaultModelObject();
- item.add(new Label("groupId", new Model<Long>(membershipTO.getGroupId())));
+ item.add(new Label("groupId", new Model<Long>(membershipTO.getGroupKey())));
item.add(new Label("groupName", new Model<String>(membershipTO.getGroupName())));
AjaxLink editLink = new ClearIndicatingAjaxLink("editLink", pageRef) {
@@ -194,13 +194,13 @@ public class MembershipsPanel extends Panel {
((UserModalPage) getPage()).getUserTO().getMemberships().remove(membershipTO);
target.add(membershipsContainer);
- GroupTO groupTO = groupTreeBuilder.findGroup(membershipTO.getGroupId());
+ GroupTO groupTO = groupTreeBuilder.findGroup(membershipTO.getGroupKey());
Set<String> resourcesToRemove = groupTO == null
? Collections.<String>emptySet() : groupTO.getResources();
if (!resourcesToRemove.isEmpty()) {
Set<String> resourcesAssignedViaMembership = new HashSet<>();
for (MembershipTO membTO : userTO.getMemberships()) {
- groupTO = groupTreeBuilder.findGroup(membTO.getGroupId());
+ groupTO = groupTreeBuilder.findGroup(membTO.getGroupKey());
if (groupTO != null) {
resourcesAssignedViaMembership.addAll(groupTO.getResources());
}
@@ -237,7 +237,7 @@ public class MembershipsPanel extends Panel {
Set<String> resourcesToAdd = new HashSet<>();
for (Long diffMembId : diff) {
- long groupId = updatedUserTO.getMembershipMap().get(diffMembId).getGroupId();
+ long groupId = updatedUserTO.getMembershipMap().get(diffMembId).getGroupKey();
GroupTO groupTO = groupTreeBuilder.findGroup(groupId);
resourcesToAdd.addAll(groupTO.getResources());
StatusUtils.update(
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainAttrsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainAttrsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainAttrsPanel.java
index 1cf25ef..b0517b0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainAttrsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainAttrsPanel.java
@@ -32,7 +32,7 @@ import java.util.Set;
import java.util.TreeMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.commons.AttrLayoutType;
-import org.apache.syncope.client.console.commons.JexlHelpUtil;
+import org.apache.syncope.client.console.commons.JexlHelpUtils;
import org.apache.syncope.client.console.commons.Mode;
import org.apache.syncope.client.console.panels.AttrTemplatesPanel.GroupAttrTemplatesChange;
import org.apache.syncope.client.console.rest.ConfigurationRestClient;
@@ -118,9 +118,9 @@ public class PlainAttrsPanel extends Panel {
protected void populateItem(final ListItem<AttrTO> item) {
final AttrTO attributeTO = (AttrTO) item.getDefaultModelObject();
- final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
+ final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("jexlHelp");
- final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
+ final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
item.add(questionMarkJexlHelp);
questionMarkJexlHelp.add(jexlHelp);
@@ -169,7 +169,7 @@ public class PlainAttrsPanel extends Panel {
attrLayout = confRestClient.readAttrLayout(AttrLayoutType.valueOf(mode, AttributableType.MEMBERSHIP));
schemaTOs = schemaRestClient.getSchemas(AttributableType.MEMBERSHIP);
Set<String> allowed = new HashSet<>(
- groupRestClient.read(((MembershipTO) entityTO).getGroupId()).getMPlainAttrTemplates());
+ groupRestClient.read(((MembershipTO) entityTO).getGroupKey()).getMPlainAttrTemplates());
schemaRestClient.filter(schemaTOs, allowed, true);
} else {
schemas = new TreeMap<>();
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
index 3940421..406676f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
@@ -26,7 +26,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.JexlHelpUtil;
+import org.apache.syncope.client.console.commons.JexlHelpUtils;
import org.apache.syncope.client.console.panels.ResourceConnConfPanel.ConnConfModEvent;
import org.apache.syncope.client.console.rest.ConnectorRestClient;
import org.apache.syncope.client.console.rest.SchemaRestClient;
@@ -185,9 +185,9 @@ public class ResourceMappingPanel extends Panel {
schemaNames = Collections.<String>emptyList();
}
- final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
+ final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("jexlHelp");
- AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
+ AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
mappingContainer.add(questionMarkJexlHelp);
questionMarkJexlHelp.add(jexlHelp);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourcesPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourcesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourcesPanel.java
index 6dd1d06..028b3a0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourcesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourcesPanel.java
@@ -153,7 +153,7 @@ public class ResourcesPanel extends Panel {
if (!resourcesToRemove.isEmpty()) {
Set<String> resourcesAssignedViaMembership = new HashSet<>();
for (MembershipTO membTO : userTO.getMemberships()) {
- GroupTO groupTO = groupTreeBuilder.findGroup(membTO.getGroupId());
+ GroupTO groupTO = groupTreeBuilder.findGroup(membTO.getGroupKey());
if (groupTO != null) {
resourcesAssignedViaMembership.addAll(groupTO.getResources());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
index 18e2066..bf990ec 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
@@ -18,7 +18,7 @@
*/
package org.apache.syncope.client.console.panels;
-import org.apache.syncope.client.console.commons.JexlHelpUtil;
+import org.apache.syncope.client.console.commons.JexlHelpUtils;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
@@ -52,9 +52,9 @@ public class UserDetailsPanel extends Panel {
final FieldPanel<String> username = new AjaxTextFieldPanel("username", "username",
new PropertyModel<String>(userTO, "username"));
- final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("usernameJexlHelp");
+ final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("usernameJexlHelp");
- final AjaxLink<?> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "usernameQuestionMarkJexlHelp");
+ final AjaxLink<?> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "usernameQuestionMarkJexlHelp");
add(questionMarkJexlHelp);
questionMarkJexlHelp.add(jexlHelp);
@@ -68,9 +68,9 @@ public class UserDetailsPanel extends Panel {
// ------------------------
// Password
// ------------------------
- final WebMarkupContainer pwdJexlHelp = JexlHelpUtil.getJexlHelpWebContainer("pwdJexlHelp");
+ final WebMarkupContainer pwdJexlHelp = JexlHelpUtils.getJexlHelpWebContainer("pwdJexlHelp");
- final AjaxLink<?> pwdQuestionMarkJexlHelp = JexlHelpUtil.getAjaxLink(pwdJexlHelp, "pwdQuestionMarkJexlHelp");
+ final AjaxLink<?> pwdQuestionMarkJexlHelp = JexlHelpUtils.getAjaxLink(pwdJexlHelp, "pwdQuestionMarkJexlHelp");
add(pwdQuestionMarkJexlHelp);
pwdQuestionMarkJexlHelp.add(pwdJexlHelp);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java
index 4a3e103..84049f0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java
@@ -124,7 +124,7 @@ public class VirAttrsPanel extends Panel {
} else {
schemaTOs = schemaRestClient.getVirSchemas(AttributableType.MEMBERSHIP);
Set<String> allowed = new HashSet<String>(
- groupRestClient.read(((MembershipTO) entityTO).getGroupId()).getMVirAttrTemplates());
+ groupRestClient.read(((MembershipTO) entityTO).getGroupKey()).getMVirAttrTemplates());
filter(schemaTOs, allowed);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
index eb9e7cb..4409f7c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
@@ -34,7 +34,7 @@ public class PolicyRestClient extends BaseRestClient {
private static final long serialVersionUID = -1392090291817187902L;
- public <T extends AbstractPolicyTO> T getGlobalPolicy(final PolicyType type) {
+ public <T extends AbstractPolicyTO<?>> T getGlobalPolicy(final PolicyType type) {
T policy = null;
try {
policy = getService(PolicyService.class).readGlobal(type);
@@ -44,7 +44,7 @@ public class PolicyRestClient extends BaseRestClient {
return policy;
}
- public <T extends AbstractPolicyTO> T getPolicy(final Long id) {
+ public <T extends AbstractPolicyTO<?>> T getPolicy(final Long id) {
T policy = null;
try {
policy = getService(PolicyService.class).read(id);
@@ -55,7 +55,7 @@ public class PolicyRestClient extends BaseRestClient {
}
@SuppressWarnings("unchecked")
- public <T extends AbstractPolicyTO> List<T> getPolicies(final PolicyType type, final boolean includeGlobal) {
+ public <T extends AbstractPolicyTO<?>> List<T> getPolicies(final PolicyType type, final boolean includeGlobal) {
final List<T> res = new ArrayList<>();
try {
@@ -66,9 +66,9 @@ public class PolicyRestClient extends BaseRestClient {
if (includeGlobal) {
try {
- AbstractPolicyTO globalPolicy = getGlobalPolicy(type);
+ T globalPolicy = getGlobalPolicy(type);
if (globalPolicy != null) {
- res.add(0, (T) globalPolicy);
+ res.add(0, globalPolicy);
}
} catch (Exception ignore) {
LOG.warn("No global policy found", ignore);
@@ -78,15 +78,15 @@ public class PolicyRestClient extends BaseRestClient {
return res;
}
- public <T extends AbstractPolicyTO> void createPolicy(final T policy) {
+ public <T extends AbstractPolicyTO<?>> void createPolicy(final T policy) {
getService(PolicyService.class).create(policy);
}
- public <T extends AbstractPolicyTO> void updatePolicy(final T policy) {
+ public <T extends AbstractPolicyTO<?>> void updatePolicy(final T policy) {
getService(PolicyService.class).update(policy.getKey(), policy);
}
- public void delete(final Long id, final Class<? extends AbstractPolicyTO> policyClass) {
+ public void delete(final Long id, final Class<? extends AbstractPolicyTO<?>> policyClass) {
getService(PolicyService.class).delete(id);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
index 6615b14..40a88ac 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
@@ -22,7 +22,7 @@ import java.io.ByteArrayInputStream;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.console.commons.PreviewUtil;
+import org.apache.syncope.client.console.commons.PreviewUtils;
import org.apache.syncope.client.console.commons.HttpResourceStream;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.pages.BaseModalPage;
@@ -63,7 +63,7 @@ public class BinaryFieldPanel extends FieldPanel<String> {
private final Fragment emptyFragment;
@SpringBean
- private PreviewUtil previewUtil;
+ private PreviewUtils previewUtil;
public BinaryFieldPanel(final String id, final String name, final IModel<String> model, final String mimeType) {
super(id, model);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
----------------------------------------------------------------------
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
index 2a3d146..c3f4428 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
@@ -18,14 +18,26 @@
*/
package org.apache.syncope.client.lib;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
import javax.ws.rs.core.EntityTag;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.syncope.common.lib.search.OrderByClauseBuilder;
import org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.rest.api.Preference;
import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.service.UserSelfService;
/**
* Entry point for client access to all REST services exposed by Syncope core; obtain instances via
@@ -37,15 +49,21 @@ public class SyncopeClient {
private final RestClientFactoryBean restClientFactory;
+ private final RestClientExceptionMapper exceptionMapper;
+
private final String username;
private final String password;
- public SyncopeClient(final MediaType mediaType, final RestClientFactoryBean restClientFactory,
+ public SyncopeClient(
+ final MediaType mediaType,
+ final RestClientFactoryBean restClientFactory,
+ final RestClientExceptionMapper exceptionMapper,
final String username, final String password) {
this.mediaType = mediaType;
this.restClientFactory = restClientFactory;
+ this.exceptionMapper = exceptionMapper;
this.username = username;
this.password = password;
}
@@ -90,6 +108,28 @@ public class SyncopeClient {
}
}
+ @SuppressWarnings("unchecked")
+ public Pair<Map<Entitlement, Set<String>>, UserTO> self() {
+ Response response = getService(UserSelfService.class).read();
+ if (response.getStatusInfo().getStatusCode() != Response.Status.OK.getStatusCode()) {
+ Exception ex = exceptionMapper.fromResponse(response);
+ if (ex != null) {
+ throw (RuntimeException) ex;
+ }
+ }
+
+ try {
+ return new ImmutablePair<>(
+ (Map<Entitlement, Set<String>>) new ObjectMapper().readValue(
+ response.getHeaderString(RESTHeaders.OWNED_ENTITLEMENTS),
+ new TypeReference<HashMap<Entitlement, Set<String>>>() {
+ }),
+ response.readEntity(UserTO.class));
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
/**
* Sets the given header on the give service instance.
*
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
----------------------------------------------------------------------
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
index 53e0fda..24923f1 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
@@ -89,7 +89,7 @@ public class SyncopeClientFactoryBean {
marshallerProperties.put(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
defaultJAXBProvider.setMarshallerProperties(marshallerProperties);
- Map<String, String> collectionWrapperMap = new HashMap<String, String>();
+ Map<String, String> collectionWrapperMap = new HashMap<>();
collectionWrapperMap.put(AbstractPolicyTO.class.getName(), "policies");
defaultJAXBProvider.setCollectionWrapperMap(collectionWrapperMap);
@@ -111,11 +111,11 @@ public class SyncopeClientFactoryBean {
defaultRestClientFactoryBean.setThreadSafe(true);
defaultRestClientFactoryBean.setInheritHeaders(true);
- List<Feature> features = new ArrayList<Feature>();
+ List<Feature> features = new ArrayList<>();
features.add(new LoggingFeature());
defaultRestClientFactoryBean.setFeatures(features);
- List<Object> providers = new ArrayList<Object>(3);
+ List<Object> providers = new ArrayList<>(3);
providers.add(getJaxbProvider());
providers.add(getJsonProvider());
providers.add(getExceptionMapper());
@@ -197,6 +197,11 @@ public class SyncopeClientFactoryBean {
}
public SyncopeClient create(final String username, final String password) {
- return new SyncopeClient(getContentType().getMediaType(), getRestClientFactoryBean(), username, password);
+ return new SyncopeClient(
+ getContentType().getMediaType(),
+ getRestClientFactoryBean(),
+ getExceptionMapper(),
+ username,
+ password);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index 78bfcbd..92c8b6e 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -35,7 +35,8 @@ under the License.
<modules>
<module>lib</module>
- <module>console</module>
+ <!-- THIS UNTIL SYNCOPE-611 gets completely resolved -->
+ <!--<module>console</module>-->
<module>cli</module>
</modules>
[34/57] syncope git commit: [SYNCOPE-119] Introducing Realms
Posted by il...@apache.org.
[SYNCOPE-119] Introducing Realms
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/423e4cca
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/423e4cca
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/423e4cca
Branch: refs/heads/master
Commit: 423e4cca089a3ba9f8458428a40f6d4d74a324f9
Parents: bac03b2
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Apr 9 17:56:02 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Apr 9 17:56:02 2015 +0200
----------------------------------------------------------------------
.../syncope/common/lib/CollectionUtils2.java | 128 +++++++++++++
.../syncope/common/lib/to/BulkActionResult.java | 8 +-
.../apache/syncope/common/lib/to/RealmTO.java | 91 +++++++++
.../common/lib/types/ClientExceptionType.java | 3 +-
.../common/lib/types/EntityViolationType.java | 1 +
.../common/rest/api/CollectionWrapper.java | 2 +-
.../syncope/common/rest/api/RESTHeaders.java | 6 +-
.../common/rest/api/service/RealmService.java | 99 ++++++++++
.../syncope/core/logic/ConnectorLogic.java | 34 ++--
.../syncope/core/logic/EntitlementLogic.java | 14 +-
.../apache/syncope/core/logic/GroupLogic.java | 64 ++++---
.../apache/syncope/core/logic/LoggerLogic.java | 44 +++--
.../syncope/core/logic/NotificationLogic.java | 17 +-
.../apache/syncope/core/logic/PolicyLogic.java | 19 +-
.../apache/syncope/core/logic/RealmLogic.java | 125 +++++++++++++
.../apache/syncope/core/logic/ReportLogic.java | 72 ++++---
.../syncope/core/logic/ResourceLogic.java | 11 +-
.../apache/syncope/core/logic/SchemaLogic.java | 47 +++--
.../core/logic/SecurityQuestionLogic.java | 18 +-
.../apache/syncope/core/logic/TaskLogic.java | 22 ++-
.../apache/syncope/core/logic/UserLogic.java | 63 ++++---
.../syncope/core/logic/UserWorkflowLogic.java | 2 +-
.../syncope/core/logic/WorkflowLogic.java | 1 +
.../syncope/core/misc/CollectionUtils2.java | 61 ------
.../security/UnauthorizedGroupException.java | 8 +-
.../api/dao/MalformedPathException.java | 31 ++++
.../core/persistence/api/dao/RealmDAO.java | 43 +++++
.../core/persistence/api/entity/Realm.java | 41 ++++
.../core/persistence/jpa/dao/JPAGroupDAO.java | 56 +++---
.../core/persistence/jpa/dao/JPAPolicyDAO.java | 10 +
.../core/persistence/jpa/dao/JPARealmDAO.java | 146 +++++++++++++++
.../jpa/entity/JPAEntityFactory.java | 5 +-
.../core/persistence/jpa/entity/JPARealm.java | 116 ++++++++++++
.../jpa/validation/entity/RealmCheck.java | 41 ++++
.../jpa/validation/entity/RealmValidator.java | 67 +++++++
.../resources/META-INF/spring-orm-oracle.xml | 9 +
.../resources/META-INF/spring-orm-sqlserver.xml | 9 +
.../src/main/resources/META-INF/spring-orm.xml | 9 +
.../src/main/resources/content.xml | 6 +
.../persistence/jpa/entity/EntitlementTest.java | 2 +-
.../core/persistence/jpa/entity/RealmTest.java | 171 +++++++++++++++++
.../src/test/resources/content.xml | 103 +++++-----
.../provisioning/api/ConnIdBundleManager.java | 2 +-
.../provisioning/api/data/RealmDataBinder.java | 32 ++++
.../api/data/ResourceDataBinder.java | 4 -
.../provisioning/api/data/SchemaDataBinder.java | 2 +-
.../java/ConnIdBundleManagerImpl.java | 8 +-
.../java/data/RealmDataBinderImpl.java | 88 +++++++++
.../java/data/ResourceDataBinderImpl.java | 12 --
.../java/data/SchemaDataBinderImpl.java | 2 +-
.../notification/NotificationManagerImpl.java | 2 +-
.../java/data/ResourceDataBinderTest.java | 36 ----
.../rest/cxf/RestServiceExceptionMapper.java | 31 ++--
.../core/rest/cxf/service/RealmServiceImpl.java | 68 +++++++
.../fit/core/reference/AbstractITCase.java | 4 +
.../syncope/fit/core/reference/GroupITCase.java | 6 +-
.../fit/core/reference/NotificationITCase.java | 3 +-
.../syncope/fit/core/reference/RealmITCase.java | 186 +++++++++++++++++++
58 files changed, 1905 insertions(+), 406 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/common/lib/src/main/java/org/apache/syncope/common/lib/CollectionUtils2.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/CollectionUtils2.java b/common/lib/src/main/java/org/apache/syncope/common/lib/CollectionUtils2.java
new file mode 100644
index 0000000..a014fbf
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/CollectionUtils2.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.lib;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.collections4.Transformer;
+
+public final class CollectionUtils2 {
+
+ /**
+ * Returns the next element in <tt>iterator</tt> or <tt>defaultValue</tt> if the iterator is empty.
+ *
+ * @param defaultValue the default value to return if the iterator is empty
+ * @return the next element of <tt>iterator</tt> or the default value
+ */
+ public static <T> T getNext(final Iterator<? extends T> iterator, final T defaultValue) {
+ return iterator.hasNext() ? iterator.next() : defaultValue;
+ }
+
+ /**
+ * Returns the first element in <tt>iterable</tt> or <tt>defaultValue</tt> if the iterable is empty.
+ *
+ * <p/>
+ * If no default value is desired (and the caller instead wants a {@link java.util.NoSuchElementException} to be
+ * thrown), it is recommended that <tt>iterable.iterator().next()}</tt> is used instead.
+ *
+ * @param defaultValue the default value to return if the iterable is empty
+ * @return the first element of <tt>iterable</tt> or the default value
+ */
+ public static <T> T getFirst(final Iterable<? extends T> iterable, final T defaultValue) {
+ return getNext(iterable.iterator(), defaultValue);
+ }
+
+ /**
+ * Returns the first element in <tt>iterable</tt> or <tt>null</tt> if the iterable is empty.
+ *
+ * @return the first element of <tt>iterable</tt> or <tt>null</tt>
+ */
+ public static <T> T getFirstOrNull(final Iterable<? extends T> iterable) {
+ return getNext(iterable.iterator(), null);
+ }
+
+ /**
+ * Transforms all elements from inputCollection with the given transformer
+ * and adds them to the outputCollection if the provided predicate is verified.
+ * <p/>
+ * If the input collection or transformer is null, there is no change to the
+ * output collection.
+ *
+ * @param <I> the type of object in the input collection
+ * @param <O> the type of object in the output collection
+ * @param <R> the output type of the transformer - this extends O.
+ * @param inputCollection the collection to get the input from, may be null
+ * @param transformer the transformer to use, may be null
+ * @param predicate the predicate to use, may be null
+ * @param outputCollection the collection to output into, may not be null if the inputCollection
+ * and transformer are not null
+ * @return the outputCollection with the transformed input added
+ * @throws NullPointerException if the output collection is null and both, inputCollection and
+ * transformer are not null
+ */
+ public static <I, O, R extends Collection<? super O>> R collect(final Iterable<? extends I> inputCollection,
+ final Transformer<? super I, ? extends O> transformer, final Predicate<? super I> predicate,
+ final R outputCollection) {
+
+ if (inputCollection != null) {
+ return collect(inputCollection.iterator(), transformer, predicate, outputCollection);
+ }
+ return outputCollection;
+ }
+
+ /**
+ * Transforms all elements from the inputIterator with the given transformer
+ * and adds them to the outputCollection.
+ * <p/>
+ * If the input iterator or transformer is null, there is no change to the
+ * output collection.
+ *
+ * @param inputIterator the iterator to get the input from, may be null
+ * @param transformer the transformer to use, may be null
+ * @param predicate the predicate to use, may be null
+ * @param outputCollection the collection to output into, may not be null if the inputCollection
+ * and transformer are not null
+ * @param <I> the type of object in the input collection
+ * @param <O> the type of object in the output collection
+ * @param <R> the output type of the transformer - this extends O.
+ * @return the outputCollection with the transformed input added
+ * @throws NullPointerException if the output collection is null and both, inputCollection and
+ * transformer are not null
+ */
+ public static <I, O, R extends Collection<? super O>> R collect(final Iterator<? extends I> inputIterator,
+ final Transformer<? super I, ? extends O> transformer, final Predicate<? super I> predicate,
+ final R outputCollection) {
+
+ if (inputIterator != null && transformer != null) {
+ while (inputIterator.hasNext()) {
+ final I item = inputIterator.next();
+ final O value = transformer.transform(item);
+ if (predicate == null || predicate.evaluate(item)) {
+ outputCollection.add(value);
+ }
+ }
+ }
+ return outputCollection;
+ }
+
+ private CollectionUtils2() {
+ // private constructor for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
index fb34a73..1a9c783 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
@@ -29,6 +29,8 @@ import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlRootElement(name = "bulkActionResult")
@@ -51,7 +53,7 @@ public class BulkActionResult extends AbstractBaseBean {
}
- private final List<Result> results = new ArrayList<Result>();
+ private final List<Result> results = new ArrayList<>();
@XmlElementWrapper(name = "result")
@XmlElement(name = "item")
@@ -76,7 +78,7 @@ public class BulkActionResult extends AbstractBaseBean {
@JsonIgnore
public Map<String, Status> getResultMap() {
- final Map<String, Status> res = new HashMap<String, Status>();
+ final Map<String, Status> res = new HashMap<>();
for (Result result : results) {
res.put(result.getKey(), result.getValue());
@@ -87,7 +89,7 @@ public class BulkActionResult extends AbstractBaseBean {
@JsonIgnore
public List<String> getResultByStatus(final Status status) {
- final List<String> res = new ArrayList<String>();
+ final List<String> res = new ArrayList<>();
for (Result result : results) {
if (result.getValue() == status) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/common/lib/src/main/java/org/apache/syncope/common/lib/to/RealmTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/RealmTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RealmTO.java
new file mode 100644
index 0000000..9a25be2
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RealmTO.java
@@ -0,0 +1,91 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+
+@XmlRootElement(name = "realm")
+@XmlType
+public class RealmTO extends AbstractBaseBean {
+
+ private static final long serialVersionUID = 516330662956254391L;
+
+ private long key;
+
+ private String name;
+
+ private long parent;
+
+ private String fullPath;
+
+ private Long accountPolicy;
+
+ private Long passwordPolicy;
+
+ public long getKey() {
+ return key;
+ }
+
+ public void setKey(final long key) {
+ this.key = key;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public long getParent() {
+ return parent;
+ }
+
+ public void setParent(final long parent) {
+ this.parent = parent;
+ }
+
+ public String getFullPath() {
+ return fullPath;
+ }
+
+ public void setFullPath(final String fullPath) {
+ this.fullPath = fullPath;
+ }
+
+ public Long getAccountPolicy() {
+ return accountPolicy;
+ }
+
+ public void setAccountPolicy(final Long accountPolicy) {
+ this.accountPolicy = accountPolicy;
+ }
+
+ public Long getPasswordPolicy() {
+ return passwordPolicy;
+ }
+
+ public void setPasswordPolicy(final Long passwordPolicy) {
+ this.passwordPolicy = passwordPolicy;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
index f67c3d4..8f0e33b 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
@@ -25,7 +25,7 @@ public enum ClientExceptionType {
AssociatedResources(Response.Status.BAD_REQUEST),
Composite(Response.Status.BAD_REQUEST),
ConcurrentModification(Response.Status.PRECONDITION_FAILED),
- DataIntegrityViolation(Response.Status.BAD_REQUEST),
+ DataIntegrityViolation(Response.Status.CONFLICT),
EntityExists(Response.Status.CONFLICT),
GenericPersistence(Response.Status.BAD_REQUEST),
InvalidSecurityAnswer(Response.Status.BAD_REQUEST),
@@ -36,6 +36,7 @@ public enum ClientExceptionType {
InvalidPolicy(Response.Status.BAD_REQUEST),
InvalidConf(Response.Status.BAD_REQUEST),
InvalidGroup(Response.Status.BAD_REQUEST),
+ InvalidPath(Response.Status.BAD_REQUEST),
InvalidReport(Response.Status.BAD_REQUEST),
InvalidReportExec(Response.Status.BAD_REQUEST),
InvalidGroups(Response.Status.BAD_REQUEST),
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
index 30193f6..c02913f 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
@@ -41,6 +41,7 @@ public enum EntityViolationType {
InvalidGPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.gPlainSchema"),
InvalidGDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.gDerSchema"),
InvalidGVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.gVirSchema"),
+ InvalidRealm("org.apache.syncope.core.persistence.validation.realm"),
InvalidReport("org.apache.syncope.core.persistence.validation.report"),
InvalidResource("org.apache.syncope.core.persistence.validation.externalresource"),
InvalidGroupOwner("org.apache.syncope.core.persistence.validation.group.owner"),
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java
index 1ab407d..e493f94 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java
@@ -68,7 +68,7 @@ public final class CollectionWrapper {
}
public static List<LoggerTO> unwrapLogger(final Collection<AuditLoggerName> auditNames) {
- List<LoggerTO> respons = new ArrayList<LoggerTO>();
+ List<LoggerTO> respons = new ArrayList<>();
for (AuditLoggerName l : auditNames) {
LoggerTO loggerTO = new LoggerTO();
loggerTO.setKey(l.toLoggerName());
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
index 93ea67e..3ade49a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
@@ -26,17 +26,17 @@ public final class RESTHeaders {
/**
* UserId option key.
*/
- public static final String USER_ID = "Syncope.UserId";
+ public static final String USER_ID = "X-Syncope-User-Id";
/**
* Username option key.
*/
- public static final String USERNAME = "Syncope.Username";
+ public static final String USERNAME = "X-Syncope-Username";
/**
* HTTP header key for object ID assigned to an object after its creation.
*/
- public static final String RESOURCE_ID = "Syncope.Id";
+ public static final String RESOURCE_ID = "X-Syncope-Id";
/**
* Declares the type of exception being raised.
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
new file mode 100644
index 0000000..c8343ae
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
@@ -0,0 +1,99 @@
+/*
+ * 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 java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.model.wadl.Description;
+import org.apache.cxf.jaxrs.model.wadl.Descriptions;
+import org.apache.cxf.jaxrs.model.wadl.DocTarget;
+import org.apache.syncope.common.lib.to.RealmTO;
+
+/**
+ * REST operations for realms.
+ */
+@Path("realms")
+public interface RealmService extends JAXRSService {
+
+ /**
+ * Returns a list of all realms.
+ *
+ * @return list of all realms.
+ */
+ @GET
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ List<RealmTO> list();
+
+ /**
+ * Returns realms rooted at the given path.
+ *
+ * @param fullPath full path of the root realm where to read from
+ * @return realms rooted at the given path
+ */
+ @GET
+ @Path("{fullPath:.*}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ List<RealmTO> list(@NotNull @PathParam("fullPath") String fullPath);
+
+ /**
+ * Creates a new realm under the given path.
+ *
+ * @param parentPath full path of the parent realm
+ * @param realmTO new realm.
+ * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created realm
+ */
+ @Descriptions({
+ @Description(target = DocTarget.RESPONSE,
+ value = "Featuring <tt>Location</tt> header of created realm")
+ })
+ @POST
+ @Path("{parentPath:.*}")
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ Response create(@NotNull @PathParam("parentPath") String parentPath, @NotNull RealmTO realmTO);
+
+ /**
+ * Updates the realm under the given path.
+ *
+ * @param fullPath full path of the realm
+ * @param realmTO realm to be stored
+ */
+ @PUT
+ @Path("{fullPath:.*}")
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ void update(@NotNull @PathParam("fullPath") String fullPath, @NotNull RealmTO realmTO);
+
+ /**
+ * Deletes the notification matching the given key.
+ *
+ * @param fullPath key for notification to be deleted
+ */
+ @DELETE
+ @Path("{fullPath:.*}")
+ void delete(@NotNull @PathParam("fullPath") String fullPath);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
index f5a707f..4068d63 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
@@ -19,11 +19,14 @@
package org.apache.syncope.core.logic;
import java.lang.reflect.Method;
+import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.collections4.PredicateUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
@@ -33,6 +36,7 @@ import org.apache.syncope.common.lib.to.ConnBundleTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.CollectionUtils2;
import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -45,6 +49,7 @@ import org.apache.syncope.core.provisioning.api.data.ConnInstanceDataBinder;
import org.identityconnectors.common.l10n.CurrentLocale;
import org.identityconnectors.framework.api.ConfigurationProperties;
import org.identityconnectors.framework.api.ConnectorInfo;
+import org.identityconnectors.framework.api.ConnectorInfoManager;
import org.identityconnectors.framework.api.ConnectorKey;
import org.identityconnectors.framework.common.objects.ObjectClass;
import org.springframework.beans.factory.annotation.Autowired;
@@ -134,19 +139,20 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
CurrentLocale.set(new Locale(lang));
}
- List<ConnInstance> connInstances = connInstanceDAO.findAll();
+ return CollectionUtils2.collect(connInstanceDAO.findAll(), new Transformer<ConnInstance, ConnInstanceTO>() {
- final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
+ @Override
+ public ConnInstanceTO transform(final ConnInstance input) {
+ ConnInstanceTO result = null;
+ try {
+ result = binder.getConnInstanceTO(input);
+ } catch (NotFoundException e) {
+ LOG.error("Connector '{}#{}' not found", input.getBundleName(), input.getVersion());
+ }
- for (ConnInstance connector : connInstances) {
- try {
- connInstanceTOs.add(binder.getConnInstanceTO(connector));
- } catch (NotFoundException e) {
- LOG.error("Connector '{}#{}' not found", connector.getBundleName(), connector.getVersion());
+ return result;
}
- }
-
- return connInstanceTOs;
+ }, PredicateUtils.notNullPredicate(), new ArrayList<ConnInstanceTO>());
}
@PreAuthorize("hasRole('CONNECTOR_READ')")
@@ -170,12 +176,12 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
}
List<ConnBundleTO> connectorBundleTOs = new ArrayList<>();
- for (Map.Entry<String, List<ConnectorInfo>> entry : connIdBundleManager.getConnectorInfos().entrySet()) {
- for (ConnectorInfo bundle : entry.getValue()) {
+ for (Map.Entry<URI, ConnectorInfoManager> entry : connIdBundleManager.getConnInfoManagers().entrySet()) {
+ for (ConnectorInfo bundle : entry.getValue().getConnectorInfos()) {
ConnBundleTO connBundleTO = new ConnBundleTO();
connBundleTO.setDisplayName(bundle.getConnectorDisplayName());
- connBundleTO.setLocation(entry.getKey());
+ connBundleTO.setLocation(entry.getKey().toString());
ConnectorKey key = bundle.getConnectorKey();
connBundleTO.setBundleName(key.getBundleName());
@@ -188,8 +194,6 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
connBundleTO.getProperties().add(binder.buildConnConfPropSchema(properties.getProperty(propName)));
}
- LOG.debug("Connector bundle: {}", connBundleTO);
-
connectorBundleTOs.add(connBundleTO);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java
index 312ed19..a5dc6a0 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java
@@ -22,6 +22,8 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.wrap.EntitlementTO;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.entity.Entitlement;
@@ -36,13 +38,13 @@ public class EntitlementLogic extends AbstractTransactionalLogic<EntitlementTO>
private EntitlementDAO entitlementDAO;
public List<String> getAll() {
- List<Entitlement> entitlements = entitlementDAO.findAll();
- List<String> result = new ArrayList<>(entitlements.size());
- for (Entitlement entitlement : entitlements) {
- result.add(entitlement.getKey());
- }
+ return CollectionUtils.collect(entitlementDAO.findAll(), new Transformer<Entitlement, String>() {
- return result;
+ @Override
+ public String transform(final Entitlement entitlement) {
+ return entitlement.getKey();
+ }
+ }, new ArrayList<String>());
}
public Set<String> getOwn() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
index a3fd17a..6e4604b 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
@@ -26,6 +26,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.mod.GroupMod;
@@ -35,6 +38,7 @@ import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.common.lib.CollectionUtils2;
import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
@@ -158,18 +162,22 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
@Transactional(readOnly = true)
public List<GroupTO> children(final Long groupKey) {
Group group = groupDAO.authFetch(groupKey);
+ final Set<Long> allowedGroupKeys =
+ GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
- Set<Long> allowedGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+ return CollectionUtils2.collect(groupDAO.findChildren(group), new Transformer<Group, GroupTO>() {
- List<Group> children = groupDAO.findChildren(group);
- List<GroupTO> childrenTOs = new ArrayList<>(children.size());
- for (Group child : children) {
- if (allowedGroupIds.contains(child.getKey())) {
- childrenTOs.add(binder.getGroupTO(child));
+ @Override
+ public GroupTO transform(final Group group) {
+ return binder.getGroupTO(group);
}
- }
+ }, new Predicate<Group>() {
- return childrenTOs;
+ @Override
+ public boolean evaluate(final Group group) {
+ return allowedGroupKeys.contains(group.getKey());
+ }
+ }, new ArrayList<GroupTO>());
}
@PreAuthorize("isAuthenticated()")
@@ -183,14 +191,13 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
@Transactional(readOnly = true)
@Override
public List<GroupTO> list(final int page, final int size, final List<OrderByClause> orderBy) {
- List<Group> groups = groupDAO.findAll(page, size, orderBy);
+ return CollectionUtils.collect(groupDAO.findAll(page, size, orderBy), new Transformer<Group, GroupTO>() {
- List<GroupTO> groupTOs = new ArrayList<>(groups.size());
- for (Group group : groups) {
- groupTOs.add(binder.getGroupTO(group));
- }
-
- return groupTOs;
+ @Override
+ public GroupTO transform(final Group input) {
+ return binder.getGroupTO(input);
+ }
+ }, new ArrayList<GroupTO>());
}
@PreAuthorize("isAuthenticated()")
@@ -207,16 +214,16 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
public List<GroupTO> search(final SearchCond searchCondition, final int page, final int size,
final List<OrderByClause> orderBy) {
- final List<Group> matchingGroups = searchDAO.search(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.
+ List<Group> matchingGroups = searchDAO.search(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.
getOwnedEntitlementNames()),
searchCondition, page, size, orderBy, SubjectType.GROUP);
+ return CollectionUtils.collect(matchingGroups, new Transformer<Group, GroupTO>() {
- final List<GroupTO> result = new ArrayList<>(matchingGroups.size());
- for (Group group : matchingGroups) {
- result.add(binder.getGroupTO(group));
- }
-
- return result;
+ @Override
+ public GroupTO transform(final Group input) {
+ return binder.getGroupTO(input);
+ }
+ }, new ArrayList<GroupTO>());
}
@PreAuthorize("hasRole('GROUP_CREATE')")
@@ -262,13 +269,14 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
public GroupTO delete(final Long groupKey) {
List<Group> ownedGroups = groupDAO.findOwnedByGroup(groupKey);
if (!ownedGroups.isEmpty()) {
- List<String> owned = new ArrayList<>(ownedGroups.size());
- for (Group group : ownedGroups) {
- owned.add(group.getKey() + " " + group.getName());
- }
-
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.GroupOwnership);
- sce.getElements().addAll(owned);
+ sce.getElements().addAll(CollectionUtils.collect(ownedGroups, new Transformer<Group, String>() {
+
+ @Override
+ public String transform(final Group group) {
+ return group.getKey() + " " + group.getName();
+ }
+ }, new ArrayList<String>()));
throw sce;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
index 7a0f10e..09a5d6b 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
@@ -18,12 +18,17 @@
*/
package org.apache.syncope.core.logic;
+import static org.apache.syncope.core.logic.AbstractLogic.LOG;
+
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.PredicateUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext;
@@ -42,6 +47,7 @@ import org.apache.syncope.common.lib.types.MatchingRule;
import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.common.lib.types.UnmatchingRule;
+import org.apache.syncope.common.lib.CollectionUtils2;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.LoggerDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -81,14 +87,15 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
private EntityFactory entityFactory;
private List<LoggerTO> list(final LoggerType type) {
- List<LoggerTO> result = new ArrayList<>();
- for (Logger logger : loggerDAO.findAll(type)) {
- LoggerTO loggerTO = new LoggerTO();
- BeanUtils.copyProperties(logger, loggerTO);
- result.add(loggerTO);
- }
+ return CollectionUtils.collect(loggerDAO.findAll(type), new Transformer<Logger, LoggerTO>() {
- return result;
+ @Override
+ public LoggerTO transform(final Logger logger) {
+ LoggerTO loggerTO = new LoggerTO();
+ BeanUtils.copyProperties(logger, loggerTO);
+ return loggerTO;
+ }
+ }, new ArrayList<LoggerTO>());
}
@PreAuthorize("hasRole('LOG_LIST')")
@@ -100,17 +107,20 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
@PreAuthorize("hasRole('AUDIT_LIST')")
@Transactional(readOnly = true)
public List<AuditLoggerName> listAudits() {
- List<AuditLoggerName> result = new ArrayList<>();
+ return CollectionUtils2.collect(list(LoggerType.AUDIT), new Transformer<LoggerTO, AuditLoggerName>() {
+
+ @Override
+ public AuditLoggerName transform(final LoggerTO logger) {
+ AuditLoggerName result = null;
+ try {
+ result = AuditLoggerName.fromLoggerName(logger.getKey());
+ } catch (Exception e) {
+ LOG.warn("Unexpected audit logger name: {}", logger.getKey(), e);
+ }
- for (LoggerTO logger : list(LoggerType.AUDIT)) {
- try {
- result.add(AuditLoggerName.fromLoggerName(logger.getKey()));
- } catch (Exception e) {
- LOG.warn("Unexpected audit logger name: {}", logger.getKey(), e);
+ return result;
}
- }
-
- return result;
+ }, PredicateUtils.notNullPredicate(), new ArrayList<AuditLoggerName>());
}
private void throwInvalidLogger(final LoggerType type) {
@@ -213,7 +223,7 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
@PreAuthorize("hasRole('AUDIT_LIST') or hasRole('NOTIFICATION_LIST')")
public List<EventCategoryTO> listAuditEvents() {
// use set to avoi duplications or null elements
- final Set<EventCategoryTO> events = new HashSet<EventCategoryTO>();
+ final Set<EventCategoryTO> events = new HashSet<>();
try {
final ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/NotificationLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/NotificationLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/NotificationLogic.java
index 0c7a8e2..8b8c387 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/NotificationLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/NotificationLogic.java
@@ -21,6 +21,8 @@ package org.apache.syncope.core.logic;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.to.NotificationTO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -54,14 +56,13 @@ public class NotificationLogic extends AbstractTransactionalLogic<NotificationTO
@PreAuthorize("hasRole('NOTIFICATION_LIST')")
public List<NotificationTO> list() {
- List<Notification> notifications = notificationDAO.findAll();
+ return CollectionUtils.collect(notificationDAO.findAll(), new Transformer<Notification, NotificationTO>() {
- List<NotificationTO> notificationTOs = new ArrayList<NotificationTO>();
- for (Notification notification : notifications) {
- notificationTOs.add(binder.getNotificationTO(notification));
- }
-
- return notificationTOs;
+ @Override
+ public NotificationTO transform(final Notification input) {
+ return binder.getNotificationTO(input);
+ }
+ }, new ArrayList<NotificationTO>());
}
@PreAuthorize("hasRole('NOTIFICATION_CREATE')")
@@ -113,7 +114,7 @@ public class NotificationLogic extends AbstractTransactionalLogic<NotificationTO
}
}
- if ((key != null) && !key.equals(0l)) {
+ if ((key != null) && !key.equals(0L)) {
try {
return binder.getNotificationTO(notificationDAO.find(key));
} catch (Throwable ignore) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
index c01131c..015c2a3 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
@@ -21,6 +21,8 @@ package org.apache.syncope.core.logic;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.to.AbstractPolicyTO;
import org.apache.syncope.common.lib.to.AccountPolicyTO;
@@ -89,17 +91,14 @@ public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
}
@PreAuthorize("hasRole('POLICY_LIST')")
- @SuppressWarnings("unchecked")
public <T extends AbstractPolicyTO> List<T> list(final PolicyType type) {
+ return CollectionUtils.collect(policyDAO.find(type), new Transformer<Policy, T>() {
- List<? extends Policy> policies = policyDAO.find(type);
-
- final List<T> policyTOs = new ArrayList<T>();
- for (Policy policy : policies) {
- policyTOs.add((T) binder.getPolicyTO(policy));
- }
-
- return policyTOs;
+ @Override
+ public T transform(final Policy input) {
+ return binder.getPolicyTO(input);
+ }
+ }, new ArrayList<T>());
}
@PreAuthorize("hasRole('POLICY_READ')")
@@ -173,7 +172,7 @@ public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
}
}
- if ((id != null) && !id.equals(0l)) {
+ if ((id != null) && !id.equals(0L)) {
try {
return binder.getPolicyTO(policyDAO.find(id));
} catch (Throwable ignore) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
new file mode 100644
index 0000000..1b4e857
--- /dev/null
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
@@ -0,0 +1,125 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.provisioning.api.data.RealmDataBinder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RealmLogic extends AbstractTransactionalLogic<RealmTO> {
+
+ @Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
+ private RealmDataBinder binder;
+
+ @PreAuthorize("hasRole('REALM_LIST')")
+ public List<RealmTO> list(final String fullPath) {
+ Realm realm = realmDAO.find(fullPath);
+ if (realm == null) {
+ LOG.error("Could not find realm '" + fullPath + "'");
+
+ throw new NotFoundException(fullPath);
+ }
+
+ return CollectionUtils.collect(realmDAO.findDescendants(realm), new Transformer<Realm, RealmTO>() {
+
+ @Override
+ public RealmTO transform(final Realm input) {
+ return binder.getRealmTO(input);
+ }
+ }, new ArrayList<RealmTO>());
+ }
+
+ @PreAuthorize("hasRole('REALM_CREATE')")
+ public RealmTO create(final String parentPath, final RealmTO realmTO) {
+ return binder.getRealmTO(realmDAO.save(binder.create(parentPath, realmTO)));
+ }
+
+ @PreAuthorize("hasRole('REALM_UPDATE')")
+ public RealmTO update(final RealmTO realmTO) {
+ Realm realm = realmDAO.find(realmTO.getFullPath());
+ if (realm == null) {
+ LOG.error("Could not find realm '" + realmTO.getFullPath() + "'");
+
+ throw new NotFoundException(realmTO.getFullPath());
+ }
+
+ binder.update(realm, realmTO);
+ realm = realmDAO.save(realm);
+
+ return binder.getRealmTO(realm);
+ }
+
+ @PreAuthorize("hasRole('REALM_DELETE')")
+ public RealmTO delete(final String fullPath) {
+ Realm realm = realmDAO.find(fullPath);
+ if (realm == null) {
+ LOG.error("Could not find realm '" + fullPath + "'");
+
+ throw new NotFoundException(fullPath);
+ }
+
+ RealmTO deleted = binder.getRealmTO(realm);
+ realmDAO.delete(realm);
+ return deleted;
+ }
+
+ @Override
+ protected RealmTO resolveReference(final Method method, final Object... args)
+ throws UnresolvedReferenceException {
+
+ String fullPath = null;
+
+ if (ArrayUtils.isNotEmpty(args)) {
+ for (int i = 0; fullPath == null && i < args.length; i++) {
+ if (args[i] instanceof String) {
+ fullPath = (String) args[i];
+ } else if (args[i] instanceof RealmTO) {
+ fullPath = ((RealmTO) args[i]).getFullPath();
+ }
+ }
+ }
+
+ if (fullPath != null) {
+ try {
+ return binder.getRealmTO(realmDAO.find(fullPath));
+ } catch (Throwable e) {
+ LOG.debug("Unresolved reference", e);
+ throw new UnresolvedReferenceException(e);
+ }
+ }
+
+ throw new UnresolvedReferenceException();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
index a634433..1af1929 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
@@ -36,6 +36,9 @@ import org.apache.cocoon.sax.SAXPipelineComponent;
import org.apache.cocoon.sax.component.XMLGenerator;
import org.apache.cocoon.sax.component.XMLSerializer;
import org.apache.cocoon.sax.component.XSLTTransformer;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.PredicateUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
@@ -59,6 +62,7 @@ import org.apache.syncope.core.provisioning.api.job.JobInstanceLoader;
import org.apache.syncope.core.logic.report.Reportlet;
import org.apache.syncope.core.logic.report.ReportletConfClass;
import org.apache.syncope.core.logic.report.TextSerializer;
+import org.apache.syncope.common.lib.CollectionUtils2;
import org.apache.xmlgraphics.util.MimeConstants;
import org.quartz.JobKey;
import org.quartz.Scheduler;
@@ -142,12 +146,14 @@ public class ReportLogic extends AbstractTransactionalLogic<ReportTO> {
@PreAuthorize("hasRole('REPORT_LIST')")
public List<ReportTO> list(final int page, final int size, final List<OrderByClause> orderByClauses) {
- List<Report> reports = reportDAO.findAll(page, size, orderByClauses);
- List<ReportTO> result = new ArrayList<>(reports.size());
- for (Report report : reports) {
- result.add(binder.getReportTO(report));
- }
- return result;
+ return CollectionUtils.collect(reportDAO.findAll(page, size, orderByClauses),
+ new Transformer<Report, ReportTO>() {
+
+ @Override
+ public ReportTO transform(final Report input) {
+ return binder.getReportTO(input);
+ }
+ }, new ArrayList<ReportTO>());
}
private Class<? extends ReportletConf> getReportletConfClass(final Class<Reportlet> reportletClass) {
@@ -161,35 +167,41 @@ public class ReportLogic extends AbstractTransactionalLogic<ReportTO> {
return result;
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({ "rawtypes" })
private Set<Class<Reportlet>> getAllReportletClasses() {
- Set<Class<Reportlet>> reportletClasses = new HashSet<>();
-
- for (String className : classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.REPORTLET)) {
- try {
- Class reportletClass = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader());
- reportletClasses.add(reportletClass);
- } catch (ClassNotFoundException e) {
- LOG.warn("Could not load class {}", className);
- } catch (LinkageError e) {
- LOG.warn("Could not link class {}", className);
- }
- }
- return reportletClasses;
+ return CollectionUtils2.collect(classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.REPORTLET),
+ new Transformer<String, Class<Reportlet>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<Reportlet> transform(final String className) {
+ Class<Reportlet> result = null;
+ try {
+ Class reportletClass = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader());
+ result = reportletClass;
+ } catch (ClassNotFoundException e) {
+ LOG.warn("Could not load class {}", className);
+ } catch (LinkageError e) {
+ LOG.warn("Could not link class {}", className);
+ }
+
+ return result;
+ }
+ },
+ PredicateUtils.notNullPredicate(), new HashSet<Class<Reportlet>>());
}
@PreAuthorize("hasRole('REPORT_LIST')")
public Set<String> getReportletConfClasses() {
- Set<String> reportletConfClasses = new HashSet<>();
-
- for (Class<Reportlet> reportletClass : getAllReportletClasses()) {
- Class<? extends ReportletConf> reportletConfClass = getReportletConfClass(reportletClass);
- if (reportletConfClass != null) {
- reportletConfClasses.add(reportletConfClass.getName());
- }
- }
-
- return reportletConfClasses;
+ return CollectionUtils2.collect(getAllReportletClasses(),
+ new Transformer<Class<Reportlet>, String>() {
+
+ @Override
+ public String transform(final Class<Reportlet> reportletClass) {
+ Class<? extends ReportletConf> reportletConfClass = getReportletConfClass(reportletClass);
+ return reportletConfClass == null ? null : reportletConfClass.getName();
+ }
+ }, PredicateUtils.notNullPredicate(), new HashSet<String>());
}
public Class<Reportlet> findReportletClassHavingConfClass(final Class<? extends ReportletConf> reportletConfClass) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
index baeb1ce..9a3c641 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
@@ -19,8 +19,11 @@
package org.apache.syncope.core.logic;
import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
@@ -157,7 +160,13 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
@PreAuthorize("isAuthenticated()")
@Transactional(readOnly = true)
public List<ResourceTO> list() {
- return binder.getResourceTOs(resourceDAO.findAll());
+ return CollectionUtils.collect(resourceDAO.findAll(), new Transformer<ExternalResource, ResourceTO>() {
+
+ @Override
+ public ResourceTO transform(final ExternalResource input) {
+ return binder.getResourceTO(input);
+ }
+ }, new ArrayList<ResourceTO>());
}
@PreAuthorize("hasRole('RESOURCE_GETCONNECTOROBJECT')")
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
index b6e4748..8e15c96 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
@@ -21,6 +21,8 @@ package org.apache.syncope.core.logic;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
@@ -126,7 +128,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
binder.create((PlainSchemaTO) schemaTO, normalSchema);
normalSchema = plainSchemaDAO.save(normalSchema);
- created = (T) binder.getSchemaTO(normalSchema, attrUtil);
+ created = (T) binder.getPlainSchemaTO(normalSchema, attrUtil);
}
return created;
}
@@ -162,28 +164,37 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
List<T> result;
switch (schemaType) {
case VIRTUAL:
- List<VirSchema> virSchemas = virSchemaDAO.findAll(attrUtil.virSchemaClass());
- result = new ArrayList<>(virSchemas.size());
- for (VirSchema derSchema : virSchemas) {
- result.add((T) binder.getVirSchemaTO(derSchema));
- }
+ result = CollectionUtils.collect(virSchemaDAO.findAll(attrUtil.virSchemaClass()),
+ new Transformer<VirSchema, T>() {
+
+ @Override
+ public T transform(final VirSchema input) {
+ return (T) binder.getVirSchemaTO(input);
+ }
+ }, new ArrayList<T>());
break;
case DERIVED:
- List<DerSchema> derSchemas = derSchemaDAO.findAll(attrUtil.derSchemaClass());
- result = new ArrayList<>(derSchemas.size());
- for (DerSchema derSchema : derSchemas) {
- result.add((T) binder.getDerSchemaTO(derSchema));
- }
+ result = CollectionUtils.collect(derSchemaDAO.findAll(attrUtil.derSchemaClass()),
+ new Transformer<DerSchema, T>() {
+
+ @Override
+ public T transform(final DerSchema input) {
+ return (T) binder.getDerSchemaTO(input);
+ }
+ }, new ArrayList<T>());
break;
case PLAIN:
default:
- List<PlainSchema> schemas = plainSchemaDAO.findAll(attrUtil.plainSchemaClass());
- result = new ArrayList<>(schemas.size());
- for (PlainSchema schema : schemas) {
- result.add((T) binder.getSchemaTO(schema, attrUtil));
- }
+ result = CollectionUtils.collect(plainSchemaDAO.findAll(attrUtil.plainSchemaClass()),
+ new Transformer<PlainSchema, T>() {
+
+ @Override
+ public T transform(final PlainSchema input) {
+ return (T) binder.getPlainSchemaTO(input, attrUtil);
+ }
+ }, new ArrayList<T>());
}
return result;
@@ -223,7 +234,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
throw new NotFoundException("Schema '" + schemaName + "'");
}
- read = (T) binder.getSchemaTO(schema, attrUtil);
+ read = (T) binder.getPlainSchemaTO(schema, attrUtil);
}
return read;
@@ -310,7 +321,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
result = binder.getDerSchemaTO(derSchema);
}
} else {
- result = binder.getSchemaTO(plainSchema, attrUtil);
+ result = binder.getPlainSchemaTO(plainSchema, attrUtil);
}
return result;
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java
index 102891f..b2a89ca 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java
@@ -21,6 +21,8 @@ package org.apache.syncope.core.logic;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.to.SecurityQuestionTO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -47,12 +49,14 @@ public class SecurityQuestionLogic extends AbstractTransactionalLogic<SecurityQu
@PreAuthorize("isAuthenticated()")
public List<SecurityQuestionTO> list() {
- List<SecurityQuestionTO> result = new ArrayList<>();
- for (SecurityQuestion securityQuestion : securityQuestionDAO.findAll()) {
- result.add(binder.getSecurityQuestionTO(securityQuestion));
- }
-
- return result;
+ return CollectionUtils.collect(securityQuestionDAO.findAll(),
+ new Transformer<SecurityQuestion, SecurityQuestionTO>() {
+
+ @Override
+ public SecurityQuestionTO transform(final SecurityQuestion input) {
+ return binder.getSecurityQuestionTO(input);
+ }
+ }, new ArrayList<SecurityQuestionTO>());
}
@PreAuthorize("isAuthenticated()")
@@ -136,7 +140,7 @@ public class SecurityQuestionLogic extends AbstractTransactionalLogic<SecurityQu
}
}
- if ((key != null) && !key.equals(0l)) {
+ if ((key != null) && !key.equals(0L)) {
try {
return binder.getSecurityQuestionTO(securityQuestionDAO.find(key));
} catch (Throwable ignore) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
index 7189d6e..4e51328 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
@@ -22,6 +22,8 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AbstractTaskTO;
@@ -146,15 +148,16 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
public <T extends AbstractTaskTO> List<T> list(final TaskType taskType,
final int page, final int size, final List<OrderByClause> orderByClauses) {
- TaskUtil taskUtil = taskUtilFactory.getInstance(taskType);
+ final TaskUtil taskUtil = taskUtilFactory.getInstance(taskType);
- List<Task> tasks = taskDAO.findAll(page, size, orderByClauses, taskType);
- List<T> taskTOs = new ArrayList<>(tasks.size());
- for (Task task : tasks) {
- taskTOs.add((T) binder.getTaskTO(task, taskUtil));
- }
+ return CollectionUtils.collect(taskDAO.findAll(page, size, orderByClauses, taskType),
+ new Transformer<Task, T>() {
- return taskTOs;
+ @Override
+ public T transform(final Task task) {
+ return (T) binder.getTaskTO(task, taskUtil);
+ }
+ }, new ArrayList<T>());
}
@PreAuthorize("hasRole('TASK_READ')")
@@ -236,8 +239,7 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
throw new NotFoundException("Task execution " + executionId);
}
- SyncopeClientException sce = SyncopeClientException.build(
- ClientExceptionType.InvalidPropagationTaskExecReport);
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidPropagationTaskExecReport);
TaskUtil taskUtil = taskUtilFactory.getInstance(exec.getTask());
if (TaskType.PROPAGATION == taskUtil.getType()) {
@@ -372,7 +374,7 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
}
}
- if ((key != null) && !key.equals(0l)) {
+ if ((key != null) && !key.equals(0L)) {
try {
final Task task = taskDAO.find(key);
return binder.getTaskTO(task, taskUtilFactory.getInstance(task));
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index c86525e..b67f543 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@ -24,10 +24,11 @@ import java.security.AccessControlException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.mod.AttrMod;
@@ -129,15 +130,16 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
@Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
public List<UserTO> list(final int page, final int size, final List<OrderByClause> orderBy) {
- Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+ final Set<Long> adminGroupKeys = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
- List<User> users = userDAO.findAll(adminGroupIds, page, size, orderBy);
- List<UserTO> userTOs = new ArrayList<>(users.size());
- for (User user : users) {
- userTOs.add(binder.getUserTO(user));
- }
+ return CollectionUtils.collect(userDAO.findAll(adminGroupKeys, page, size, orderBy),
+ new Transformer<User, UserTO>() {
- return userTOs;
+ @Override
+ public UserTO transform(final User input) {
+ return binder.getUserTO(input);
+ }
+ }, new ArrayList<UserTO>());
}
@PreAuthorize("isAuthenticated() "
@@ -160,15 +162,16 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
public List<UserTO> search(final SearchCond searchCondition, final int page, final int size,
final List<OrderByClause> orderBy) {
- final List<User> matchingUsers = searchDAO.search(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames()),
+ final List<User> matchingUsers = searchDAO.search(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.
+ getOwnedEntitlementNames()),
searchCondition, page, size, orderBy, SubjectType.USER);
+ return CollectionUtils.collect(matchingUsers, new Transformer<User, UserTO>() {
- final List<UserTO> result = new ArrayList<>(matchingUsers.size());
- for (User user : matchingUsers) {
- result.add(binder.getUserTO(user));
- }
-
- return result;
+ @Override
+ public UserTO transform(final User input) {
+ return binder.getUserTO(input);
+ }
+ }, new ArrayList<UserTO>());
}
@PreAuthorize("isAnonymous() or hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT)")
@@ -178,12 +181,15 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
@PreAuthorize("hasRole('USER_CREATE')")
public UserTO create(final UserTO userTO, final boolean storePassword) {
- Set<Long> requestGroupIds = new HashSet<>(userTO.getMemberships().size());
- for (MembershipTO membership : userTO.getMemberships()) {
- requestGroupIds.add(membership.getGroupId());
- }
- Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
- requestGroupIds.removeAll(adminGroupIds);
+ Collection<Long> requestGroupIds = CollectionUtils.removeAll(
+ CollectionUtils.collect(userTO.getMemberships(), new Transformer<MembershipTO, Long>() {
+
+ @Override
+ public Long transform(final MembershipTO membership) {
+ return membership.getGroupId();
+ }
+ }, new ArrayList<Long>()),
+ GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames()));
if (!requestGroupIds.isEmpty()) {
throw new UnauthorizedGroupException(requestGroupIds);
}
@@ -322,13 +328,14 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
public UserTO delete(final Long key) {
List<Group> ownedGroups = groupDAO.findOwnedByUser(key);
if (!ownedGroups.isEmpty()) {
- List<String> owned = new ArrayList<>(ownedGroups.size());
- for (Group group : ownedGroups) {
- owned.add(group.getKey() + " " + group.getName());
- }
-
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.GroupOwnership);
- sce.getElements().addAll(owned);
+ sce.getElements().addAll(CollectionUtils.collect(ownedGroups, new Transformer<Group, String>() {
+
+ @Override
+ public String transform(final Group group) {
+ return group.getKey() + " " + group.getName();
+ }
+ }, new ArrayList<String>()));
throw sce;
}
@@ -507,7 +514,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
}
}
- if ((key != null) && !key.equals(0l)) {
+ if ((key != null) && !key.equals(0L)) {
try {
return key instanceof Long ? binder.getUserTO((Long) key) : binder.getUserTO((String) key);
} catch (Throwable ignore) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/UserWorkflowLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserWorkflowLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserWorkflowLogic.java
index eb122fd..d15eef9 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserWorkflowLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserWorkflowLogic.java
@@ -112,7 +112,7 @@ public class UserWorkflowLogic extends AbstractTransactionalLogic<WorkflowFormTO
List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new AbstractMap.SimpleEntry<UserMod, Boolean>((UserMod) updated.getResult(), Boolean.TRUE),
+ new AbstractMap.SimpleEntry<>((UserMod) updated.getResult(), Boolean.TRUE),
updated.getPropByRes(),
updated.getPerformedTasks()));
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/logic/src/main/java/org/apache/syncope/core/logic/WorkflowLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/WorkflowLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/WorkflowLogic.java
index 8c6426d..c64ad84 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/WorkflowLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/WorkflowLogic.java
@@ -72,6 +72,7 @@ public class WorkflowLogic extends AbstractTransactionalLogic<AbstractBaseBean>
private void exportDiagram(final WorkflowAdapter adapter, final OutputStream os)
throws WorkflowException {
+
adapter.exportDiagram(os);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/misc/src/main/java/org/apache/syncope/core/misc/CollectionUtils2.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/CollectionUtils2.java b/core/misc/src/main/java/org/apache/syncope/core/misc/CollectionUtils2.java
deleted file mode 100644
index 44ddc5c..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/CollectionUtils2.java
+++ /dev/null
@@ -1,61 +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.misc;
-
-import java.util.Iterator;
-
-public final class CollectionUtils2 {
-
- /**
- * Returns the next element in <tt>iterator</tt> or <tt>defaultValue</tt> if the iterator is empty.
- *
- * @param defaultValue the default value to return if the iterator is empty
- * @return the next element of <tt>iterator</tt> or the default value
- */
- public static <T> T getNext(final Iterator<? extends T> iterator, final T defaultValue) {
- return iterator.hasNext() ? iterator.next() : defaultValue;
- }
-
- /**
- * Returns the first element in <tt>iterable</tt> or <tt>defaultValue</tt> if the iterable is empty.
- *
- * <p/>
- * If no default value is desired (and the caller instead wants a {@link java.util.NoSuchElementException} to be
- * thrown), it is recommended that <tt>iterable.iterator().next()}</tt> is used instead.
- *
- * @param defaultValue the default value to return if the iterable is empty
- * @return the first element of <tt>iterable</tt> or the default value
- */
- public static <T> T getFirst(final Iterable<? extends T> iterable, final T defaultValue) {
- return getNext(iterable.iterator(), defaultValue);
- }
-
- /**
- * Returns the first element in <tt>iterable</tt> or <tt>null</tt> if the iterable is empty.
- *
- * @return the first element of <tt>iterable</tt> or <tt>null</tt>
- */
- public static <T> T getFirstOrNull(final Iterable<? extends T> iterable) {
- return getNext(iterable.iterator(), null);
- }
-
- private CollectionUtils2() {
- // private constructor for static utility class
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java
index 006be64..e1a817f 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java
@@ -18,16 +18,16 @@
*/
package org.apache.syncope.core.misc.security;
+import java.util.Collection;
import java.util.Collections;
-import java.util.Set;
public class UnauthorizedGroupException extends RuntimeException {
private static final long serialVersionUID = 7540587364235915081L;
- private final Set<Long> groupIds;
+ private final Collection<Long> groupIds;
- public UnauthorizedGroupException(final Set<Long> groupIds) {
+ public UnauthorizedGroupException(final Collection<Long> groupIds) {
super("Missing entitlement for group(s) " + groupIds);
this.groupIds = groupIds;
}
@@ -36,7 +36,7 @@ public class UnauthorizedGroupException extends RuntimeException {
this(Collections.singleton(groupId));
}
- public Set<Long> getGroupIds() {
+ public Collection<Long> getGroupIds() {
return groupIds;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MalformedPathException.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MalformedPathException.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MalformedPathException.java
new file mode 100644
index 0000000..ec29738
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MalformedPathException.java
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+/**
+ * Thrown when the realm path provided is not well formed.
+ */
+public class MalformedPathException extends RuntimeException {
+
+ private static final long serialVersionUID = -164735562182120006L;
+
+ public MalformedPathException(final String path) {
+ super("Malformed path: " + path);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
new file mode 100644
index 0000000..5aa6106
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
@@ -0,0 +1,43 @@
+/*
+ * 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 java.util.List;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+
+public interface RealmDAO extends DAO<Realm, Long> {
+
+ Realm getRoot();
+
+ Realm find(Long key);
+
+ Realm find(String fullPath);
+
+ List<Realm> findChildren(Realm realm);
+
+ List<Realm> findDescendants(Realm realm);
+
+ List<Realm> findAll();
+
+ Realm save(Realm realm);
+
+ void delete(Realm realm);
+
+ void delete(Long key);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Realm.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Realm.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Realm.java
new file mode 100644
index 0000000..ab8fcac
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Realm.java
@@ -0,0 +1,41 @@
+/*
+ * 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 Realm extends Entity<Long> {
+
+ String getName();
+
+ Realm getParent();
+
+ String getFullPath();
+
+ AccountPolicy getAccountPolicy();
+
+ PasswordPolicy getPasswordPolicy();
+
+ void setName(String name);
+
+ void setParent(Realm parent);
+
+ void setAccountPolicy(AccountPolicy accountPolicy);
+
+ void setPasswordPolicy(PasswordPolicy passwordPolicy);
+
+}
[44/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
deleted file mode 100644
index 82fa875..0000000
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
+++ /dev/null
@@ -1,72 +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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.List;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class EntitlementTest extends AbstractTest {
-
- @Autowired
- private EntitlementDAO entitlementDAO;
-
- @Test
- public void findAll() {
- List<Entitlement> list = entitlementDAO.findAll();
- assertEquals("did not get expected number of entitlements ", 95, list.size());
- }
-
- @Test
- public void findByName() {
- Entitlement entitlement = entitlementDAO.find("base");
- assertNotNull("did not find expected entitlement", entitlement);
- }
-
- @Test
- public void save() {
- Entitlement entitlement = entityFactory.newEntity(Entitlement.class);
- entitlement.setKey("another");
-
- entitlementDAO.save(entitlement);
-
- Entitlement actual = entitlementDAO.find("another");
- assertNotNull("expected save to work", actual);
- assertEquals(entitlement, actual);
- }
-
- @Test
- public void delete() {
- Entitlement entitlement = entitlementDAO.find("base");
- assertNotNull("did not find expected entitlement", entitlement);
-
- entitlementDAO.delete("base");
-
- assertNull(entitlementDAO.find("base"));
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/GroupTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/GroupTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/GroupTest.java
index 2d14abe..7593b06 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/GroupTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/GroupTest.java
@@ -23,10 +23,9 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.util.List;
-import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
import org.junit.Test;
@@ -40,91 +39,30 @@ public class GroupTest extends AbstractTest {
private GroupDAO groupDAO;
@Autowired
- private PolicyDAO policyDAO;
+ private RealmDAO realmDAO;
@Test
public void findAll() {
- List<Group> list = groupDAO.findAll();
+ List<Group> list = groupDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, 1, 100);
assertEquals("did not get expected number of groups ", 14, list.size());
}
@Test
- public void findChildren() {
- assertEquals(3, groupDAO.findChildren(groupDAO.find(4L)).size());
- }
-
- @Test
public void find() {
- Group group = groupDAO.find("root", null);
+ Group group = groupDAO.find("root");
assertNotNull("did not find expected group", group);
- group = groupDAO.find(null, null);
- assertNull("found group but did not expect it", group);
- }
-
- @Test
- public void inheritedAttributes() {
- Group director = groupDAO.find(7L);
-
- assertEquals(1, director.findLastInheritedAncestorPlainAttrs().size());
- }
-
- @Test
- public void inheritedDerivedAttributes() {
- Group director = groupDAO.find(7L);
-
- assertEquals(1, director.findLastInheritedAncestorDerAttrs().size());
- }
-
- @Test
- public void inheritedVirtualAttributes() {
- Group director = groupDAO.find(7L);
-
- assertEquals(1, director.findLastInheritedAncestorVirAttrs().size());
- }
-
- @Test
- public void inheritedPolicy() {
- Group group = groupDAO.find(7L);
- assertNotNull(group);
-
- assertNotNull(group.getAccountPolicy());
- assertNotNull(group.getPasswordPolicy());
-
- assertEquals(4, group.getPasswordPolicy().getKey(), 0);
-
- group = groupDAO.find(5L);
-
- assertNotNull(group);
-
- assertNull(group.getAccountPolicy());
- assertNull(group.getPasswordPolicy());
}
@Test
public void save() {
Group group = entityFactory.newEntity(Group.class);
group.setName("secondChild");
-
- // verify inheritance password and account policies
- group.setInheritAccountPolicy(false);
- // not inherited so setter execution shouldn't be ignored
- group.setAccountPolicy((AccountPolicy) policyDAO.find(6L));
-
- group.setInheritPasswordPolicy(true);
- // inherited so setter execution should be ignored
- group.setPasswordPolicy((PasswordPolicy) policyDAO.find(4L));
-
- Group rootGroup = groupDAO.find("root", null);
- group.setParent(rootGroup);
+ group.setRealm(realmDAO.find(SyncopeConstants.ROOT_REALM));
group = groupDAO.save(group);
Group actual = groupDAO.find(group.getKey());
assertNotNull("expected save to work", actual);
-
- assertNull(group.getPasswordPolicy());
- assertNotNull(group.getAccountPolicy());
- assertEquals(Long.valueOf(6), group.getAccountPolicy().getKey());
}
@Test
@@ -134,8 +72,5 @@ public class GroupTest extends AbstractTest {
Group actual = groupDAO.find(4L);
assertNull("delete did not work", actual);
-
- Group children = groupDAO.find(7L);
- assertNull("delete of successors did not work", children);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PlainSchemaTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PlainSchemaTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PlainSchemaTest.java
index 8fc29de..27f587f 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PlainSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PlainSchemaTest.java
@@ -139,7 +139,7 @@ public class PlainSchemaTest extends AbstractTest {
public void delete() {
UPlainSchema fullnam = plainSchemaDAO.find("fullname", UPlainSchema.class);
- plainSchemaDAO.delete(fullnam.getKey(), attrUtilFactory.getInstance(AttributableType.USER));
+ plainSchemaDAO.delete(fullnam.getKey(), attrUtilsFactory.getInstance(AttributableType.USER));
UPlainSchema actual = plainSchemaDAO.find("fullname", UPlainSchema.class);
assertNull("delete did not work", actual);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
index 7c943bb..2d8a85b 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
@@ -63,23 +63,13 @@ public class PolicyTest extends AbstractTest {
assertFalse(policies.isEmpty());
}
- @Test
- public void findGlobalPasswordPolicy() {
- PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
- assertNotNull("findById did not work", policy);
-
- assertEquals(PolicyType.GLOBAL_PASSWORD, policy.getType());
-
- assertEquals("invalid policy values", 8, (policy.getSpecification(PasswordPolicySpec.class)).getMinLength());
- }
-
@Test(expected = InvalidEntityException.class)
public void saveInvalidPolicy() {
PasswordPolicySpec passwordPolicy = new PasswordPolicySpec();
passwordPolicy.setMaxLength(8);
passwordPolicy.setMinLength(6);
- SyncPolicy policy = entityFactory.newPolicy(SyncPolicy.class, false);
+ SyncPolicy policy = entityFactory.newEntity(SyncPolicy.class);
policy.setSpecification(passwordPolicy);
policy.setDescription("sync policy");
@@ -92,7 +82,7 @@ public class PolicyTest extends AbstractTest {
passwordPolicy.setMaxLength(8);
passwordPolicy.setMinLength(6);
- PasswordPolicy policy = entityFactory.newPolicy(PasswordPolicy.class, true);
+ PasswordPolicy policy = entityFactory.newEntity(PasswordPolicy.class);
policy.setSpecification(passwordPolicy);
policy.setDescription("global password policy");
@@ -101,7 +91,7 @@ public class PolicyTest extends AbstractTest {
@Test
public void create() {
- SyncPolicy policy = entityFactory.newPolicy(SyncPolicy.class, false);
+ SyncPolicy policy = entityFactory.newEntity(SyncPolicy.class);
final String syncURuleName = "net.tirasa.sync.correlation.TirasaURule";
final String syncRRuleName = "net.tirasa.sync.correlation.TirasaRRule";
@@ -127,14 +117,14 @@ public class PolicyTest extends AbstractTest {
specification.setMaxLength(8);
specification.setMinLength(6);
- Policy policy = policyDAO.getGlobalPasswordPolicy();
+ Policy policy = policyDAO.find(2L);
assertNotNull(policy);
policy.setSpecification(specification);
policy = policyDAO.save(policy);
assertNotNull(policy);
- assertEquals(PolicyType.GLOBAL_PASSWORD, policy.getType());
+ assertEquals(PolicyType.PASSWORD, policy.getType());
assertEquals((policy.getSpecification(PasswordPolicySpec.class)).getMaxLength(), 8);
assertEquals((policy.getSpecification(PasswordPolicySpec.class)).getMinLength(), 6);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
index a08a37f..811d808 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
@@ -27,6 +27,7 @@ import static org.junit.Assert.fail;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.dao.MalformedPathException;
@@ -56,9 +57,15 @@ public class RealmTest extends AbstractTest {
@Test
public void find() {
- Realm realm = realmDAO.find(3L);
+ Realm realm = realmDAO.find(1L);
+ assertNotNull(realm);
+ assertEquals(SyncopeConstants.ROOT_REALM, realm.getName());
+ assertEquals(SyncopeConstants.ROOT_REALM, realm.getFullPath());
+
+ realm = realmDAO.find(3L);
assertNotNull(realm);
assertEquals("even", realm.getName());
+ assertEquals("/even", realm.getFullPath());
assertEquals(1, realm.getParent().getKey(), 0);
assertEquals(realmDAO.getRoot(), realm.getParent());
@@ -76,7 +83,7 @@ public class RealmTest extends AbstractTest {
@Test
public void findChildren() {
- List<Realm> children = realmDAO.findChildren(realmDAO.find("/"));
+ List<Realm> children = realmDAO.findChildren(realmDAO.find(SyncopeConstants.ROOT_REALM));
assertEquals(2, children.size());
assertTrue(children.contains(realmDAO.find("/odd")));
assertTrue(children.contains(realmDAO.find("/even")));
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java
index b4830cf..a7bf883 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java
@@ -24,20 +24,12 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import java.util.Collections;
import java.util.List;
-import org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.types.Entitlement;
-import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.misc.search.SearchCondConverter;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.dao.RoleDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
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.jpa.AbstractTest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -50,9 +42,6 @@ public class RoleTest extends AbstractTest {
private RoleDAO roleDAO;
@Autowired
- private EntitlementDAO entitlementDAO;
-
- @Autowired
private SubjectSearchDAO searchDAO;
@Autowired
@@ -63,10 +52,6 @@ public class RoleTest extends AbstractTest {
Role role1 = roleDAO.find(2L);
assertNotNull(role1);
assertNotNull(role1.getName());
- assertFalse(searchDAO.<User>search(
- GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
- SearchCondConverter.convert(role1.getCriteria()),
- Collections.<OrderByClause>emptyList(), SubjectType.USER).isEmpty());
assertFalse(role1.getRealms().isEmpty());
assertFalse(role1.getEntitlements().isEmpty());
assertTrue(role1.getEntitlements().contains(Entitlement.USER_LIST));
@@ -89,7 +74,6 @@ public class RoleTest extends AbstractTest {
public void save() {
Role role = entityFactory.newEntity(Role.class);
role.setName("new");
- role.setCriteria(new UserFiqlSearchConditionBuilder().inGroups(2L).query());
role.addRealm(realmDAO.getRoot());
role.addRealm(realmDAO.find("/even/two"));
role.getEntitlements().add(Entitlement.LOG_LIST);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
index f4a8298..29fbc4c 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
@@ -25,17 +25,16 @@ import static org.junit.Assert.fail;
import java.util.Date;
import java.util.List;
-import java.util.Set;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
import org.apache.syncope.core.misc.policy.InvalidPasswordPolicySpecException;
import org.apache.syncope.core.misc.security.PasswordGenerator;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@@ -50,39 +49,37 @@ public class UserTest extends AbstractTest {
private UserDAO userDAO;
@Autowired
- private EntitlementDAO entitlementDAO;
+ private RealmDAO realmDAO;
@Test
public void findAll() {
- List<User> list = userDAO.findAll(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), 1, 100);
+ List<User> list = userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, 1, 100);
assertEquals("did not get expected number of users ", 5, list.size());
}
@Test
public void count() {
- Integer count = userDAO.count(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()));
+ Integer count = userDAO.count(SyncopeConstants.FULL_ADMIN_REALMS);
assertNotNull(count);
- assertEquals(5, count.intValue());
+ assertEquals(5, count, 0);
}
@Test
public void findAllByPageAndSize() {
- Set<Long> allGroupKeys = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
-
// get first page
- List<User> list = userDAO.findAll(allGroupKeys, 1, 2);
+ List<User> list = userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, 1, 2);
assertEquals("did not get expected number of users ", 2, list.size());
// get second page
- list = userDAO.findAll(allGroupKeys, 2, 2);
+ list = userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, 2, 2);
assertEquals("did not get expected number of users ", 2, list.size());
// get second page with uncomplete set
- list = userDAO.findAll(allGroupKeys, 2, 3);
+ list = userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, 2, 3);
assertEquals("did not get expected number of users ", 2, list.size());
// get unexistent page
- list = userDAO.findAll(allGroupKeys, 3, 2);
+ list = userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, 3, 2);
assertEquals("did not get expected number of users ", 1, list.size());
}
@@ -144,29 +141,28 @@ public class UserTest extends AbstractTest {
public void save() {
User user = entityFactory.newEntity(User.class);
user.setUsername("username");
+ user.setRealm(realmDAO.find("/even/two"));
user.setCreationDate(new Date());
user.setPassword("pass", CipherAlgorithm.SHA256);
- Throwable t = null;
try {
userDAO.save(user);
+ fail();
} catch (InvalidEntityException e) {
- t = e;
+ assertNotNull(e);
}
- assertNotNull(t);
user.setPassword("password", CipherAlgorithm.SHA256);
user.setUsername("username!");
- t = null;
try {
userDAO.save(user);
+ fail();
} catch (InvalidEntityException e) {
- t = e;
+ assertNotNull(e);
}
- assertNotNull(t);
user.setUsername("username");
@@ -189,6 +185,7 @@ public class UserTest extends AbstractTest {
public void issue237() {
User user = entityFactory.newEntity(User.class);
user.setUsername("username");
+ user.setRealm(realmDAO.find("/even/two"));
user.setCreationDate(new Date());
user.setPassword("password", CipherAlgorithm.AES);
@@ -202,15 +199,9 @@ public class UserTest extends AbstractTest {
User user = entityFactory.newEntity(User.class);
user.setUsername("username");
user.setPassword(null, CipherAlgorithm.AES);
+ user.setRealm(realmDAO.find("/even/two"));
- User actual = null;
- Throwable t = null;
- try {
- actual = userDAO.save(user);
- } catch (InvalidEntityException e) {
- t = e;
- }
- assertNull(t);
+ User actual = userDAO.save(user);
assertNull(user.getPassword());
assertNotNull(actual);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirSchemaTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirSchemaTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirSchemaTest.java
index f52e064..919f787 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirSchemaTest.java
@@ -72,7 +72,7 @@ public class VirSchemaTest extends AbstractTest {
public void delete() {
UVirSchema virtualdata = virSchemaDAO.find("virtualdata", UVirSchema.class);
- virSchemaDAO.delete(virtualdata.getKey(), attrUtilFactory.getInstance(AttributableType.USER));
+ virSchemaDAO.delete(virtualdata.getKey(), attrUtilsFactory.getInstance(AttributableType.USER));
VirSchema actual = virSchemaDAO.find("virtualdata", UVirSchema.class);
assertNull("delete did not work", actual);
@@ -81,7 +81,7 @@ public class VirSchemaTest extends AbstractTest {
GVirSchema rvirtualdata = virSchemaDAO.find("rvirtualdata", GVirSchema.class);
assertNotNull(rvirtualdata);
- virSchemaDAO.delete(rvirtualdata.getKey(), attrUtilFactory.getInstance(AttributableType.GROUP));
+ virSchemaDAO.delete(rvirtualdata.getKey(), attrUtilsFactory.getInstance(AttributableType.GROUP));
actual = virSchemaDAO.find("rvirtualdata", GVirSchema.class);
assertNull("delete did not work", actual);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttrTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttrTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttrTest.java
index 7cb2196..6c99465 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttrTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttrTest.java
@@ -124,7 +124,7 @@ public class AttrTest extends AbstractTest {
MPlainAttr attr = entityFactory.newEntity(MPlainAttr.class);
attr.setTemplate(template);
attr.setOwner(membership);
- attr.addValue("yellow", attrUtilFactory.getInstance(AttributableType.MEMBERSHIP));
+ attr.addValue("yellow", attrUtilsFactory.getInstance(AttributableType.MEMBERSHIP));
membership.addPlainAttr(attr);
MPlainAttr actualAttribute = userDAO.save(user).getMembership(1L).getPlainAttr("color");
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttributableSearchTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttributableSearchTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttributableSearchTest.java
index 34338ce..02f86de 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttributableSearchTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttributableSearchTest.java
@@ -25,9 +25,8 @@ import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
@@ -48,12 +47,9 @@ public class AttributableSearchTest extends AbstractTest {
@Autowired
private SubjectSearchDAO searchDAO;
- @Autowired
- private EntitlementDAO entitlementDAO;
-
@Test
public void issueSYNCOPE95() {
- Set<Group> groups = new HashSet<>(groupDAO.findAll());
+ Set<Group> groups = new HashSet<>(groupDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, 1, 100));
for (Group group : groups) {
groupDAO.delete(group.getKey());
}
@@ -67,7 +63,7 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(cond.isValid());
final List<User> users =
- searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
+ searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS, cond, SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/DerSchemaTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/DerSchemaTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/DerSchemaTest.java
index e96a9e5..92b016e 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/DerSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/DerSchemaTest.java
@@ -47,7 +47,7 @@ public class DerSchemaTest extends AbstractTest {
public void test() {
UDerSchema schema = derSchemaDAO.find("cn", UDerSchema.class);
- derSchemaDAO.delete(schema.getKey(), attrUtilFactory.getInstance(AttributableType.USER));
+ derSchemaDAO.delete(schema.getKey(), attrUtilsFactory.getInstance(AttributableType.USER));
derSchemaDAO.flush();
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/EntitlementTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/EntitlementTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/EntitlementTest.java
deleted file mode 100644
index b1f2eb1..0000000
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/EntitlementTest.java
+++ /dev/null
@@ -1,57 +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.relationship;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class EntitlementTest extends AbstractTest {
-
- @Autowired
- private EntitlementDAO entitlementDAO;
-
- @Autowired
- private GroupDAO groupDAO;
-
- @Test
- public void delete() {
- Entitlement entitlement = entitlementDAO.find("base");
- assertNotNull("did not find expected entitlement", entitlement);
-
- List<Group> groups = groupDAO.findByEntitlement(entitlement);
- assertEquals("expected two groups", 2, groups.size());
-
- entitlementDAO.delete("base");
-
- groups = groupDAO.findByEntitlement(entitlement);
- assertTrue(groups.isEmpty());
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/GroupTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/GroupTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/GroupTest.java
index 80a6f7e..251296a 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/GroupTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/GroupTest.java
@@ -26,14 +26,11 @@ import static org.junit.Assert.assertTrue;
import java.util.List;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
import org.apache.syncope.core.persistence.api.dao.PlainAttrValueDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
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.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
@@ -62,15 +59,9 @@ public class GroupTest extends AbstractTest {
@Autowired
private PlainAttrValueDAO plainAttrValueDAO;
- @Autowired
- private EntitlementDAO entitlementDAO;
-
- @Autowired
- private PolicyDAO policyDAO;
-
@Test(expected = InvalidEntityException.class)
public void saveWithTwoOwners() {
- Group root = groupDAO.find("root", null);
+ Group root = groupDAO.find("root");
assertNotNull("did not find expected group", root);
User user = userDAO.find(1L);
@@ -94,39 +85,10 @@ public class GroupTest extends AbstractTest {
assertEquals(user, group.getUserOwner());
- Group child1 = groupDAO.find(7L);
- assertNotNull(child1);
- assertEquals(group, child1.getParent());
-
- Group child2 = groupDAO.find(10L);
- assertNotNull(child2);
- assertEquals(group, child2.getParent());
-
List<Group> ownedGroups = groupDAO.findOwnedByUser(user.getKey());
assertFalse(ownedGroups.isEmpty());
- assertEquals(2, ownedGroups.size());
+ assertEquals(1, ownedGroups.size());
assertTrue(ownedGroups.contains(group));
- assertTrue(ownedGroups.contains(child1));
- assertFalse(ownedGroups.contains(child2));
- }
-
- public void createWithPasswordPolicy() {
- PasswordPolicy policy = (PasswordPolicy) policyDAO.find(4L);
- Group group = entityFactory.newEntity(Group.class);
- group.setName("groupWithPasswordPolicy");
- group.setPasswordPolicy(policy);
-
- Group actual = groupDAO.save(group);
- assertNotNull(actual);
-
- actual = groupDAO.find(actual.getKey());
- assertNotNull(actual);
- assertNotNull(actual.getPasswordPolicy());
-
- groupDAO.delete(actual.getKey());
- assertNull(groupDAO.find(actual.getKey()));
-
- assertNotNull(policyDAO.find(4L));
}
@Test
@@ -136,7 +98,6 @@ public class GroupTest extends AbstractTest {
groupDAO.flush();
assertNull(groupDAO.find(2L));
- assertEquals(1, groupDAO.findByEntitlement(entitlementDAO.find("base")).size());
assertEquals(userDAO.find(2L).getGroups().size(), 2);
assertNull(plainAttrDAO.find(700L, GPlainAttr.class));
assertNull(plainAttrValueDAO.find(41L, GPlainAttrValue.class));
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/PlainSchemaTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/PlainSchemaTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/PlainSchemaTest.java
index a66843e..f697692 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/PlainSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/PlainSchemaTest.java
@@ -85,7 +85,7 @@ public class PlainSchemaTest extends AbstractTest {
assertFalse(mapItems.isEmpty());
// delete user schema fullname
- plainSchemaDAO.delete("fullname", attrUtilFactory.getInstance(AttributableType.USER));
+ plainSchemaDAO.delete("fullname", attrUtilsFactory.getInstance(AttributableType.USER));
plainSchemaDAO.flush();
@@ -134,7 +134,7 @@ public class PlainSchemaTest extends AbstractTest {
assertFalse(mappings.isEmpty());
// delete user schema fullname
- plainSchemaDAO.delete("surname", attrUtilFactory.getInstance(AttributableType.USER));
+ plainSchemaDAO.delete("surname", attrUtilsFactory.getInstance(AttributableType.USER));
plainSchemaDAO.flush();
@@ -147,7 +147,7 @@ public class PlainSchemaTest extends AbstractTest {
public void deleteALong() {
assertEquals(6, resourceDAO.find("resource-db-sync").getUmapping().getItems().size());
- plainSchemaDAO.delete("aLong", attrUtilFactory.getInstance(AttributableType.USER));
+ plainSchemaDAO.delete("aLong", attrUtilsFactory.getInstance(AttributableType.USER));
assertNull(plainSchemaDAO.find("aLong", UPlainSchema.class));
plainSchemaDAO.flush();
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/resources/content.xml b/core/persistence-jpa/src/test/resources/content.xml
index 4a52eb2..685b2d2 100644
--- a/core/persistence-jpa/src/test/resources/content.xml
+++ b/core/persistence-jpa/src/test/resources/content.xml
@@ -18,30 +18,6 @@ specific language governing permissions and limitations
under the License.
-->
<dataset>
- <Realm id="1" name="/"/>
- <Realm id="2" name="odd" parent_id="1"/>
- <Realm id="3" name="even" parent_id="1"/>
- <Realm id="4" name="two" parent_id="3"/>
-
- <SyncopeRole id="1" name="User reviewer" criteria="fullname==*o*;fullname==*i*"/>
- <SyncopeRole_entitlements entitlement="USER_READ" role_id="1"/>
- <SyncopeRole_entitlements entitlement="USER_LIST" role_id="1"/>
- <SyncopeRole_Realm role_id="1" realm_id="2"/>
- <SyncopeRole_Realm role_id="1" realm_id="3"/>
-
- <SyncopeRole id="2" name="User manager" criteria="username==rossini"/>
- <SyncopeRole_entitlements entitlement="USER_READ" role_id="2"/>
- <SyncopeRole_entitlements entitlement="USER_LIST" role_id="2"/>
- <SyncopeRole_entitlements entitlement="WORKFLOW_FORM_CLAIM" role_id="2"/>
- <SyncopeRole_entitlements entitlement="WORKFLOW_FORM_SUBMIT" role_id="2"/>
- <SyncopeRole_Realm role_id="2" realm_id="4"/>
-
- <SyncopeRole id="3" name="Other" criteria="id=gt=2;id=le=4"/>
- <SyncopeRole_entitlements entitlement="SCHEMA_READ" role_id="3"/>
- <SyncopeRole_entitlements entitlement="GROUP_READ" role_id="3"/>
- <SyncopeRole_entitlements entitlement="WORKFLOW_FORM_CLAIM" role_id="3"/>
- <SyncopeRole_Realm role_id="3" realm_id="2"/>
-
<SyncopeConf id="1"
creator="admin" lastModifier="admin"
creationDate="2014-06-20 11:00:00" lastChangeDate="2014-06-20 11:00:00"/>
@@ -115,18 +91,18 @@ under the License.
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
<!-- sample policies -->
- <Policy DTYPE="SyncPolicy" id="1" description="global sync policy" type="GLOBAL_SYNC"
+ <Policy DTYPE="SyncPolicy" id="1" description="a sync policy" type="SYNC"
specification='{"userJavaRule":null,"groupJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"groupAltSearchSchemas":[]}'/>
- <Policy DTYPE="PasswordPolicy" id="2" description="global password policy" type="GLOBAL_PASSWORD"
+ <Policy DTYPE="PasswordPolicy" id="2" description="a password policy" type="PASSWORD"
specification='{"historyLength":1,"maxLength":0,"minLength":8,"nonAlphanumericRequired":false,"alphanumericRequired":false,"digitRequired":false,"lowercaseRequired":false,"uppercaseRequired":false,"mustStartWithDigit":false,"mustntStartWithDigit":false,"mustEndWithDigit":false,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[],"allowNullPassword":true}'/>
<Policy DTYPE="SyncPolicy" id="3" description="sync policy 2" type="SYNC"
specification='{"userJavaRule":null,"groupJavaRule":null,"conflictResolutionAction":"ALL","userAltSearchSchemas":["username","firstname"],"groupAltSearchSchemas":[]}'/>
<Policy DTYPE="PasswordPolicy" id="4" description="sample password policy" type="PASSWORD"
- specification='{"historyLength":0,"maxLength":0,"minLength":10,"nonAlphanumericRequired":false,"alphanumericRequired":false,"digitRequired":true,"lowercaseRequired":false,"uppercaseRequired":false,"mustStartWithDigit":false,"mustntStartWithDigit":false,"mustEndWithDigit":false,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[], "allowNullPassword":false}'/>
- <Policy DTYPE="AccountPolicy" id="5" description="global account policy" type="GLOBAL_ACCOUNT"
- specification='{"maxLength":0,"minLength":0,"pattern":null,"allUpperCase":false,"allLowerCase":false,"propagateSuspension":false,"permittedLoginRetries":0,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":[],"suffixesNotPermitted":[]}'/>
+ specification='{"historyLength":0,"maxLength":0,"minLength":10,"nonAlphanumericRequired":false,"alphanumericRequired":false,"digitRequired":true,"lowercaseRequired":false,"uppercaseRequired":false,"mustStartWithDigit":false,"mustntStartWithDigit":false,"mustEndWithDigit":false,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[], "allowNullPassword":true}'/>
+ <Policy DTYPE="AccountPolicy" id="5" description="an account policy" type="ACCOUNT"
+ specification='{"maxLength":0,"minLength":0,"pattern":null,"allUpperCase":false,"allLowerCase":false,"propagateSuspension":false,"maxAuthenticationAttempts":0,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":[],"suffixesNotPermitted":[]}'/>
<Policy DTYPE="AccountPolicy" id="6" description="sample account policy" type="ACCOUNT"
- specification='{"maxLength":0,"minLength":4,"pattern":null,"allUpperCase":false,"allLowerCase":false,"propagateSuspension":false,"permittedLoginRetries":3,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[]}'/>
+ specification='{"maxLength":0,"minLength":4,"pattern":null,"allUpperCase":false,"allLowerCase":false,"propagateSuspension":false,"maxAuthenticationAttempts":3,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[]}'/>
<Policy DTYPE="SyncPolicy" id="7" description="sync policy 1" type="SYNC"
specification='{"userJavaRule":null,"groupJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"groupAltSearchSchemas":[]}'/>
<Policy DTYPE="PasswordPolicy" id="8" description="sample password policy" type="PASSWORD"
@@ -134,81 +110,110 @@ under the License.
<Policy DTYPE="SyncPolicy" id="9" description="sync policy for java rule" type="SYNC"
specification='{"userJavaRule":null,"groupJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"groupAltSearchSchemas":[]}'/>
+ <Realm id="1" name="/" passwordPolicy_id="4"/>
+ <Realm id="2" name="odd" parent_id="1" accountPolicy_id="6"/>
+ <Realm id="3" name="even" parent_id="1"/>
+ <Realm id="4" name="two" parent_id="3" accountPolicy_id="5" passwordPolicy_id="2"/>
+
+ <SyncopeRole id="1" name="User reviewer"/>
+ <SyncopeRole_entitlements entitlement="USER_READ" role_id="1"/>
+ <SyncopeRole_entitlements entitlement="USER_LIST" role_id="1"/>
+ <SyncopeRole_entitlements entitlement="USER_SEARCH" role_id="1"/>
+ <SyncopeRole_Realm role_id="1" realm_id="2"/>
+ <SyncopeRole_Realm role_id="1" realm_id="3"/>
+
+ <SyncopeRole id="2" name="User manager"/>
+ <SyncopeRole_entitlements entitlement="USER_READ" role_id="2"/>
+ <SyncopeRole_entitlements entitlement="USER_LIST" role_id="2"/>
+ <SyncopeRole_entitlements entitlement="USER_SEARCH" role_id="2"/>
+ <SyncopeRole_entitlements entitlement="WORKFLOW_FORM_CLAIM" role_id="2"/>
+ <SyncopeRole_entitlements entitlement="WORKFLOW_FORM_SUBMIT" role_id="2"/>
+ <SyncopeRole_Realm role_id="2" realm_id="1"/>
+
+ <SyncopeRole id="3" name="Other"/>
+ <SyncopeRole_entitlements entitlement="SCHEMA_READ" role_id="3"/>
+ <SyncopeRole_entitlements entitlement="GROUP_READ" role_id="3"/>
+ <SyncopeRole_entitlements entitlement="WORKFLOW_FORM_CLAIM" role_id="3"/>
+ <SyncopeRole_Realm role_id="3" realm_id="2"/>
+
<SyncopeUser id="1" workflowId="4" status="active" password="5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8" cipherAlgorithm="SHA1"
+ realm_id="1"
username="rossini" creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00" suspended="0"/>
+ <SyncopeUser_SyncopeRole user_id="1" role_id="3"/>
<SyncopeUser id="2" workflowId="6" status="active" password="5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8" cipherAlgorithm="SHA1"
+ realm_id="1"
username="verdi" creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00" suspended="0"/>
+ <SyncopeUser_SyncopeRole user_id="2" role_id="1"/>
<SyncopeUser id="3" workflowId="8" status="active" password="5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8" cipherAlgorithm="SHA1"
+ realm_id="1"
username="vivaldi" creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00" suspended="0"/>
<SyncopeUser id="4" workflowId="10" status="active" password="5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8" cipherAlgorithm="SHA1"
+ realm_id="1"
username="bellini" creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00" suspended="0"/>
+ <SyncopeUser_SyncopeRole user_id="4" role_id="2"/>
<SyncopeUser id="5" workflowId="12" status="active" password="5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8" cipherAlgorithm="SHA1"
+ realm_id="1"
username="puccini" creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00" suspended="0"/>
-
+
<SyncopeGroup id="1" name="root"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="2" name="child" parent_id="1"
+ <SyncopeGroup id="2" name="child"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="3" name="citizen"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="4" name="employee" parent_id="3"
+ <SyncopeGroup id="4" name="employee"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="5" name="secretary" parent_id="4"
+ <SyncopeGroup id="5" name="secretary"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="6"
- name="director" parent_id="4" userOwner_id="5"
- inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
- inheritPasswordPolicy="0" inheritAccountPolicy="0"
- passwordPolicy_id="4"
- accountPolicy_id="6"
+ <SyncopeGroup id="6" name="director" userOwner_id="5"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="7"
- name="managingDirector" parent_id="6"
- inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
- inheritPasswordPolicy="1" inheritAccountPolicy="1" inheritOwner="1"
+ <SyncopeGroup id="7" name="managingDirector"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="8"
- name="otherchild" parent_id="1"
- inheritVirAttrs="1"
- passwordPolicy_id="4"
+ <SyncopeGroup id="8" name="otherchild"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="9" name="groupForWorkflowApproval" parent_id="1"
+ <SyncopeGroup id="9" name="groupForWorkflowApproval"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="10"
- name="managingConsultant" parent_id="6"
- inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
- inheritPasswordPolicy="1" inheritAccountPolicy="1" inheritOwner="0"
+ <SyncopeGroup id="10" name="managingConsultant"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="11" name="groupForWorkflowOptIn" parent_id="1"
+ <SyncopeGroup id="11" name="groupForWorkflowOptIn"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="12" name="aGroupForPropagation" parent_id="1"
+ <SyncopeGroup id="12" name="aGroupForPropagation"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="13" name="bGroupForPropagation" parent_id="1"
+ <SyncopeGroup id="13" name="bGroupForPropagation"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeGroup id="14"
- name="artDirector" parent_id="4"
- inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
- inheritPasswordPolicy="0" inheritAccountPolicy="0"
- passwordPolicy_id="8"
- accountPolicy_id="6"
+ <SyncopeGroup id="14" name="artDirector"
+ realm_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
@@ -667,7 +672,7 @@ under the License.
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <!-- Use resource-testdb for passthrough authentication (SYNCOPE-164) in the global account policy -->
+ <!-- Use resource-testdb for passthrough authentication (SYNCOPE-164) -->
<Policy_ExternalResource account_policy_id="5" resource_name="resource-testdb"/>
<SyncopeUser_ExternalResource user_id="1" resource_name="resource-testdb2"/>
@@ -926,36 +931,36 @@ under the License.
objectClassName="__ACCOUNT__" resource_name="ws-target-resource-2" subjectType="USER" subjectId="1"
xmlAttributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"type","value":["type"]}]'/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="4" name="CSV (update matching; assign unmatching)" resource_name="resource-csv"
- performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
+ destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="ASSIGN" matchingRule="UPDATE"
- userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[{"schema":"type","readonly":false,"values":["email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'"]}],"derivedAttributes":[{"schema":"cn","readonly":false,"values":[null]}],"virtualAttributes":[],"resources":["resource-testdb"],"propagationStatuses":[],"memberships":[{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"groupId":8,"groupName":null,"attributes":[{"schema":"subscriptionDate","readonly":false,"values":["'2009-08-18T16:33:12.203+0200'"]}],"derivedAttributes":[],"virtualAttributes":[]}]}'
- groupTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":0,"userOwner":null,"groupOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"gPlainAttrTemplates":[],"gDerAttrTemplates":[],"gVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
+ userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"plainAttrs":[{"schema":"type","readonly":false,"values":["email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'"]}],"derAttrs":[{"schema":"cn","readonly":false,"values":[null]}],"virAttrs":[],"resources":["resource-testdb"],"propagationStatuses":[],"memberships":[{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"groupKey":8,"groupName":null,"plainAttrs":[{"schema":"subscriptionDate","readonly":false,"values":["'2009-08-18T16:33:12.203+0200'"]}],"derAttrs":[],"virAttrs":[]}]}'
+ groupTemplate='{"creator": null,"creationDate": null,"lastModifier": null,"lastChangeDate": null,"key": 0,"name": null,"userOwner": null,"groupOwner": null,"plainAttrs": [], "derAttrs": [],"virAttrs": [],"resources": [],"propagationStatuses": [],"gPlainAttrTemplates": [],"gDerAttrTemplates": [],"gVirAttrTemplates": [],"mPlainAttrTemplates": [],"mDerAttrTemplates": [],"mVirAttrTemplates": []}'/>
<Task DTYPE="SchedTask" type="SCHEDULED" id="5" name="SampleJob Task" jobClassName="org.apache.syncope.core.provisioning.java.job.SampleJob" cronExpression="0 0 0 1 * ?"/>
<Task DTYPE="PropagationTask" type="PROPAGATION" id="6" propagationMode="TWO_PHASES" propagationOperation="UPDATE"
objectClassName="__ACCOUNT__" resource_name="ws-target-resource-nopropagation" subjectType="USER" subjectId="1"
xmlAttributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"fullname","value":["fullname"]},{"name":"type","value":["type"]}]'/>
<TaskExec id="6" task_id="6" status="SUCCESS"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="7" name="TestDB Task" resource_name="resource-testdb"
- performCreate="1" performUpdate="1" performDelete="0" syncStatus="1" fullReconciliation="1"
+ destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="0" syncStatus="1" fullReconciliation="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="PROVISION" matchingRule="UPDATE"
- userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[{"schema":"type","readonly":false,"values":["'type a'"]},{"schema":"userId","readonly":false,"values":["'reconciled@syncope.apache.org'"]},{"schema":"fullname","readonly":false,"values":["'reconciled fullname'"]},{"schema":"surname","readonly":false,"values":["'surname'"]}],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"memberships":[]}'
- groupTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":0,"userOwner":null,"groupOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"gPlainAttrTemplates":[],"gDerAttrTemplates":[],"gVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
+ userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"plainAttrs":[{"schema":"type","readonly":false,"values":["'type a'"]},{"schema":"userId","readonly":false,"values":["'reconciled@syncope.apache.org'"]},{"schema":"fullname","readonly":false,"values":["'reconciled fullname'"]},{"schema":"surname","readonly":false,"values":["'surname'"]}],"derAttrs":[],"virAttrs":[],"resources":[],"propagationStatuses":[],"memberships":[]}'
+ groupTemplate='{"creator": null,"creationDate": null,"lastModifier": null,"lastChangeDate": null,"key": 0,"name": null,"userOwner": null,"groupOwner": null,"plainAttrs": [], "derAttrs": [],"virAttrs": [],"resources": [],"propagationStatuses": [],"gPlainAttrTemplates": [],"gDerAttrTemplates": [],"gVirAttrTemplates": [],"mPlainAttrTemplates": [],"mDerAttrTemplates": [],"mVirAttrTemplates": []}'/>
<Task DTYPE="NotificationTask" type="NOTIFICATION" id="8" sender="admin@prova.org" subject="Notification for SYNCOPE-81"
textBody="NOTIFICATION-81" htmlBody="NOTIFICATION-81" traceLevel="ALL"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="9" name="TestDB2 Task" resource_name="resource-testdb2"
- performCreate="1" performUpdate="1" performDelete="0" syncStatus="1" fullReconciliation="1"
+ destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="0" syncStatus="1" fullReconciliation="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="PROVISION" matchingRule="UPDATE"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="10" name="TestDB Sync Task" resource_name="resource-db-sync"
- fullReconciliation="1" performCreate="1" performDelete="1" performUpdate="1" syncStatus="0"
+ destinationRealm_id="1" fullReconciliation="1" performCreate="1" performDelete="1" performUpdate="1" syncStatus="0"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="PROVISION" matchingRule="UPDATE"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="11" name="LDAP Sync Task" resource_name="resource-ldap"
- fullReconciliation="1" performCreate="1" performDelete="1" performUpdate="1" syncStatus="0"
+ destinationRealm_id="1" fullReconciliation="1" performCreate="1" performDelete="1" performUpdate="1" syncStatus="0"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="PROVISION" matchingRule="UPDATE"
- userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[{"schema":"virtualReadOnly","readonly":false,"values":[""]}],"resources":["resource-ldap"],"propagationStatuses":[],"memberships":[]}'
- groupTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":8,"userOwner":null,"groupOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[{"schema":"show","readonly":false,"values":["'true'"]}],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"gPlainAttrTemplates":["show"],"gDerAttrTemplates":[],"gVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
+ userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"plainAttrs":[],"derAttrs":[],"virAttrs":[{"schema":"virtualReadOnly","readonly":false,"values":[""]}],"resources":["resource-ldap"],"propagationStatuses":[],"memberships":[]}'
+ groupTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"realm":null,"name":null,"userOwner":null,"groupOwner":null,"derAttrs":[],"virAttrs":[],"resources":[],"propagationStatuses":[],"gPlainAttrTemplates":["show"],"gDerAttrTemplates":[],"gVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[],"plainAttrs":[{"schema":"show","readonly":false,"values":["true"]}]}'/>
<SyncTask_actionsClassNames SyncTask_id="11" actionClassName="org.apache.syncope.core.provisioning.java.sync.LDAPMembershipSyncActions"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="12" name="VirAttrCache test" resource_name="resource-csv"
- performCreate="0" performUpdate="1" performDelete="0" syncStatus="0" fullReconciliation="1"
+ destinationRealm_id="1" performCreate="0" performUpdate="1" performDelete="0" syncStatus="0" fullReconciliation="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="PROVISION" matchingRule="UPDATE"/>
<Task DTYPE="PushTask" type="PUSH" id="13" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
@@ -1002,15 +1007,15 @@ under the License.
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="ASSIGN" matchingRule="UNLINK"
userFilter="username==_NO_ONE_" groupFilter="name==citizen"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="24" name="CSV Task (update matching; provision unmatching)" resource_name="resource-csv"
- performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
+ destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="PROVISION" matchingRule="UPDATE"
- userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[{"schema":"firstname","readonly":false,"values":[""]},{"schema":"userId","readonly":false,"values":["'test'"]},{"schema":"fullname","readonly":false,"values":["'test'"]},{"schema":"surname","readonly":false,"values":["'test'"]}],"derivedAttributes":[],"virtualAttributes":[],"resources":["resource-testdb"],"propagationStatuses":[],"memberships":[]}'
- groupTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":0,"userOwner":null,"groupOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"gPlainAttrTemplates":[],"gDerAttrTemplates":[],"gVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
+ userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"plainAttrs":[{"schema":"firstname","readonly":false,"values":[""]},{"schema":"userId","readonly":false,"values":["'test'"]},{"schema":"fullname","readonly":false,"values":["'test'"]},{"schema":"surname","readonly":false,"values":["'test'"]}],"derAttrs":[],"virAttrs":[],"resources":["resource-testdb"],"propagationStatuses":[],"memberships":[]}'
+ groupTemplate='{"creator": null,"creationDate": null,"lastModifier": null,"lastChangeDate": null,"key": 0,"name": null,"userOwner": null,"groupOwner": null,"plainAttrs": [], "derAttrs": [],"virAttrs": [],"resources": [],"propagationStatuses": [],"gPlainAttrTemplates": [],"gDerAttrTemplates": [],"gVirAttrTemplates": [],"mPlainAttrTemplates": [],"mDerAttrTemplates": [],"mVirAttrTemplates": []}'/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="25" name="CSV (unlink matching; ignore unmatching)" resource_name="resource-csv"
- performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
+ destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="IGNORE" matchingRule="UNLINK"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="26" name="CSV (ignore matching; assign unmatching)" resource_name="resource-csv"
- performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
+ destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="ASSIGN" matchingRule="IGNORE"/>
<Notification id="1" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1"
@@ -1035,124 +1040,10 @@ under the License.
<Report id="1" name="test"/>
<ReportletConfInstance id="1" Report_id="1"
- serializedInstance='{"@class":"org.apache.syncope.common.lib.report.UserReportletConf","name":"testUserReportlet","matchingCond":null,"plainAttributes":["fullname","gender"],"derivedAttributes":["cn"],"virtualAttributes":["virtualdata"],"features":["key","username","workflowId","status","creationDate","lastLoginDate","changePwdDate","passwordHistorySize","failedLoginCount","memberships","resources"]}'/>
+ serializedInstance='{"@class":"org.apache.syncope.common.lib.report.UserReportletConf","name":"testUserReportlet","matchingCond":null,"plainAttrs":["fullname","gender"],"derAttrs":["cn"],"virAttrs":["virtualdata"],"features":["key","username","workflowId","status","creationDate","lastLoginDate","changePwdDate","passwordHistorySize","failedLoginCount","memberships","resources"]}'/>
<ReportExec Report_id="1" id="1" status="SUCCESS" startDate="2012-02-26 15:40:04" endDate="2012-02-26 15:41:04"/>
<SyncopeLogger logName="syncope.audit.[REST]:[EntitlementLogic]:[]:[getOwn]:[SUCCESS]" logLevel="DEBUG" logType="AUDIT"/>
-
- <!-- Authentication and authorization -->
- <Entitlement name="base"/>
- <Entitlement name="advanced" description="Advanced entitlement"/>
- <Entitlement name="REALM_LIST"/>
- <Entitlement name="REALM_CREATE"/>
- <Entitlement name="REALM_UPDATE"/>
- <Entitlement name="REALM_DELETE"/>
- <Entitlement name="ROLE_LIST"/>
- <Entitlement name="ROLE_CREATE"/>
- <Entitlement name="ROLE_READ"/>
- <Entitlement name="ROLE_UPDATE"/>
- <Entitlement name="ROLE_DELETE"/>
- <Entitlement name="SCHEMA_LIST"/>
- <Entitlement name="SCHEMA_CREATE"/>
- <Entitlement name="SCHEMA_READ"/>
- <Entitlement name="SCHEMA_UPDATE"/>
- <Entitlement name="SCHEMA_DELETE"/>
- <Entitlement name="USER_LIST"/>
- <Entitlement name="USER_CREATE"/>
- <Entitlement name="USER_READ"/>
- <Entitlement name="USER_UPDATE"/>
- <Entitlement name="USER_DELETE"/>
- <Entitlement name="USER_VIEW"/>
- <Entitlement name="GROUP_LIST"/>
- <Entitlement name="GROUP_CREATE"/>
- <Entitlement name="GROUP_READ"/>
- <Entitlement name="GROUP_UPDATE"/>
- <Entitlement name="GROUP_DELETE"/>
- <Entitlement name="RESOURCE_LIST"/>
- <Entitlement name="RESOURCE_CREATE"/>
- <Entitlement name="RESOURCE_READ"/>
- <Entitlement name="RESOURCE_UPDATE"/>
- <Entitlement name="RESOURCE_DELETE"/>
- <Entitlement name="RESOURCE_GETCONNECTOROBJECT"/>
- <Entitlement name="CONNECTOR_LIST"/>
- <Entitlement name="CONNECTOR_CREATE"/>
- <Entitlement name="CONNECTOR_READ"/>
- <Entitlement name="CONNECTOR_UPDATE"/>
- <Entitlement name="CONNECTOR_DELETE"/>
- <Entitlement name="CONNECTOR_RELOAD"/>
- <Entitlement name="CONFIGURATION_EXPORT"/>
- <Entitlement name="CONFIGURATION_LIST"/>
- <Entitlement name="CONFIGURATION_SET"/>
- <Entitlement name="CONFIGURATION_DELETE"/>
- <Entitlement name="TASK_LIST"/>
- <Entitlement name="TASK_CREATE"/>
- <Entitlement name="TASK_READ"/>
- <Entitlement name="TASK_UPDATE"/>
- <Entitlement name="TASK_DELETE"/>
- <Entitlement name="TASK_EXECUTE"/>
- <Entitlement name="POLICY_LIST"/>
- <Entitlement name="POLICY_CREATE"/>
- <Entitlement name="POLICY_READ"/>
- <Entitlement name="POLICY_UPDATE"/>
- <Entitlement name="POLICY_DELETE"/>
- <Entitlement name="WORKFLOW_DEF_READ"/>
- <Entitlement name="WORKFLOW_DEF_UPDATE"/>
- <Entitlement name="WORKFLOW_TASK_LIST"/>
- <Entitlement name="WORKFLOW_FORM_LIST"/>
- <Entitlement name="WORKFLOW_FORM_READ"/>
- <Entitlement name="WORKFLOW_FORM_CLAIM"/>
- <Entitlement name="WORKFLOW_FORM_SUBMIT"/>
- <Entitlement name="NOTIFICATION_LIST"/>
- <Entitlement name="NOTIFICATION_CREATE"/>
- <Entitlement name="NOTIFICATION_READ"/>
- <Entitlement name="NOTIFICATION_UPDATE"/>
- <Entitlement name="NOTIFICATION_DELETE"/>
- <Entitlement name="REPORT_LIST"/>
- <Entitlement name="REPORT_READ"/>
- <Entitlement name="REPORT_CREATE"/>
- <Entitlement name="REPORT_UPDATE"/>
- <Entitlement name="REPORT_DELETE"/>
- <Entitlement name="REPORT_EXECUTE"/>
- <Entitlement name="LOG_LIST"/>
- <Entitlement name="LOG_SET_LEVEL"/>
- <Entitlement name="LOG_DELETE"/>
- <Entitlement name="AUDIT_LIST"/>
- <Entitlement name="AUDIT_ENABLE"/>
- <Entitlement name="AUDIT_DISABLE"/>
- <Entitlement name="SECURITY_QUESTION_CREATE"/>
- <Entitlement name="SECURITY_QUESTION_UPDATE"/>
- <Entitlement name="SECURITY_QUESTION_DELETE"/>
- <Entitlement name="GROUP_1"/>
- <Entitlement name="GROUP_2"/>
- <Entitlement name="GROUP_3"/>
- <Entitlement name="GROUP_4"/>
- <Entitlement name="GROUP_5"/>
- <Entitlement name="GROUP_6"/>
- <Entitlement name="GROUP_7"/>
- <Entitlement name="GROUP_8"/>
- <Entitlement name="GROUP_9"/>
- <Entitlement name="GROUP_10"/>
- <Entitlement name="GROUP_11"/>
- <Entitlement name="GROUP_12"/>
- <Entitlement name="GROUP_13"/>
- <Entitlement name="GROUP_14"/>
-
- <SyncopeGroup_Entitlement entitlement_name="base" group_id="1"/>
- <SyncopeGroup_Entitlement entitlement_name="advanced" group_id="1"/>
- <SyncopeGroup_Entitlement entitlement_name="base" group_id="2"/>
- <SyncopeGroup_Entitlement entitlement_name="USER_READ" group_id="2"/>
- <SyncopeGroup_Entitlement entitlement_name="USER_LIST" group_id="2"/>
- <SyncopeGroup_Entitlement entitlement_name="USER_READ" group_id="7"/>
- <SyncopeGroup_Entitlement entitlement_name="USER_LIST" group_id="7"/>
- <SyncopeGroup_Entitlement entitlement_name="GROUP_8" group_id="7"/>
- <SyncopeGroup_Entitlement entitlement_name="GROUP_9" group_id="7"/>
- <SyncopeGroup_Entitlement entitlement_name="GROUP_7" group_id="7"/>
- <SyncopeGroup_Entitlement entitlement_name="GROUP_1" group_id="7"/>
- <SyncopeGroup_Entitlement entitlement_name="WORKFLOW_FORM_CLAIM" group_id="7"/>
- <SyncopeGroup_Entitlement entitlement_name="WORKFLOW_FORM_SUBMIT" group_id="7"/>
- <SyncopeGroup_Entitlement entitlement_name="SCHEMA_READ" group_id="8"/>
- <SyncopeGroup_Entitlement entitlement_name="GROUP_READ" group_id="8"/>
- <SyncopeGroup_Entitlement entitlement_name="WORKFLOW_FORM_CLAIM" group_id="8"/>
<SecurityQuestion id="1" content="What's your mother's maiden name?"/>
</dataset>
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/resources/simplelogger.properties
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/resources/simplelogger.properties b/core/persistence-jpa/src/test/resources/simplelogger.properties
index 1b21312..736706a 100644
--- a/core/persistence-jpa/src/test/resources/simplelogger.properties
+++ b/core/persistence-jpa/src/test/resources/simplelogger.properties
@@ -14,4 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+
+# See http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html
+# Possible values: "trace", "debug", "info", "warn", or "error"
org.slf4j.simpleLogger.defaultLogLevel=debug
+org.slf4j.simpleLogger.log.org.springframework.jdbc.core.JdbcTemplate=error
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
index 2c69f4b..186dbbb 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
@@ -21,6 +21,7 @@ package org.apache.syncope.core.provisioning.api;
import java.net.URI;
import java.util.List;
import java.util.Map;
+import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.identityconnectors.framework.api.ConfigurationProperties;
import org.identityconnectors.framework.api.ConnectorInfo;
import org.identityconnectors.framework.api.ConnectorInfoManager;
@@ -34,8 +35,7 @@ public interface ConnIdBundleManager {
Map<URI, ConnectorInfoManager> getConnManagers();
- ConnectorInfo getConnectorInfo(final String location, final String bundleName, final String bundleVersion,
- final String connectorName);
+ ConnectorInfo getConnectorInfo(ConnInstance connInstance);
Map<URI, ConnectorInfoManager> getConnInfoManagers();
@@ -43,6 +43,6 @@ public interface ConnIdBundleManager {
List<URI> getLocations();
- void setStringLocations(final String stringLocations);
+ void setStringLocations(String stringLocations);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnPoolConfUtil.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnPoolConfUtil.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnPoolConfUtil.java
deleted file mode 100644
index 7d12553..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnPoolConfUtil.java
+++ /dev/null
@@ -1,69 +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.provisioning.api;
-
-import org.apache.syncope.common.lib.to.ConnPoolConfTO;
-import org.apache.syncope.core.persistence.api.entity.ConnPoolConf;
-import org.identityconnectors.common.pooling.ObjectPoolConfiguration;
-
-public final class ConnPoolConfUtil {
-
- public static ConnPoolConf getConnPoolConf(final ConnPoolConfTO cpcto, final ConnPoolConf cpc) {
- ObjectPoolConfiguration opc = new ObjectPoolConfiguration();
-
- cpc.setMaxIdle(cpcto.getMaxIdle() == null ? opc.getMaxIdle() : cpcto.getMaxIdle());
- cpc.setMaxObjects(cpcto.getMaxObjects() == null ? opc.getMaxObjects() : cpcto.getMaxObjects());
- cpc.setMaxWait(cpcto.getMaxWait() == null ? opc.getMaxWait() : cpcto.getMaxWait());
- cpc.setMinEvictableIdleTimeMillis(cpcto.getMinEvictableIdleTimeMillis() == null
- ? opc.getMinEvictableIdleTimeMillis() : cpcto.getMinEvictableIdleTimeMillis());
- cpc.setMinIdle(cpcto.getMinIdle() == null ? opc.getMinIdle() : cpcto.getMinIdle());
-
- return cpc;
- }
-
- public static ObjectPoolConfiguration getObjectPoolConfiguration(final ConnPoolConf cpc) {
- ObjectPoolConfiguration opc = new ObjectPoolConfiguration();
- updateObjectPoolConfiguration(opc, cpc);
- return opc;
- }
-
- public static void updateObjectPoolConfiguration(
- final ObjectPoolConfiguration opc, final ConnPoolConf cpc) {
-
- if (cpc.getMaxIdle() != null) {
- opc.setMaxIdle(cpc.getMaxIdle());
- }
- if (cpc.getMaxObjects() != null) {
- opc.setMaxObjects(cpc.getMaxObjects());
- }
- if (cpc.getMaxWait() != null) {
- opc.setMaxWait(cpc.getMaxWait());
- }
- if (cpc.getMinEvictableIdleTimeMillis() != null) {
- opc.setMinEvictableIdleTimeMillis(cpc.getMinEvictableIdleTimeMillis());
- }
- if (cpc.getMinIdle() != null) {
- opc.setMinIdle(cpc.getMinIdle());
- }
- }
-
- private ConnPoolConfUtil() {
- // empty constructor for static utility class
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnPoolConfUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnPoolConfUtils.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnPoolConfUtils.java
new file mode 100644
index 0000000..55216ae
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnPoolConfUtils.java
@@ -0,0 +1,69 @@
+/*
+ * 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.provisioning.api;
+
+import org.apache.syncope.common.lib.to.ConnPoolConfTO;
+import org.apache.syncope.core.persistence.api.entity.ConnPoolConf;
+import org.identityconnectors.common.pooling.ObjectPoolConfiguration;
+
+public final class ConnPoolConfUtils {
+
+ public static ConnPoolConf getConnPoolConf(final ConnPoolConfTO cpcto, final ConnPoolConf cpc) {
+ ObjectPoolConfiguration opc = new ObjectPoolConfiguration();
+
+ cpc.setMaxIdle(cpcto.getMaxIdle() == null ? opc.getMaxIdle() : cpcto.getMaxIdle());
+ cpc.setMaxObjects(cpcto.getMaxObjects() == null ? opc.getMaxObjects() : cpcto.getMaxObjects());
+ cpc.setMaxWait(cpcto.getMaxWait() == null ? opc.getMaxWait() : cpcto.getMaxWait());
+ cpc.setMinEvictableIdleTimeMillis(cpcto.getMinEvictableIdleTimeMillis() == null
+ ? opc.getMinEvictableIdleTimeMillis() : cpcto.getMinEvictableIdleTimeMillis());
+ cpc.setMinIdle(cpcto.getMinIdle() == null ? opc.getMinIdle() : cpcto.getMinIdle());
+
+ return cpc;
+ }
+
+ public static ObjectPoolConfiguration getObjectPoolConfiguration(final ConnPoolConf cpc) {
+ ObjectPoolConfiguration opc = new ObjectPoolConfiguration();
+ updateObjectPoolConfiguration(opc, cpc);
+ return opc;
+ }
+
+ public static void updateObjectPoolConfiguration(
+ final ObjectPoolConfiguration opc, final ConnPoolConf cpc) {
+
+ if (cpc.getMaxIdle() != null) {
+ opc.setMaxIdle(cpc.getMaxIdle());
+ }
+ if (cpc.getMaxObjects() != null) {
+ opc.setMaxObjects(cpc.getMaxObjects());
+ }
+ if (cpc.getMaxWait() != null) {
+ opc.setMaxWait(cpc.getMaxWait());
+ }
+ if (cpc.getMinEvictableIdleTimeMillis() != null) {
+ opc.setMinEvictableIdleTimeMillis(cpc.getMinEvictableIdleTimeMillis());
+ }
+ if (cpc.getMinIdle() != null) {
+ opc.setMinIdle(cpc.getMinIdle());
+ }
+ }
+
+ private ConnPoolConfUtils() {
+ // empty constructor for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
index 16ffc7c..6989f8c 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
@@ -21,17 +21,18 @@ package org.apache.syncope.core.provisioning.api;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.GroupMod;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.GroupTO;
public interface GroupProvisioningManager extends ProvisioningManager<GroupTO, GroupMod> {
- Map.Entry<Long, List<PropagationStatus>> create(GroupTO groupTO, Set<String> excludedResources);
+ Pair<Long, List<PropagationStatus>> create(GroupTO groupTO, Set<String> excludedResources);
- Map.Entry<Long, List<PropagationStatus>> create(
+ Pair<Long, List<PropagationStatus>> create(
GroupTO groupTO, Map<Long, String> groupOwnerMap, Set<String> excludedResources);
- Map.Entry<Long, List<PropagationStatus>> update(GroupMod subjectMod, Set<String> excludedResources);
+ Pair<Long, List<PropagationStatus>> update(GroupMod subjectMod, Set<String> excludedResources);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ProvisioningManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ProvisioningManager.java
index 3762996..95450e2 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ProvisioningManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ProvisioningManager.java
@@ -20,16 +20,16 @@ package org.apache.syncope.core.provisioning.api;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.AbstractAttributableMod;
import org.apache.syncope.common.lib.to.AbstractAttributableTO;
import org.apache.syncope.common.lib.to.PropagationStatus;
public interface ProvisioningManager<T extends AbstractAttributableTO, M extends AbstractAttributableMod> {
- Map.Entry<Long, List<PropagationStatus>> create(T subject);
+ Pair<Long, List<PropagationStatus>> create(T subject);
- Map.Entry<Long, List<PropagationStatus>> update(M subjectMod);
+ Pair<Long, List<PropagationStatus>> update(M subjectMod);
List<PropagationStatus> delete(Long subjectId);
[37/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PolicyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PolicyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PolicyITCase.java
index bdf3f90..0c00e40 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PolicyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PolicyITCase.java
@@ -68,7 +68,7 @@ public class PolicyITCase extends AbstractITCase {
assertNotNull(policyTO);
assertTrue(policyTO.getUsedByResources().isEmpty());
- assertTrue(policyTO.getUsedByGroups().containsAll(Arrays.asList(6L, 7L, 10L, 14L)));
+ assertTrue(policyTO.getUsedByRealms().contains("/odd"));
}
@Test
@@ -77,7 +77,7 @@ public class PolicyITCase extends AbstractITCase {
assertNotNull(policyTO);
assertTrue(policyTO.getUsedByResources().contains(RESOURCE_NAME_NOPROPAGATION));
- assertTrue(policyTO.getUsedByGroups().containsAll(Arrays.asList(6L, 7L, 10L, 8L)));
+ assertTrue(policyTO.getUsedByRealms().containsAll(Arrays.asList("/", "/odd", "/even")));
}
@Test
@@ -85,50 +85,7 @@ public class PolicyITCase extends AbstractITCase {
SyncPolicyTO policyTO = policyService.read(1L);
assertNotNull(policyTO);
- assertTrue(policyTO.getUsedByGroups().isEmpty());
- }
-
- @Test
- public void getGlobalAccountPolicy() {
- AccountPolicyTO policyTO = policyService.readGlobal(PolicyType.ACCOUNT);
-
- assertNotNull(policyTO);
- assertEquals(PolicyType.GLOBAL_ACCOUNT, policyTO.getType());
- }
-
- @Test
- public void getGlobalPasswordPolicy() {
- PasswordPolicyTO policyTO = policyService.readGlobal(PolicyType.PASSWORD);
-
- assertNotNull(policyTO);
- assertEquals(PolicyType.GLOBAL_PASSWORD, policyTO.getType());
- assertEquals(8, policyTO.getSpecification().getMinLength());
- assertFalse(policyTO.getUsedByResources().contains(RESOURCE_NAME_NOPROPAGATION));
- }
-
- @Test
- public void getGlobalSyncPolicy() {
- SyncPolicyTO policyTO = policyService.readGlobal(PolicyType.SYNC);
-
- assertNotNull(policyTO);
- assertEquals(PolicyType.GLOBAL_SYNC, policyTO.getType());
- assertFalse(policyTO.getUsedByResources().contains(RESOURCE_NAME_CSV));
- assertFalse(policyTO.getUsedByResources().contains(RESOURCE_NAME_WS2));
- assertTrue(policyTO.getUsedByGroups().isEmpty());
- }
-
- @Test
- public void createWithException() {
- PasswordPolicyTO policy = new PasswordPolicyTO(true);
- policy.setSpecification(new PasswordPolicySpec());
- policy.setDescription("global password policy");
-
- try {
- createPolicy(policy);
- fail();
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.InvalidPolicy, e.getType());
- }
+ assertTrue(policyTO.getUsedByRealms().isEmpty());
}
@Test
@@ -209,20 +166,6 @@ public class PolicyITCase extends AbstractITCase {
}
@Test
- public void issueSYNCOPE466() {
- PasswordPolicyTO policy = policyService.read(4L);
- assertEquals(PolicyType.PASSWORD, policy.getType());
-
- policy.setType(PolicyType.GLOBAL_PASSWORD);
- try {
- policyService.update(policy.getKey(), policy);
- fail();
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.InvalidPolicy, e.getType());
- }
- }
-
- @Test
public void issueSYNCOPE553() {
AccountPolicyTO policy = new AccountPolicyTO(false);
policy.setDescription("SYNCOPE553");
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
index 76da48c..918c22b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
@@ -259,7 +259,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
// create a new sample group
GroupTO groupTO = new GroupTO();
groupTO.setName("all" + getUUIDString());
- groupTO.setParent(8L);
+ groupTO.setRealm("/even");
groupTO.getGPlainAttrTemplates().add(newPlainSchemaTO.getKey());
groupTO.getPlainAttrs().add(attrTO(newPlainSchemaTO.getKey(), "all"));
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java
index bfc2448..4bd882d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java
@@ -30,6 +30,7 @@ import javax.ws.rs.core.Response;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.AccountPolicyTO;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.lib.types.AccountPolicySpec;
@@ -148,7 +149,7 @@ public class RealmITCase extends AbstractITCase {
realm.setName("withppolicy");
realm.setAccountPolicy(policy.getKey());
- Response response = realmService.create("/", realm);
+ Response response = realmService.create(SyncopeConstants.ROOT_REALM, realm);
RealmTO[] actuals = getObject(response.getLocation(), RealmService.class, RealmTO[].class);
assertNotNull(actuals);
assertTrue(actuals.length > 0);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java
index a39be36..0c1aa85 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java
@@ -26,8 +26,8 @@ import static org.junit.Assert.fail;
import java.util.List;
import javax.ws.rs.core.Response;
-import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.RoleTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.Entitlement;
@@ -59,7 +59,6 @@ public class RoleITCase extends AbstractITCase {
private RoleTO buildRoleTO(final String name) {
RoleTO role = new RoleTO();
role.setName(name + getUUIDString());
- role.setCriteria(SyncopeClient.getUserSearchConditionBuilder().inGroups(2L).query());
role.getRealms().add("/even");
role.getEntitlements().add(Entitlement.LOG_SET_LEVEL);
@@ -70,8 +69,7 @@ public class RoleITCase extends AbstractITCase {
public void create() {
RoleTO role = new RoleTO();
role.setName("new" + getUUIDString());
- role.setCriteria(SyncopeClient.getUserSearchConditionBuilder().inGroups(2L).query());
- role.getRealms().add("/");
+ role.getRealms().add(SyncopeConstants.ROOT_REALM);
role.getRealms().add("/even/two");
role.getEntitlements().add(Entitlement.LOG_LIST);
role.getEntitlements().add(Entitlement.LOG_SET_LEVEL);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
index 2fd4adb..7cd72db 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
@@ -23,8 +23,11 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.GroupTO;
@@ -40,6 +43,7 @@ public class SearchITCase extends AbstractITCase {
public void searchUser() {
// LIKE
PagedResult<UserTO> matchedUsers = userService.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().
is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query());
assertNotNull(matchedUsers);
@@ -51,6 +55,7 @@ public class SearchITCase extends AbstractITCase {
// ISNULL
matchedUsers = userService.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().isNull("loginDate").query());
assertNotNull(matchedUsers);
assertFalse(matchedUsers.getResult().isEmpty());
@@ -66,9 +71,9 @@ public class SearchITCase extends AbstractITCase {
@Test
public void searchByUsernameAndKey() {
final PagedResult<UserTO> matchingUsers = userService.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().
is("username").equalTo("rossini").and("key").lessThan(2).query());
-
assertNotNull(matchingUsers);
assertEquals(1, matchingUsers.getResult().size());
assertEquals("rossini", matchingUsers.getResult().iterator().next().getUsername());
@@ -78,9 +83,9 @@ public class SearchITCase extends AbstractITCase {
@Test
public void searchByGroupNameAndKey() {
final PagedResult<GroupTO> matchingGroups = groupService.search(
+ Collections.singletonList("/"),
SyncopeClient.getGroupSearchConditionBuilder().
is("name").equalTo("root").and("key").lessThan(2).query());
-
assertNotNull(matchingGroups);
assertEquals(1, matchingGroups.getResult().size());
assertEquals("root", matchingGroups.getResult().iterator().next().getName());
@@ -90,23 +95,25 @@ public class SearchITCase extends AbstractITCase {
@Test
public void searchUserByResourceName() {
PagedResult<UserTO> matchedUsers = userService.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().hasResources(RESOURCE_NAME_MAPPINGS2).query());
assertNotNull(matchedUsers);
assertFalse(matchedUsers.getResult().isEmpty());
- Set<Long> userIds = new HashSet<Long>(matchedUsers.getResult().size());
- for (UserTO user : matchedUsers.getResult()) {
- userIds.add(user.getKey());
- }
+ assertTrue(CollectionUtils.exists(matchedUsers.getResult(), new Predicate<UserTO>() {
- assertEquals(1, userIds.size());
- assertTrue(userIds.contains(2L));
+ @Override
+ public boolean evaluate(final UserTO user) {
+ return user.getKey() == 2;
+ }
+ }));
}
@Test
public void paginatedSearch() {
// LIKE
PagedResult<UserTO> matchingUsers = userService.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().
is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query(), 1, 2);
assertNotNull(matchingUsers);
@@ -118,47 +125,36 @@ public class SearchITCase extends AbstractITCase {
// ISNULL
matchingUsers = userService.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().isNull("loginDate").query(), 1, 2);
-
assertNotNull(matchingUsers);
assertFalse(matchingUsers.getResult().isEmpty());
- Set<Long> userIds = new HashSet<>(matchingUsers.getResult().size());
- for (UserTO user : matchingUsers.getResult()) {
- userIds.add(user.getKey());
- }
- assertEquals(2, userIds.size());
+ assertEquals(2, matchingUsers.getResult().size());
}
@Test
public void searchByBooleanSubjectCond() {
final PagedResult<GroupTO> matchingGroups = groupService.search(
- SyncopeClient.getGroupSearchConditionBuilder().is("inheritPlainAttrs").equalTo("true").query());
- assertNotNull(matchingGroups);
- assertFalse(matchingGroups.getResult().isEmpty());
- }
-
- @Test
- public void searchByEntitlement() {
- final PagedResult<GroupTO> matchingGroups = groupService.search(
- SyncopeClient.getGroupSearchConditionBuilder().hasEntitlements("USER_LIST", "USER_READ").query());
+ Collections.singletonList("/"),
+ SyncopeClient.getGroupSearchConditionBuilder().is("show").equalTo("true").query());
assertNotNull(matchingGroups);
assertFalse(matchingGroups.getResult().isEmpty());
}
@Test
public void searchByRelationshipSubjectCond() {
- final PagedResult<GroupTO> matchingGroups = groupService.search(SyncopeClient.getGroupSearchConditionBuilder().
- isNotNull("passwordPolicy").and("userOwner").equalTo(5).query());
-
+ final PagedResult<GroupTO> matchingGroups = groupService.search(
+ Collections.singletonList("/"),
+ SyncopeClient.getGroupSearchConditionBuilder().is("userOwner").equalTo(5).query());
assertNotNull(matchingGroups);
assertEquals(1, matchingGroups.getResult().size());
- assertEquals("director", matchingGroups.getResult().iterator().next().getName());
assertEquals(6L, matchingGroups.getResult().iterator().next().getKey());
}
@Test
public void nested() {
PagedResult<UserTO> matchedUsers = userService.search(
+ Collections.singletonList("/"),
"((fullname==*o*,fullname==*i*);$resources!=ws-target-resource-1)", 1, 2);
assertNotNull(matchedUsers);
@@ -170,9 +166,11 @@ public class SearchITCase extends AbstractITCase {
@Test
public void orderBy() {
- final PagedResult<UserTO> matchedUsers = userService.search(
+ PagedResult<UserTO> matchedUsers = userService.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().is("userId").equalTo("*@apache.org").query(),
SyncopeClient.getOrderByClauseBuilder().asc("status").desc("firstname").build());
+ assertNotNull(matchedUsers);
assertFalse(matchedUsers.getResult().isEmpty());
for (UserTO user : matchedUsers.getResult()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
index 6b7443d..c922413 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
@@ -25,11 +25,13 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.AbstractTaskTO;
@@ -96,13 +98,14 @@ public class SyncTaskITCase extends AbstractTaskITCase {
public void create() {
SyncTaskTO task = new SyncTaskTO();
task.setName("Test create Sync");
+ task.setDestinationRealm("/");
task.setResource(RESOURCE_NAME_WS2);
UserTO userTemplate = new UserTO();
userTemplate.getResources().add(RESOURCE_NAME_WS2);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(8L);
+ membershipTO.setGroupKey(8L);
userTemplate.getMemberships().add(membershipTO);
task.setUserTemplate(userTemplate);
@@ -130,6 +133,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// Create a new user ... it should be updated applying sync policy
// -----------------------------
UserTO inUserTO = new UserTO();
+ inUserTO.setRealm(SyncopeConstants.ROOT_REALM);
inUserTO.setPassword("password123");
String userName = "test9";
inUserTO.setUsername(userName);
@@ -147,13 +151,13 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// -----------------------------
try {
- int usersPre = userService.list(1, 1).getTotalCount();
+ int usersPre = userService.list(Collections.singletonList("/"), 1, 1).getTotalCount();
assertNotNull(usersPre);
execSyncTask(SYNC_TASK_ID, 50, false);
- // after execution of the sync task the user data should be synced from
- // csv datasource and processed by user template
+ // after execution of the sync task the user data should have been synced from CSV
+ // and processed by user template
UserTO userTO = userService.read(inUserTO.getKey());
assertNotNull(userTO);
assertEquals(userName, userTO.getUsername());
@@ -186,7 +190,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
assertEquals("TYPE_8", userTO.getPlainAttrMap().get("type").getValues().get(0));
// check for sync results
- int usersPost = userService.list(1, 1).getTotalCount();
+ int usersPost = userService.list(Collections.singletonList("/"), 1, 1).getTotalCount();
assertNotNull(usersPost);
assertEquals(usersPre + 9, usersPost);
@@ -255,6 +259,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
*/
private void ldapCleanup() {
PagedResult<GroupTO> matchingGroups = groupService.search(
+ Collections.singletonList("/"),
SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("testLDAPGroup").query());
if (matchingGroups.getSize() > 0) {
for (GroupTO group : matchingGroups.getResult()) {
@@ -265,6 +270,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
}
}
PagedResult<UserTO> matchingUsers = userService.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("syncFromLDAP").query());
if (matchingUsers.getSize() > 0) {
for (UserTO user : matchingUsers.getResult()) {
@@ -291,11 +297,13 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// 2. verify that synchronized group is found, with expected attributes
final PagedResult<GroupTO> matchingGroups = groupService.search(
+ Collections.singletonList("/"),
SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("testLDAPGroup").query());
assertNotNull(matchingGroups);
assertEquals(1, matchingGroups.getResult().size());
final PagedResult<UserTO> matchingUsers = userService.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("syncFromLDAP").query());
assertNotNull(matchingUsers);
assertEquals(1, matchingUsers.getResult().size());
@@ -311,13 +319,13 @@ public class SyncTaskITCase extends AbstractTaskITCase {
final GroupTO groupTO = matchingGroups.getResult().iterator().next();
assertNotNull(groupTO);
assertEquals("testLDAPGroup", groupTO.getName());
- assertEquals(8L, groupTO.getParent());
assertEquals("true", groupTO.getPlainAttrMap().get("show").getValues().get(0));
- assertEquals(matchingUsers.getResult().iterator().next().getKey(), (long) groupTO.getUserOwner());
+ assertEquals(matchingUsers.getResult().iterator().next().getKey(), groupTO.getUserOwner(), 0);
assertNull(groupTO.getGroupOwner());
// 3. verify that LDAP group membership is propagated as Syncope group membership
final PagedResult<UserTO> members = userService.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().inGroups(groupTO.getKey()).query());
assertNotNull(members);
assertEquals(1, members.getResult().size());
@@ -329,6 +337,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// Create a new user ... it should be updated applying sync policy
//-----------------------------
UserTO userTO = new UserTO();
+ userTO.setRealm(SyncopeConstants.ROOT_REALM);
userTO.setPassword("password123");
userTO.setUsername("testuser2");
@@ -343,7 +352,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
userTO.getResources().add(RESOURCE_NAME_NOPROPAGATION4);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7L);
+ membershipTO.setGroupKey(7L);
userTO.getMemberships().add(membershipTO);
@@ -361,7 +370,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
UserTO template = new UserTO();
membershipTO = new MembershipTO();
- membershipTO.setGroupId(10L);
+ membershipTO.setGroupKey(10L);
template.getMemberships().add(membershipTO);
@@ -435,6 +444,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// -----------------------------
SyncTaskTO task = new SyncTaskTO();
+ task.setDestinationRealm(SyncopeConstants.ROOT_REALM);
task.setName("Test Sync Rule");
task.setResource(RESOURCE_NAME_WS2);
task.setFullReconciliation(true);
@@ -551,7 +561,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
"SELECT USERNAME FROM testsync WHERE ID=?", String.class, userTO.getKey());
assertEquals("virtualvalue", value);
} catch (EmptyResultDataAccessException e) {
- assertTrue(false);
+ fail();
}
}
@@ -559,7 +569,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
public void issueSYNCOPE313DB() throws Exception {
// 1. create user in DB
UserTO user = UserITCase.getUniqueSampleTO("syncope313-db@syncope.apache.org");
- user.setPassword("security");
+ user.setPassword("security123");
user.getResources().add(RESOURCE_NAME_TESTDB);
user = createUser(user);
assertNotNull(user);
@@ -569,7 +579,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
final JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
String value = jdbcTemplate.queryForObject(
"SELECT PASSWORD FROM test WHERE ID=?", String.class, user.getUsername());
- assertEquals(Encryptor.getInstance().encode("security", CipherAlgorithm.SHA1), value.toUpperCase());
+ assertEquals(Encryptor.getInstance().encode("security123", CipherAlgorithm.SHA1), value.toUpperCase());
// 3. Update the password in the DB
String newPassword = Encryptor.getInstance().encode("new-security", CipherAlgorithm.SHA1);
@@ -578,6 +588,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// 4. Sync the user from the resource
SyncTaskTO syncTask = new SyncTaskTO();
+ syncTask.setDestinationRealm(SyncopeConstants.ROOT_REALM);
syncTask.setName("DB Sync Task");
syncTask.setPerformCreate(true);
syncTask.setPerformUpdate(true);
@@ -615,7 +626,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// 1. create user in LDAP
UserTO user = UserITCase.getUniqueSampleTO("syncope313-ldap@syncope.apache.org");
- user.setPassword("security");
+ user.setPassword("security123");
user.getResources().add(RESOURCE_NAME_LDAP);
user = createUser(user);
assertNotNull(user);
@@ -624,7 +635,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// 2. request to change password only on Syncope and not on LDAP
UserMod userMod = new UserMod();
userMod.setKey(user.getKey());
- userMod.setPassword("new-security");
+ userMod.setPassword("new-security123");
StatusMod pwdPropRequest = new StatusMod();
pwdPropRequest.setOnSyncope(true);
pwdPropRequest.getResourceNames().clear();
@@ -633,7 +644,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// 3. Check that the Syncope user now has the changed password
UserTO updatedUser = userService.read(user.getKey());
- String encodedNewPassword = Encryptor.getInstance().encode("new-security", CipherAlgorithm.SHA1);
+ String encodedNewPassword = Encryptor.getInstance().encode("new-security123", CipherAlgorithm.SHA1);
assertEquals(encodedNewPassword, updatedUser.getPassword());
// 4. Check that the LDAP resource has the old password
@@ -641,7 +652,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.USER, user.getKey());
assertNotNull(getLdapRemoteObject(
connObject.getPlainAttrMap().get(Name.NAME).getValues().get(0),
- "security",
+ "security123",
connObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
// 5. Update the LDAP Connector to retrieve passwords
@@ -654,6 +665,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// 6. Sync the user from the resource
SyncTaskTO syncTask = new SyncTaskTO();
+ syncTask.setDestinationRealm(SyncopeConstants.ROOT_REALM);
syncTask.setName("LDAP Sync Task");
syncTask.setPerformCreate(true);
syncTask.setPerformUpdate(true);
@@ -676,7 +688,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
// 7. Test the sync'd user
- String syncedPassword = Encryptor.getInstance().encode("security", CipherAlgorithm.SHA1);
+ String syncedPassword = Encryptor.getInstance().encode("security123", CipherAlgorithm.SHA1);
updatedUser = userService.read(user.getKey());
assertEquals(syncedPassword, updatedUser.getPassword());
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
index b77a11b..0834176 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
@@ -34,15 +34,19 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import javax.naming.NamingException;
import javax.ws.rs.core.EntityTag;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.cxf.common.util.Base64Utility;
import org.apache.cxf.helpers.IOUtils;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.AttributableOperations;
import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.mod.AttrMod;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.ResourceAssociationMod;
@@ -57,7 +61,6 @@ import org.apache.syncope.common.lib.to.MappingItemTO;
import org.apache.syncope.common.lib.to.MappingTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.lib.to.PasswordPolicyTO;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.PropagationTaskTO;
import org.apache.syncope.common.lib.to.ResourceTO;
@@ -65,8 +68,8 @@ import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.common.lib.types.PolicyType;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
@@ -76,7 +79,6 @@ import org.apache.syncope.common.lib.wrap.ResourceName;
import org.apache.syncope.common.rest.api.CollectionWrapper;
import org.apache.syncope.common.rest.api.Preference;
import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.common.rest.api.service.PolicyService;
import org.apache.syncope.common.rest.api.service.ResourceService;
import org.apache.syncope.common.rest.api.service.UserSelfService;
import org.apache.syncope.common.rest.api.service.UserService;
@@ -110,6 +112,7 @@ public class UserITCase extends AbstractITCase {
public static UserTO getSampleTO(final String email) {
String uid = email;
UserTO userTO = new UserTO();
+ userTO.setRealm(SyncopeConstants.ROOT_REALM);
userTO.setPassword("password123");
userTO.setUsername(uid);
@@ -160,32 +163,13 @@ public class UserITCase extends AbstractITCase {
}
@Test
- public void issue172() {
- List<PasswordPolicyTO> policies = policyService.list(PolicyType.GLOBAL_PASSWORD);
- for (PasswordPolicyTO policyTO : policies) {
- policyService.delete(policyTO.getKey());
- }
-
- try {
- UserTO userTO = getUniqueSampleTO("issue172@syncope.apache.org");
- createUser(userTO);
- } finally {
- for (PasswordPolicyTO policyTO : policies) {
- Response response = policyService.create(policyTO);
- PasswordPolicyTO cPolicyTO = getObject(
- response.getLocation(), PolicyService.class, PasswordPolicyTO.class);
- assertNotNull(cPolicyTO);
- }
- }
- }
-
- @Test
public void issue186() {
// 1. create an user with strict mandatory attributes only
UserTO userTO = new UserTO();
+ userTO.setRealm(SyncopeConstants.ROOT_REALM);
String userId = getUUIDString() + "issue186@syncope.apache.org";
userTO.setUsername(userId);
- userTO.setPassword("password");
+ userTO.setPassword("password123");
userTO.getPlainAttrs().add(attrTO("userId", userId));
userTO.getPlainAttrs().add(attrTO("fullname", userId));
@@ -198,7 +182,7 @@ public class UserITCase extends AbstractITCase {
// 2. update assigning a resource forcing mandatory constraints: must fail with RequiredValuesMissing
UserMod userMod = new UserMod();
userMod.setKey(userTO.getKey());
- userMod.setPassword("newPassword");
+ userMod.setPassword("newPassword123");
userMod.getResourcesToAdd().add(RESOURCE_NAME_WS2);
try {
@@ -212,7 +196,7 @@ public class UserITCase extends AbstractITCase {
// AND primary: must fail with PropagationException
userMod = new UserMod();
userMod.setKey(userTO.getKey());
- userMod.setPassword("newPassword");
+ userMod.setPassword("newPassword123");
userMod.getResourcesToAdd().add(RESOURCE_NAME_WS1);
userTO = updateUser(userMod);
@@ -231,7 +215,7 @@ public class UserITCase extends AbstractITCase {
public void enforceMandatoryCondition() {
UserTO userTO = getUniqueSampleTO("enforce@apache.org");
userTO.getResources().add(RESOURCE_NAME_WS2);
- userTO.setPassword("newPassword");
+ userTO.setPassword("newPassword12");
AttrTO type = null;
for (AttrTO attr : userTO.getPlainAttrs()) {
@@ -267,7 +251,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("syncope222@apache.org");
userTO.getResources().add(resourceTO.getKey());
- userTO.setPassword("newPassword");
+ userTO.setPassword("newPassword12");
try {
userTO = createUser(userTO);
@@ -304,11 +288,7 @@ public class UserITCase extends AbstractITCase {
public void createWithInvalidUsername() {
UserTO userTO = getSampleTO("invalidusername@syncope.apache.org");
userTO.setUsername("us");
-
- MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7L);
-
- userTO.getMemberships().add(membershipTO);
+ userTO.setRealm("/odd");
createUser(userTO);
}
@@ -331,7 +311,7 @@ public class UserITCase extends AbstractITCase {
userTO.setPassword("password1");
final MembershipTO membership = new MembershipTO();
- membership.setGroupId(8L);
+ membership.setGroupKey(8L);
userTO.getMemberships().add(membership);
@@ -362,7 +342,7 @@ public class UserITCase extends AbstractITCase {
// add a membership
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(8L);
+ membershipTO.setGroupKey(8L);
userTO.getMemberships().add(membershipTO);
// add an attribute with no values: must be ignored
@@ -420,11 +400,10 @@ public class UserITCase extends AbstractITCase {
assertEquals(maxTaskExecutions, taskTO.getExecutions().size());
// 3. verify password
- UserSelfService userSelfService1 = clientFactory.create(
- newUserTO.getUsername(), "password123").getService(UserSelfService.class);
try {
- UserTO user = userSelfService1.read();
- assertNotNull(user);
+ Pair<Map<Entitlement, Set<String>>, UserTO> self =
+ clientFactory.create(newUserTO.getUsername(), "password123").self();
+ assertNotNull(self);
} catch (AccessControlException e) {
fail("Credentials should be valid and not cause AccessControlException");
}
@@ -460,7 +439,7 @@ public class UserITCase extends AbstractITCase {
userTO.getPlainAttrs().remove(type);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(8L);
+ membershipTO.setGroupKey(8L);
userTO.getMemberships().add(membershipTO);
// 1. create user without type (mandatory by UserSchema)
@@ -549,7 +528,7 @@ public class UserITCase extends AbstractITCase {
@Test
public void list() {
- PagedResult<UserTO> users = userService.list();
+ PagedResult<UserTO> users = userService.list(Collections.singletonList("/"));
assertNotNull(users);
assertFalse(users.getResult().isEmpty());
@@ -560,7 +539,7 @@ public class UserITCase extends AbstractITCase {
@Test
public void paginatedList() {
- PagedResult<UserTO> users = userService.list(1, 2);
+ PagedResult<UserTO> users = userService.list(Collections.singletonList("/"), 1, 2);
assertNotNull(users);
assertFalse(users.getResult().isEmpty());
assertEquals(2, users.getResult().size());
@@ -569,12 +548,12 @@ public class UserITCase extends AbstractITCase {
assertNotNull(user);
}
- users = userService.list(2, 2);
+ users = userService.list(Collections.singletonList("/"), 2, 2);
assertNotNull(users);
assertFalse(users.getResult().isEmpty());
assertEquals(2, users.getResult().size());
- users = userService.list(100, 2);
+ users = userService.list(Collections.singletonList("/"), 100, 2);
assertNotNull(users);
assertTrue(users.getResult().isEmpty());
}
@@ -630,7 +609,8 @@ public class UserITCase extends AbstractITCase {
@Test(expected = SyncopeClientException.class)
public void updateSamePassword() {
- UserTO userTO = getSampleTO("updatesame@password.com");
+ UserTO userTO = getUniqueSampleTO("updatesame@password.com");
+ userTO.setRealm("/even/two");
userTO = createUser(userTO);
assertNotNull(userTO);
@@ -647,7 +627,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("g.h@t.com");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(8L);
+ membershipTO.setGroupKey(8L);
membershipTO.getPlainAttrs().add(attrTO("subscriptionDate", "2009-08-18T16:33:12.203+0200"));
userTO.getMemberships().add(membershipTO);
@@ -704,7 +684,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("pwdonly@t.com");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(8L);
+ membershipTO.setGroupKey(8L);
membershipTO.getPlainAttrs().add(attrTO("subscriptionDate", "2009-08-18T16:33:12.203+0200"));
userTO.getMemberships().add(membershipTO);
@@ -742,7 +722,7 @@ public class UserITCase extends AbstractITCase {
// add a membership
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(8L);
+ membershipTO.setGroupKey(8L);
userTO.getMemberships().add(membershipTO);
// 1. create user
@@ -811,7 +791,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("createActivate@syncope.apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(11L);
+ membershipTO.setGroupKey(11L);
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
@@ -838,7 +818,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("suspendReactivate@syncope.apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7L);
+ membershipTO.setGroupKey(7L);
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
@@ -1026,9 +1006,9 @@ public class UserITCase extends AbstractITCase {
assertNotNull(toBeUpdated);
assertFalse(toBeUpdated.getVirAttrs().isEmpty());
- assertNotNull(toBeUpdated.getVirAttrs().get(0));
+ assertNotNull(toBeUpdated.getVirAttrs().iterator().next());
- assertEquals(virtual.getSchema(), toBeUpdated.getVirAttrs().get(0).getSchema());
+ assertEquals(virtual.getSchema(), toBeUpdated.getVirAttrs().iterator().next().getSchema());
}
@Test
@@ -1115,7 +1095,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(1L);
+ membershipTO.setGroupKey(1L);
userTO.getMemberships().add(membershipTO);
@@ -1141,7 +1121,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(1L);
+ membershipTO.setGroupKey(1L);
membershipTO.getPlainAttrs().add(attrTO("mderived_sx", "sx"));
membershipTO.getPlainAttrs().add(attrTO("mderived_dx", "dx"));
membershipTO.getDerAttrs().add(attrTO("mderToBePropagated", null));
@@ -1198,12 +1178,12 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
MembershipTO memb12 = new MembershipTO();
- memb12.setGroupId(12L);
+ memb12.setGroupKey(12L);
userTO.getMemberships().add(memb12);
MembershipTO memb13 = new MembershipTO();
- memb13.setGroupId(13L);
+ memb13.setGroupKey(13L);
userTO.getMemberships().add(memb13);
@@ -1282,12 +1262,12 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
MembershipTO memb12 = new MembershipTO();
- memb12.setGroupId(12L);
+ memb12.setGroupKey(12L);
memb12.getPlainAttrs().add(attrTO("postalAddress", "postalAddress"));
userTO.getMemberships().add(memb12);
MembershipTO memb13 = new MembershipTO();
- memb13.setGroupId(13L);
+ memb13.setGroupKey(13L);
userTO.getMemberships().add(memb13);
userTO.getResources().add(RESOURCE_NAME_LDAP);
@@ -1316,7 +1296,7 @@ public class UserITCase extends AbstractITCase {
UserMod userMod = new UserMod();
userMod.setKey(actual.getKey());
- MembershipTO membershipTO = actual.getMemberships().get(0).getGroupId() == 12L
+ MembershipTO membershipTO = actual.getMemberships().get(0).getGroupKey() == 12L
? actual.getMemberships().get(0)
: actual.getMemberships().get(1);
@@ -1418,7 +1398,7 @@ public class UserITCase extends AbstractITCase {
assertNotNull(userTO);
assertEquals(1, userTO.getVirAttrs().size());
- assertEquals("virtualvalue", userTO.getVirAttrs().get(0).getValues().get(0));
+ assertEquals("virtualvalue", userTO.getVirAttrs().iterator().next().getValues().get(0));
}
@Test
@@ -1678,7 +1658,7 @@ public class UserITCase extends AbstractITCase {
// 1. create group with LDAP resource
GroupTO groupTO = new GroupTO();
groupTO.setName("SYNCOPE354-" + getUUIDString());
- groupTO.setParent(8L);
+ groupTO.setRealm("/");
groupTO.getResources().add(RESOURCE_NAME_LDAP);
groupTO = createGroup(groupTO);
@@ -1688,7 +1668,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("syncope354@syncope.apache.org");
userTO.getResources().add(RESOURCE_NAME_LDAP);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(groupTO.getKey());
+ membershipTO.setGroupKey(groupTO.getKey());
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
@@ -1729,7 +1709,7 @@ public class UserITCase extends AbstractITCase {
// 1. create group with LDAP resource
GroupTO groupTO = new GroupTO();
groupTO.setName("SYNCOPE357-" + getUUIDString());
- groupTO.setParent(8L);
+ groupTO.setRealm("/");
groupTO.getResources().add(RESOURCE_NAME_LDAP);
groupTO = createGroup(groupTO);
@@ -1741,7 +1721,7 @@ public class UserITCase extends AbstractITCase {
userTO.getPlainAttrs().add(attrTO("photo",
Base64Utility.encode(IOUtils.readBytesFromStream(getClass().getResourceAsStream("/favicon.jpg")))));
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(groupTO.getKey());
+ membershipTO.setGroupKey(groupTO.getKey());
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
@@ -1792,7 +1772,7 @@ public class UserITCase extends AbstractITCase {
// 3. request to change password only on testdb
userMod = new UserMod();
userMod.setKey(userTO.getKey());
- userMod.setPassword(getUUIDString());
+ userMod.setPassword(getUUIDString() + "abbcbcbddd123");
StatusMod pwdPropRequest = new StatusMod();
pwdPropRequest.getResourceNames().add(RESOURCE_NAME_TESTDB);
userMod.setPwdPropRequest(pwdPropRequest);
@@ -1806,9 +1786,10 @@ public class UserITCase extends AbstractITCase {
public void issueSYNCOPE402() {
// 1. create an user with strict mandatory attributes only
UserTO userTO = new UserTO();
+ userTO.setRealm(SyncopeConstants.ROOT_REALM);
String userId = getUUIDString() + "syncope402@syncope.apache.org";
userTO.setUsername(userId);
- userTO.setPassword("password");
+ userTO.setPassword("password123");
userTO.getPlainAttrs().add(attrTO("userId", userId));
userTO.getPlainAttrs().add(attrTO("fullname", userId));
@@ -1818,11 +1799,11 @@ public class UserITCase extends AbstractITCase {
assertNotNull(userTO);
assertTrue(userTO.getResources().isEmpty());
- //2. update assigning a resource NOT forcing mandatory constraints
+ // 2. update assigning a resource NOT forcing mandatory constraints
// AND primary: must fail with PropagationException
UserMod userMod = new UserMod();
userMod.setKey(userTO.getKey());
- userMod.setPassword("newPassword");
+ userMod.setPassword("newPassword123");
userMod.getResourcesToAdd().add(RESOURCE_NAME_WS1);
userMod.getResourcesToAdd().add(RESOURCE_NAME_TESTDB);
@@ -2279,7 +2260,7 @@ public class UserITCase extends AbstractITCase {
public void issueSYNCOPE505DB() throws Exception {
// 1. create user
UserTO user = UserITCase.getUniqueSampleTO("syncope505-db@syncope.apache.org");
- user.setPassword("security");
+ user.setPassword("security123");
user = createUser(user);
assertNotNull(user);
assertTrue(user.getResources().isEmpty());
@@ -2308,7 +2289,7 @@ public class UserITCase extends AbstractITCase {
final JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
String value = jdbcTemplate.queryForObject(
"SELECT PASSWORD FROM test WHERE ID=?", String.class, user.getUsername());
- assertEquals(Encryptor.getInstance().encode("security", CipherAlgorithm.SHA1), value.toUpperCase());
+ assertEquals(Encryptor.getInstance().encode("security123", CipherAlgorithm.SHA1), value.toUpperCase());
// 5. Remove DBPasswordPropagationActions
resourceTO = resourceService.read(RESOURCE_NAME_TESTDB);
@@ -2321,7 +2302,7 @@ public class UserITCase extends AbstractITCase {
public void issueSYNCOPE505LDAP() throws Exception {
// 1. create user
UserTO user = UserITCase.getUniqueSampleTO("syncope505-ldap@syncope.apache.org");
- user.setPassword("security");
+ user.setPassword("security123");
user = createUser(user);
assertNotNull(user);
assertTrue(user.getResources().isEmpty());
@@ -2353,7 +2334,7 @@ public class UserITCase extends AbstractITCase {
assertNotNull(getLdapRemoteObject(
connObject.getPlainAttrMap().get(Name.NAME).getValues().get(0),
- "security",
+ "security123",
connObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
// 5. Remove LDAPPasswordPropagationActions
@@ -2377,6 +2358,7 @@ public class UserITCase extends AbstractITCase {
// 2. create existing user on csv and check that password on Syncope is null and that password on resource
// doesn't change
userTO = new UserTO();
+ userTO.setRealm(SyncopeConstants.ROOT_REALM);
userTO.setPassword(null);
userTO.setUsername("syncope391@syncope.apache.org");
userTO.getPlainAttrs().add(attrTO("fullname", "fullname"));
@@ -2402,7 +2384,7 @@ public class UserITCase extends AbstractITCase {
// 3. create user with not null password and propagate onto resource-csv, specify not to save password on
// Syncope local storage
userTO = getUniqueSampleTO("syncope391@syncope.apache.org");
- userTO.setPassword("passwordTESTNULL");
+ userTO.setPassword("passwordTESTNULL1");
userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getDerAttrs().add(attrTO("csvuserid", null));
@@ -2416,13 +2398,13 @@ public class UserITCase extends AbstractITCase {
assertNotNull(connObjectTO);
// check if password has been propagated and that saved userTO's password is null
- assertEquals("passwordTESTNULL", connObjectTO.getPlainAttrMap().
+ assertEquals("passwordTESTNULL1", connObjectTO.getPlainAttrMap().
get(OperationalAttributes.PASSWORD_NAME).getValues().get(0));
assertNull(userTO.getPassword());
// 4. create user and propagate password on resource-csv and on Syncope local storage
userTO = getUniqueSampleTO("syncope391@syncope.apache.org");
- userTO.setPassword("passwordTESTNULL");
+ userTO.setPassword("passwordTESTNULL1");
userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
userTO.getDerAttrs().add(attrTO("csvuserid", null));
@@ -2437,7 +2419,7 @@ public class UserITCase extends AbstractITCase {
assertNotNull(connObjectTO);
// check if password has been correctly propagated on Syncope and resource-csv as usual
- assertEquals("passwordTESTNULL", connObjectTO.getPlainAttrMap().
+ assertEquals("passwordTESTNULL1", connObjectTO.getPlainAttrMap().
get(OperationalAttributes.PASSWORD_NAME).getValues().get(0));
assertNotNull(userTO.getPassword());
@@ -2445,7 +2427,7 @@ public class UserITCase extends AbstractITCase {
ResourceTO csv = resourceService.read(RESOURCE_NAME_CSV);
assertNotNull(csv);
try {
- csv.setPasswordPolicy(4L);
+ csv.setPasswordPolicy(8L);
resourceService.update(RESOURCE_NAME_CSV, csv);
csv = resourceService.read(RESOURCE_NAME_CSV);
@@ -2478,7 +2460,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(12L);
+ membershipTO.setGroupKey(12L);
membershipTO.getPlainAttrs().add(attrTO("postalAddress", "postalAddress"));
userTO.getMemberships().add(membershipTO);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
index 68d8f3d..ba9b8d3 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
@@ -29,8 +29,10 @@ import java.io.IOException;
import java.io.InputStream;
import java.security.AccessControlException;
import java.util.Map;
+import java.util.Set;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.cxf.helpers.IOUtils;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.SyncopeClientException;
@@ -43,6 +45,7 @@ import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO;
import org.apache.syncope.common.lib.to.WorkflowFormTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.lib.types.SubjectType;
import org.apache.syncope.common.rest.api.Preference;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -89,7 +92,7 @@ public class UserSelfITCase extends AbstractITCase {
// self-create user with membership: goes 'createApproval' with resources and membership but no propagation
UserTO userTO = UserITCase.getUniqueSampleTO("anonymous@syncope.apache.org");
MembershipTO membership = new MembershipTO();
- membership.setGroupId(3L);
+ membership.setGroupKey(3L);
userTO.getMemberships().add(membership);
userTO.getResources().add(RESOURCE_NAME_TESTDB);
@@ -133,9 +136,8 @@ public class UserSelfITCase extends AbstractITCase {
assertNotNull(e);
}
- UserSelfService userSelfService2 = clientFactory.create("rossini", ADMIN_PWD).getService(UserSelfService.class);
- UserTO userTO = userSelfService2.read();
- assertEquals("rossini", userTO.getUsername());
+ Pair<Map<Entitlement, Set<String>>, UserTO> self = clientFactory.create("rossini", ADMIN_PWD).self();
+ assertEquals("rossini", self.getValue().getUsername());
}
@Test
@@ -234,7 +236,7 @@ public class UserSelfITCase extends AbstractITCase {
@Test
public void issueSYNCOPE373() {
- UserTO userTO = userSelfService.read();
+ UserTO userTO = adminClient.self().getValue();
assertEquals(ADMIN_UNAME, userTO.getUsername());
}
@@ -255,6 +257,10 @@ public class UserSelfITCase extends AbstractITCase {
@Test
public void passwordReset() {
+ // 0. ensure that password request DOES require security question
+ configurationService.set("passwordReset.securityQuestion",
+ attrTO("passwordReset.securityQuestion", "true"));
+
// 1. create an user with security question and answer
UserTO user = UserITCase.getUniqueSampleTO("pwdReset@syncope.apache.org");
user.setSecurityQuestion(1L);
@@ -263,7 +269,7 @@ public class UserSelfITCase extends AbstractITCase {
// 2. verify that new user is able to authenticate
SyncopeClient authClient = clientFactory.create(user.getUsername(), "password123");
- UserTO read = authClient.getService(UserSelfService.class).read();
+ UserTO read = authClient.self().getValue();
assertNotNull(read);
// 3. request password reset (as anonymous) providing the expected security answer
@@ -288,11 +294,11 @@ public class UserSelfITCase extends AbstractITCase {
assertEquals(ClientExceptionType.NotFound, e.getType());
assertTrue(e.getMessage().contains("WRONG TOKEN"));
}
- anonClient.getService(UserSelfService.class).confirmPasswordReset(token, "newPassword");
+ anonClient.getService(UserSelfService.class).confirmPasswordReset(token, "newPassword123");
// 6. verify that password was reset and token removed
- authClient = clientFactory.create(user.getUsername(), "newPassword");
- read = authClient.getService(UserSelfService.class).read();
+ authClient = clientFactory.create(user.getUsername(), "newPassword123");
+ read = authClient.self().getValue();
assertNotNull(read);
assertNull(read.getToken());
}
@@ -309,7 +315,7 @@ public class UserSelfITCase extends AbstractITCase {
// 2. verify that new user is able to authenticate
SyncopeClient authClient = clientFactory.create(user.getUsername(), "password123");
- UserTO read = authClient.getService(UserSelfService.class).read();
+ UserTO read = authClient.self().getValue();
assertNotNull(read);
// 3. request password reset (as anonymous) with no security answer
@@ -328,11 +334,11 @@ public class UserSelfITCase extends AbstractITCase {
assertEquals(ClientExceptionType.NotFound, e.getType());
assertTrue(e.getMessage().contains("WRONG TOKEN"));
}
- anonClient.getService(UserSelfService.class).confirmPasswordReset(token, "newPassword");
+ anonClient.getService(UserSelfService.class).confirmPasswordReset(token, "newPassword123");
// 6. verify that password was reset and token removed
- authClient = clientFactory.create(user.getUsername(), "newPassword");
- read = authClient.getService(UserSelfService.class).read();
+ authClient = clientFactory.create(user.getUsername(), "newPassword123");
+ read = authClient.self().getValue();
assertNotNull(read);
assertNull(read.getToken());
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
index 80c916a..a99c40c 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
@@ -56,14 +56,14 @@ public class UserWorkflowITCase extends AbstractITCase {
// User with group 9 are defined in workflow as subject to approval
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(9L);
+ membershipTO.setGroupKey(9L);
userTO.getMemberships().add(membershipTO);
// 1. create user with group 9
userTO = createUser(userTO);
assertNotNull(userTO);
assertEquals(1, userTO.getMemberships().size());
- assertEquals(9, userTO.getMemberships().get(0).getGroupId());
+ assertEquals(9, userTO.getMemberships().get(0).getGroupKey());
assertEquals("createApproval", userTO.getStatus());
// 2. request if there is any pending task for user just created
@@ -130,14 +130,14 @@ public class UserWorkflowITCase extends AbstractITCase {
// User with group 9 are defined in workflow as subject to approval
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(9L);
+ membershipTO.setGroupKey(9L);
userTO.getMemberships().add(membershipTO);
// 1. create user with group 9 (and verify that no propagation occurred)
userTO = createUser(userTO);
assertNotNull(userTO);
assertEquals(1, userTO.getMemberships().size());
- assertEquals(9, userTO.getMemberships().get(0).getGroupId());
+ assertEquals(9, userTO.getMemberships().get(0).getGroupKey());
assertEquals("createApproval", userTO.getStatus());
assertEquals(Collections.singleton(RESOURCE_NAME_TESTDB), userTO.getResources());
@@ -216,7 +216,7 @@ public class UserWorkflowITCase extends AbstractITCase {
// User with group 9 are defined in workflow as subject to approval
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(9L);
+ membershipTO.setGroupKey(9L);
userTO.getMemberships().add(membershipTO);
// 1. create user with group 9 (and verify that no propagation occurred)
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
index 6ed3871..5001e5d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
@@ -59,7 +59,7 @@ public class VirAttrITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("issue16@apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(8L);
+ membershipTO.setGroupKey(8L);
userTO.getMemberships().add(membershipTO);
// 1. create user
@@ -315,7 +315,7 @@ public class VirAttrITCase extends AbstractITCase {
UserTO toBeUpdated = userService.read(created.getKey());
UserMod userMod = new UserMod();
userMod.setKey(toBeUpdated.getKey());
- userMod.setPassword("password2");
+ userMod.setPassword("password234");
// assign new resource to user
userMod.getResourcesToAdd().add(RESOURCE_NAME_WS2);
//modify virtual attribute
@@ -330,7 +330,7 @@ public class VirAttrITCase extends AbstractITCase {
toBeUpdated = updateUser(userMod);
assertNotNull(toBeUpdated);
- assertEquals("test@testoneone.com", toBeUpdated.getVirAttrs().get(0).getValues().get(0));
+ assertEquals("test@testoneone.com", toBeUpdated.getVirAttrs().iterator().next().getValues().get(0));
// check if propagates correctly with assertEquals on size of tasks list
assertEquals(2, toBeUpdated.getPropagationStatusTOs().size());
} finally {
@@ -486,13 +486,13 @@ public class VirAttrITCase extends AbstractITCase {
// -------------------------------------------
GroupTO groupTO = new GroupTO();
groupTO.setName(groupName);
- groupTO.setParent(8L);
+ groupTO.setRealm("/");
groupTO.getGVirAttrTemplates().add("rvirtualdata");
groupTO.getVirAttrs().add(attrTO("rvirtualdata", "ml@group.it"));
groupTO.getResources().add(RESOURCE_NAME_LDAP);
groupTO = createGroup(groupTO);
assertEquals(1, groupTO.getVirAttrs().size());
- assertEquals("ml@group.it", groupTO.getVirAttrs().get(0).getValues().get(0));
+ assertEquals("ml@group.it", groupTO.getVirAttrs().iterator().next().getValues().get(0));
// -------------------------------------------
// -------------------------------------------
@@ -506,8 +506,8 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getDerAttrs().clear();
userTO.getMemberships().clear();
- final MembershipTO membership = new MembershipTO();
- membership.setGroupId(groupTO.getKey());
+ MembershipTO membership = new MembershipTO();
+ membership.setGroupKey(groupTO.getKey());
membership.getVirAttrs().add(attrTO("mvirtualdata", "mvirtualvalue"));
userTO.getMemberships().add(membership);
@@ -570,8 +570,8 @@ public class VirAttrITCase extends AbstractITCase {
final String groupName = "issueSYNCOPE458-Group-" + getUUIDString();
GroupTO groupTO = new GroupTO();
groupTO.setName(groupName);
- groupTO.setParent(2L);
- groupTO.setInheritTemplates(true);
+ groupTO.setRealm("/");
+ groupTO.getMVirAttrTemplates().add("mvirtualdata");
groupTO = createGroup(groupTO);
// -------------------------------------------
@@ -608,11 +608,11 @@ public class VirAttrITCase extends AbstractITCase {
// add membership, with virtual attribute populated, to user
MembershipTO membership = new MembershipTO();
- membership.setGroupId(groupTO.getKey());
+ membership.setGroupKey(groupTO.getKey());
membership.getVirAttrs().add(attrTO("mvirtualdata", "syncope458@syncope.apache.org"));
userTO.getMemberships().add(membership);
- //propagate user
+ // propagate user
userTO = createUser(userTO);
assertEquals(1, userTO.getPropagationStatusTOs().size());
assertTrue(userTO.getPropagationStatusTOs().get(0).getStatus().isSuccessful());
@@ -801,8 +801,8 @@ public class VirAttrITCase extends AbstractITCase {
final String groupName = "issueSYNCOPE501-Group-" + getUUIDString();
GroupTO groupTO = new GroupTO();
groupTO.setName(groupName);
- groupTO.setParent(2L);
- groupTO.setInheritTemplates(true);
+ groupTO.setRealm("/");
+ groupTO.getMVirAttrTemplates().add("mvirtualdata");
groupTO = createGroup(groupTO);
// -------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/installer/src/main/resources/izpack/install.xml
----------------------------------------------------------------------
diff --git a/installer/src/main/resources/izpack/install.xml b/installer/src/main/resources/izpack/install.xml
index e2f46a6..cef97bb 100644
--- a/installer/src/main/resources/izpack/install.xml
+++ b/installer/src/main/resources/izpack/install.xml
@@ -125,7 +125,7 @@ under the License.
</resources>
<jar src="../syncope-installer-@{syncope.version}.jar" stage="install"/>
- <jar src="lib/commons-logging-@{commons.logging.version}.jar"/>
+ <jar src="lib/commons-logging-@{commons-logging.version}.jar"/>
<jar src="lib/commons-codec-@{commons-codec.version}.jar"/>
<jar src="lib/commons-io-2.4.jar"/>
<jar src="lib/httpclient-@{httpclient.version}.jar"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2c1e1b6..cc4ee0a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -358,7 +358,7 @@ under the License.
<commons-jexl.version>2.1.1</commons-jexl.version>
<commons-lang.version>3.4</commons-lang.version>
<commons-collection.version>4.0</commons-collection.version>
- <commons.logging.version>1.1.3</commons.logging.version>
+ <commons-logging.version>1.1.3</commons-logging.version>
<h2.version>1.4.186</h2.version>
@@ -893,7 +893,7 @@ under the License.
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons.logging.version}</version>
+ <version>${commons-logging.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
[12/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..5924b16
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
@@ -0,0 +1,593 @@
+/*
+ * 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.group;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.persistence.Basic;
+import javax.persistence.Cacheable;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+import javax.validation.Valid;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.DerSchema;
+import org.apache.syncope.core.persistence.api.entity.Entitlement;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.Schema;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+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.jpa.validation.entity.GroupCheck;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractSubject;
+import org.apache.syncope.core.persistence.jpa.entity.JPAAccountPolicy;
+import org.apache.syncope.core.persistence.jpa.entity.JPAEntitlement;
+import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
+import org.apache.syncope.core.persistence.jpa.entity.JPAPasswordPolicy;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
+
+@Entity
+@Table(name = JPAGroup.TABLE, uniqueConstraints =
+ @UniqueConstraint(columnNames = { "name", "parent_id" }))
+@Cacheable
+@GroupCheck
+public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> implements Group {
+
+ private static final long serialVersionUID = -5281258853142421875L;
+
+ public static final String TABLE = "SyncopeGroup";
+
+ @Id
+ private Long id;
+
+ @NotNull
+ private String name;
+
+ @ManyToOne(optional = true)
+ private JPAGroup parent;
+
+ @ManyToOne(optional = true)
+ private JPAUser userOwner;
+
+ @ManyToOne(optional = true)
+ private JPAGroup groupOwner;
+
+ @ManyToMany(fetch = FetchType.EAGER)
+ @JoinTable(joinColumns =
+ @JoinColumn(name = "group_id"),
+ inverseJoinColumns =
+ @JoinColumn(name = "entitlement_name"))
+ private Set<JPAEntitlement> entitlements;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+ @Valid
+ private List<JPAGPlainAttrTemplate> rAttrTemplates;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+ @Valid
+ private List<JPAGDerAttrTemplate> rDerAttrTemplates;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+ @Valid
+ private List<JPAGVirAttrTemplate> rVirAttrTemplates;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+ @Valid
+ private List<JPAMPlainAttrTemplate> mAttrTemplates;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+ @Valid
+ private List<JPAMDerAttrTemplate> mDerAttrTemplates;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+ @Valid
+ private List<JPAMVirAttrTemplate> mVirAttrTemplates;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+ @Valid
+ private List<JPAGPlainAttr> plainAttrs;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+ @Valid
+ private List<JPAGDerAttr> derAttrs;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+ @Valid
+ private List<JPAGVirAttr> virAttrs;
+
+ @Basic(optional = true)
+ @Min(0)
+ @Max(1)
+ private Integer inheritOwner;
+
+ @Basic(optional = true)
+ @Min(0)
+ @Max(1)
+ private Integer inheritTemplates;
+
+ @Basic(optional = true)
+ @Min(0)
+ @Max(1)
+ private Integer inheritPlainAttrs;
+
+ @Basic(optional = true)
+ @Min(0)
+ @Max(1)
+ private Integer inheritDerAttrs;
+
+ @Basic(optional = true)
+ @Min(0)
+ @Max(1)
+ private Integer inheritVirAttrs;
+
+ @Basic(optional = true)
+ @Min(0)
+ @Max(1)
+ private Integer inheritPasswordPolicy;
+
+ @Basic(optional = true)
+ @Min(0)
+ @Max(1)
+ private Integer inheritAccountPolicy;
+
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ private JPAPasswordPolicy passwordPolicy;
+
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ private JPAAccountPolicy accountPolicy;
+
+ /**
+ * Provisioning external resources.
+ */
+ @ManyToMany(fetch = FetchType.EAGER)
+ @JoinTable(joinColumns =
+ @JoinColumn(name = "group_id"),
+ inverseJoinColumns =
+ @JoinColumn(name = "resource_name"))
+ @Valid
+ private Set<JPAExternalResource> resources;
+
+ public JPAGroup() {
+ super();
+
+ entitlements = new HashSet<>();
+
+ rAttrTemplates = new ArrayList<>();
+ rDerAttrTemplates = new ArrayList<>();
+ rVirAttrTemplates = new ArrayList<>();
+ mAttrTemplates = new ArrayList<>();
+ mDerAttrTemplates = new ArrayList<>();
+ mVirAttrTemplates = new ArrayList<>();
+
+ plainAttrs = new ArrayList<>();
+ derAttrs = new ArrayList<>();
+ virAttrs = new ArrayList<>();
+
+ inheritOwner = getBooleanAsInteger(false);
+ inheritTemplates = getBooleanAsInteger(false);
+ inheritPlainAttrs = getBooleanAsInteger(false);
+ inheritDerAttrs = getBooleanAsInteger(false);
+ inheritVirAttrs = getBooleanAsInteger(false);
+ inheritPasswordPolicy = getBooleanAsInteger(false);
+ inheritAccountPolicy = getBooleanAsInteger(false);
+
+ resources = new HashSet<>();
+ }
+
+ @Override
+ public Long getKey() {
+ return id;
+ }
+
+ @Override
+ protected Set<? extends ExternalResource> internalGetResources() {
+ return resources;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public Group getParent() {
+ return parent;
+ }
+
+ @Override
+ public void setParent(final Group parent) {
+ checkType(parent, JPAGroup.class);
+ this.parent = (JPAGroup) parent;
+ }
+
+ @Override
+ public boolean isInheritOwner() {
+ return isBooleanAsInteger(inheritOwner);
+ }
+
+ @Override
+ public void setInheritOwner(final boolean inheritOwner) {
+ this.inheritOwner = getBooleanAsInteger(inheritOwner);
+ }
+
+ @Override
+ public User getUserOwner() {
+ return userOwner;
+ }
+
+ @Override
+ public void setUserOwner(final User userOwner) {
+ checkType(userOwner, JPAUser.class);
+ this.userOwner = (JPAUser) userOwner;
+ }
+
+ @Override
+ public JPAGroup getGroupOwner() {
+ return groupOwner;
+ }
+
+ @Override
+ public void setGroupOwner(final Group group) {
+ checkType(group, JPAGroup.class);
+ this.groupOwner = (JPAGroup) group;
+ }
+
+ @Override
+ public boolean addEntitlement(final Entitlement entitlement) {
+ checkType(entitlement, JPAEntitlement.class);
+ return entitlements.add((JPAEntitlement) entitlement);
+ }
+
+ @Override
+ public boolean removeEntitlement(final Entitlement entitlement) {
+ checkType(entitlement, JPAEntitlement.class);
+ return entitlements.remove((JPAEntitlement) entitlement);
+ }
+
+ @Override
+ public Set<? extends Entitlement> getEntitlements() {
+ return entitlements;
+ }
+
+ @Override
+ public boolean isInheritTemplates() {
+ return isBooleanAsInteger(inheritTemplates);
+ }
+
+ @Override
+ public void setInheritTemplates(final boolean inheritAttrTemplates) {
+ this.inheritTemplates = getBooleanAsInteger(inheritAttrTemplates);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends AttrTemplate<K>, K extends Schema> List<T> getAttrTemplates(final Class<T> reference) {
+ List<T> result = new ArrayList<>();
+
+ if (GPlainAttrTemplate.class.isAssignableFrom(reference)) {
+ result = (List<T>) rAttrTemplates;
+ } else if (GDerAttrTemplate.class.isAssignableFrom(reference)) {
+ result = (List<T>) rDerAttrTemplates;
+ } else if (GVirAttrTemplate.class.isAssignableFrom(reference)) {
+ result = (List<T>) rVirAttrTemplates;
+ } else if (MPlainAttrTemplate.class.isAssignableFrom(reference)) {
+ result = (List<T>) mAttrTemplates;
+ } else if (MDerAttrTemplate.class.isAssignableFrom(reference)) {
+ result = (List<T>) mDerAttrTemplates;
+ } else if (MVirAttrTemplate.class.isAssignableFrom(reference)) {
+ result = (List<T>) mVirAttrTemplates;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AttrTemplate<K>, K extends Schema> T getAttrTemplate(
+ final Class<T> reference, final String schemaName) {
+
+ T result = null;
+
+ for (T template : findInheritedTemplates(reference)) {
+ if (schemaName.equals(template.getSchema().getKey())) {
+ result = template;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AttrTemplate<K>, K extends Schema> List<K> getAttrTemplateSchemas(final Class<T> reference) {
+ final List<K> result = new ArrayList<>();
+
+ for (T template : findInheritedTemplates(reference)) {
+ result.add(template.getSchema());
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AttrTemplate<K>, K extends Schema> List<T> findInheritedTemplates(final Class<T> reference) {
+ final List<T> result = new ArrayList<>(getAttrTemplates(reference));
+
+ if (isInheritTemplates() && getParent() != null) {
+ result.addAll(getParent().findInheritedTemplates(reference));
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean addPlainAttr(final GPlainAttr attr) {
+ checkType(attr, JPAGPlainAttr.class);
+ return plainAttrs.add((JPAGPlainAttr) attr);
+ }
+
+ @Override
+ public boolean removePlainAttr(final GPlainAttr attr) {
+ checkType(attr, JPAGPlainAttr.class);
+ return plainAttrs.remove((JPAGPlainAttr) attr);
+ }
+
+ @Override
+ public List<? extends GPlainAttr> getPlainAttrs() {
+ return plainAttrs;
+ }
+
+ @Override
+ public boolean addDerAttr(final GDerAttr attr) {
+ checkType(attr, JPAGDerAttr.class);
+ return derAttrs.add((JPAGDerAttr) attr);
+ }
+
+ @Override
+ public boolean removeDerAttr(final GDerAttr attr) {
+ checkType(attr, JPAGDerAttr.class);
+ return derAttrs.remove((JPAGDerAttr) attr);
+ }
+
+ @Override
+ public List<? extends GDerAttr> getDerAttrs() {
+ return derAttrs;
+ }
+
+ @Override
+ public boolean addVirAttr(final GVirAttr attr) {
+ checkType(attr, JPAGVirAttr.class);
+ return virAttrs.add((JPAGVirAttr) attr);
+ }
+
+ @Override
+ public boolean removeVirAttr(final GVirAttr attr) {
+ checkType(attr, JPAGVirAttr.class);
+ return virAttrs.remove((JPAGVirAttr) attr);
+ }
+
+ @Override
+ public List<? extends GVirAttr> getVirAttrs() {
+ return virAttrs;
+ }
+
+ @Override
+ public boolean isInheritPlainAttrs() {
+ return isBooleanAsInteger(inheritPlainAttrs);
+ }
+
+ @Override
+ public void setInheritPlainAttrs(final boolean inheritPlainAttrs) {
+ this.inheritPlainAttrs = getBooleanAsInteger(inheritPlainAttrs);
+ }
+
+ /**
+ * Get all inherited attributes from the ancestors.
+ *
+ * @return a list of inherited and only inherited attributes.
+ */
+ @Override
+ public List<? extends GPlainAttr> findLastInheritedAncestorPlainAttrs() {
+ final Map<JPAGPlainSchema, GPlainAttr> result = new HashMap<>();
+
+ if (!isInheritPlainAttrs()) {
+ return plainAttrs;
+ }
+ if (isInheritPlainAttrs() && getParent() != null) {
+ final Map<PlainSchema, GPlainAttr> attrMap = getPlainAttrMap();
+
+ // Add inherit attributes
+ for (GPlainAttr attr : getParent().findLastInheritedAncestorPlainAttrs()) {
+ if (attrMap.containsKey(attr.getSchema())) {
+ result.remove((JPAGPlainSchema) attr.getSchema());
+ }
+ result.put((JPAGPlainSchema) attr.getSchema(), attr);
+ }
+ }
+ return new ArrayList<>(result.values());
+ }
+
+ @Override
+ public boolean isInheritDerAttrs() {
+ return isBooleanAsInteger(inheritDerAttrs);
+ }
+
+ @Override
+ public void setInheritDerAttrs(final boolean inheritDerAttrs) {
+ this.inheritDerAttrs = getBooleanAsInteger(inheritDerAttrs);
+
+ }
+
+ /**
+ * Get all inherited derived attributes from the ancestors.
+ *
+ * @return a list of inherited and only inherited attributes.
+ */
+ @Override
+ public List<? extends GDerAttr> findLastInheritedAncestorDerAttrs() {
+ final Map<GDerSchema, GDerAttr> result = new HashMap<>();
+
+ if (!isInheritDerAttrs()) {
+ return derAttrs;
+ }
+ if (isInheritDerAttrs() && getParent() != null) {
+ Map<DerSchema, GDerAttr> derAttrMap = getDerAttrMap();
+
+ // Add inherit derived attributes
+ for (GDerAttr attr : getParent().findLastInheritedAncestorDerAttrs()) {
+ if (derAttrMap.containsKey(attr.getSchema())) {
+ result.remove(attr.getSchema());
+ }
+ result.put(attr.getSchema(), attr);
+ }
+ }
+ return new ArrayList<>(result.values());
+ }
+
+ @Override
+ public boolean isInheritVirAttrs() {
+ return isBooleanAsInteger(inheritVirAttrs);
+ }
+
+ @Override
+ public void setInheritVirAttrs(final boolean inheritVirAttrs) {
+ this.inheritVirAttrs = getBooleanAsInteger(inheritVirAttrs);
+
+ }
+
+ /**
+ * Get all inherited virtual attributes from the ancestors.
+ *
+ * @return a list of inherited and only inherited attributes.
+ */
+ @Override
+ public List<? extends GVirAttr> findLastInheritedAncestorVirAttrs() {
+ final Map<GVirSchema, GVirAttr> result = new HashMap<>();
+
+ if (!isInheritVirAttrs()) {
+ return virAttrs;
+ }
+
+ if (isInheritVirAttrs() && getParent() != null) {
+ Map<VirSchema, GVirAttr> virAttrMap = getVirAttrMap();
+
+ // Add inherit virtual attributes
+ for (GVirAttr attr : getParent().findLastInheritedAncestorVirAttrs()) {
+ if (virAttrMap.containsKey(attr.getSchema())) {
+ result.remove(attr.getSchema());
+ }
+ result.put(attr.getSchema(), attr);
+ }
+ }
+ return new ArrayList<>(result.values());
+ }
+
+ /**
+ * Get first valid password policy.
+ *
+ * @return parent password policy if isInheritPasswordPolicy is 'true' and parent is not null, local password policy
+ * otherwise
+ */
+ @Override
+ public PasswordPolicy getPasswordPolicy() {
+ return isInheritPasswordPolicy() && getParent() != null
+ ? getParent().getPasswordPolicy()
+ : passwordPolicy;
+ }
+
+ @Override
+ public void setPasswordPolicy(final PasswordPolicy passwordPolicy) {
+ checkType(passwordPolicy, JPAPasswordPolicy.class);
+ this.passwordPolicy = (JPAPasswordPolicy) passwordPolicy;
+ }
+
+ @Override
+ public boolean isInheritPasswordPolicy() {
+ return isBooleanAsInteger(inheritPasswordPolicy);
+ }
+
+ @Override
+ public void setInheritPasswordPolicy(final boolean inheritPasswordPolicy) {
+ this.inheritPasswordPolicy = getBooleanAsInteger(inheritPasswordPolicy);
+ }
+
+ /**
+ * Get first valid account policy.
+ *
+ * @return parent account policy if isInheritAccountPolicy is 'true' and parent is not null, local account policy
+ * otherwise.
+ */
+ @Override
+ public AccountPolicy getAccountPolicy() {
+ return isInheritAccountPolicy() && getParent() != null
+ ? getParent().getAccountPolicy()
+ : accountPolicy;
+ }
+
+ @Override
+ public void setAccountPolicy(final AccountPolicy accountPolicy) {
+ checkType(accountPolicy, JPAAccountPolicy.class);
+ this.accountPolicy = (JPAAccountPolicy) accountPolicy;
+ }
+
+ @Override
+ public boolean isInheritAccountPolicy() {
+ return isBooleanAsInteger(inheritAccountPolicy);
+ }
+
+ @Override
+ public void setInheritAccountPolicy(boolean inheritAccountPolicy) {
+ this.inheritAccountPolicy = getBooleanAsInteger(inheritAccountPolicy);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java
index f2d1ff0..698f68c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java
@@ -76,7 +76,7 @@ public class JPAMDerAttr extends AbstractDerAttr implements MDerAttr {
@Override
public void setSchema(final DerSchema schema) {
- LOG.warn("This is role attribute, set template to select schema");
+ LOG.warn("This is membership attribute, set template to select schema");
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java
index 0586c38..2139cd5 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java
@@ -24,9 +24,9 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
@Entity
@Table(name = JPAMDerAttrTemplate.TABLE)
@@ -37,7 +37,7 @@ public class JPAMDerAttrTemplate extends AbstractDerAttrTemplate<MDerSchema> imp
public static final String TABLE = "MDerAttrTemplate";
@ManyToOne
- private JPARole owner;
+ private JPAGroup owner;
@ManyToOne
@JoinColumn(name = "schema_name")
@@ -55,13 +55,13 @@ public class JPAMDerAttrTemplate extends AbstractDerAttrTemplate<MDerSchema> imp
}
@Override
- public Role getOwner() {
+ public Group getOwner() {
return owner;
}
@Override
- public void setOwner(final Role owner) {
- checkType(owner, JPARole.class);
- this.owner = (JPARole) owner;
+ public void setOwner(final Group owner) {
+ checkType(owner, JPAGroup.class);
+ this.owner = (JPAGroup) owner;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java
index 330f7ec..a6c19ff 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java
@@ -107,7 +107,7 @@ public class JPAMPlainAttr extends AbstractPlainAttr implements MPlainAttr {
@Override
public void setSchema(final PlainSchema schema) {
- LOG.warn("This is role attribute, set template to select schema");
+ LOG.warn("This is membership attribute, set template to select schema");
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java
index 7379564..7b43ec7 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java
@@ -25,9 +25,9 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
@Entity
@Table(name = JPAMPlainAttrTemplate.TABLE)
@@ -41,7 +41,7 @@ public class JPAMPlainAttrTemplate extends AbstractPlainAttrTemplate<MPlainSchem
private Long id;
@ManyToOne
- private JPARole owner;
+ private JPAGroup owner;
@ManyToOne
@JoinColumn(name = "schema_name")
@@ -64,14 +64,14 @@ public class JPAMPlainAttrTemplate extends AbstractPlainAttrTemplate<MPlainSchem
}
@Override
- public JPARole getOwner() {
+ public JPAGroup getOwner() {
return owner;
}
@Override
- public void setOwner(final Role owner) {
- checkType(owner, JPARole.class);
- this.owner = (JPARole) owner;
+ public void setOwner(final Group owner) {
+ checkType(owner, JPAGroup.class);
+ this.owner = (JPAGroup) owner;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java
index 6a1bc39..ba7fe06 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java
@@ -76,6 +76,6 @@ public class JPAMVirAttr extends AbstractVirAttr implements MVirAttr {
@Override
public void setSchema(final VirSchema schema) {
- LOG.warn("This is role attribute, set template to select schema");
+ LOG.warn("This is membership attribute, set template to select schema");
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java
index b2a90f8..da84c4d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java
@@ -24,9 +24,9 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
@Entity
@Table(name = JPAMVirAttrTemplate.TABLE)
@@ -37,7 +37,7 @@ public class JPAMVirAttrTemplate extends AbstractVirAttrTemplate<MVirSchema> imp
public static final String TABLE = "MVirAttrTemplate";
@ManyToOne
- private JPARole owner;
+ private JPAGroup owner;
@ManyToOne
@JoinColumn(name = "schema_name")
@@ -55,13 +55,13 @@ public class JPAMVirAttrTemplate extends AbstractVirAttrTemplate<MVirSchema> imp
}
@Override
- public Role getOwner() {
+ public Group getOwner() {
return owner;
}
@Override
- public void setOwner(final Role role) {
- checkType(role, JPARole.class);
- this.owner = (JPARole) role;
+ public void setOwner(final Group group) {
+ checkType(group, JPAGroup.class);
+ this.owner = (JPAGroup) group;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
index 939fbc7..2579eba 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
@@ -34,15 +34,15 @@ import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+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.jpa.entity.AbstractAttributable;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
@Entity
@Table(name = JPAMembership.TABLE, uniqueConstraints =
- @UniqueConstraint(columnNames = { "user_id", "role_id" }))
+ @UniqueConstraint(columnNames = { "user_id", "group_id" }))
public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MVirAttr> implements Membership {
private static final long serialVersionUID = 5030106264797289469L;
@@ -56,7 +56,7 @@ public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MV
private JPAUser user;
@ManyToOne
- private JPARole role;
+ private JPAGroup group;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
@Valid
@@ -84,14 +84,14 @@ public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MV
}
@Override
- public Role getRole() {
- return role;
+ public Group getGroup() {
+ return group;
}
@Override
- public void setRole(final Role role) {
- checkType(role, JPARole.class);
- this.role = (JPARole) role;
+ public void setGroup(final Group group) {
+ checkType(group, JPAGroup.class);
+ this.group = (JPAGroup) group;
}
@Override
@@ -126,9 +126,9 @@ public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MV
public boolean addDerAttr(final MDerAttr derAttr) {
checkType(derAttr, JPAMDerAttr.class);
- if (getRole() != null && derAttr.getSchema() != null) {
+ if (getGroup() != null && derAttr.getSchema() != null) {
MDerAttrTemplate found = null;
- for (MDerAttrTemplate template : getRole().findInheritedTemplates(MDerAttrTemplate.class)) {
+ for (MDerAttrTemplate template : getGroup().findInheritedTemplates(MDerAttrTemplate.class)) {
if (derAttr.getSchema().equals(template.getSchema())) {
found = template;
}
@@ -139,7 +139,7 @@ public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MV
}
}
- LOG.warn("Attribute not added because either role was not yet set, "
+ LOG.warn("Attribute not added because either group was not yet set, "
+ "schema was not specified or no template for that schema is available");
return false;
}
@@ -159,9 +159,9 @@ public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MV
public boolean addVirAttr(final MVirAttr virAttr) {
checkType(virAttr, JPAMVirAttr.class);
- if (getRole() != null && virAttr.getSchema() != null) {
+ if (getGroup() != null && virAttr.getSchema() != null) {
MVirAttrTemplate found = null;
- for (MVirAttrTemplate template : getRole().findInheritedTemplates(MVirAttrTemplate.class)) {
+ for (MVirAttrTemplate template : getGroup().findInheritedTemplates(MVirAttrTemplate.class)) {
if (virAttr.getSchema().equals(template.getSchema())) {
found = template;
}
@@ -190,6 +190,6 @@ public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MV
@Override
public String toString() {
- return "Membership[" + "id=" + id + ", " + user + ", " + role + ']';
+ return "Membership[" + "id=" + id + ", " + user + ", " + group + ']';
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttr.java
deleted file mode 100644
index 8cffa45..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttr.java
+++ /dev/null
@@ -1,82 +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.role;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttr;
-
-@Entity
-@Table(name = JPARDerAttr.TABLE)
-public class JPARDerAttr extends AbstractDerAttr implements RDerAttr {
-
- private static final long serialVersionUID = 8007080005675899946L;
-
- public static final String TABLE = "RDerAttr";
-
- @ManyToOne
- private JPARole owner;
-
- @Column(nullable = false)
- @OneToOne(cascade = CascadeType.MERGE)
- private JPARDerAttrTemplate template;
-
- @Override
- public Role getOwner() {
- return owner;
- }
-
- @Override
- public void setOwner(final Attributable<?, ?, ?> owner) {
- checkType(owner, JPARole.class);
- this.owner = (JPARole) owner;
- }
-
- @Override
- public RDerAttrTemplate getTemplate() {
- return template;
- }
-
- @Override
- public void setTemplate(final RDerAttrTemplate template) {
- checkType(template, JPARDerAttrTemplate.class);
- this.template = (JPARDerAttrTemplate) template;
- }
-
- @Override
- public RDerSchema getSchema() {
- return template == null ? null : template.getSchema();
- }
-
- @Override
- public void setSchema(final DerSchema schema) {
- LOG.warn("This is role attribute, set template to select schema");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttrTemplate.java
deleted file mode 100644
index 022358e..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttrTemplate.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.persistence.jpa.entity.role;
-
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttrTemplate;
-
-@Entity
-@Table(name = JPARDerAttrTemplate.TABLE)
-public class JPARDerAttrTemplate extends AbstractDerAttrTemplate<RDerSchema> implements RDerAttrTemplate {
-
- private static final long serialVersionUID = 624868884107016649L;
-
- public static final String TABLE = "RDerAttrTemplate";
-
- @ManyToOne
- private JPARole owner;
-
- @ManyToOne
- @JoinColumn(name = "schema_name")
- private JPARDerSchema schema;
-
- @Override
- public RDerSchema getSchema() {
- return schema;
- }
-
- @Override
- public void setSchema(final RDerSchema schema) {
- checkType(schema, JPARDerSchema.class);
- this.schema = (JPARDerSchema) schema;
- }
-
- @Override
- public Role getOwner() {
- return owner;
- }
-
- @Override
- public void setOwner(final Role owner) {
- checkType(owner, JPARole.class);
- this.owner = (JPARole) owner;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerSchema.java
deleted file mode 100644
index 2ef23fc..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerSchema.java
+++ /dev/null
@@ -1,34 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDerSchema;
-
-@Entity
-@Table(name = JPARDerSchema.TABLE)
-public class JPARDerSchema extends AbstractDerSchema implements RDerSchema {
-
- private static final long serialVersionUID = -6868889736207576372L;
-
- public static final String TABLE = "RDerSchema";
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMapping.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMapping.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMapping.java
deleted file mode 100644
index 9a5f82d..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMapping.java
+++ /dev/null
@@ -1,103 +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.role;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.role.RMapping;
-import org.apache.syncope.core.persistence.api.entity.role.RMappingItem;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractMapping;
-import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
-
-@Entity
-@Table(name = JPARMapping.TABLE)
-public class JPARMapping extends AbstractMapping<RMappingItem> implements RMapping {
-
- public static final String TABLE = "RMapping";
-
- private static final long serialVersionUID = 4578756002867863392L;
-
- @Id
- private Long id;
-
- /**
- * Resource owning this mapping.
- */
- @OneToOne
- private JPAExternalResource resource;
-
- /**
- * Attribute mappings.
- */
- @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "mapping")
- private List<JPARMappingItem> items;
-
- public JPARMapping() {
- super();
-
- items = new ArrayList<>();
- }
-
- @Override
- public Long getKey() {
- return id;
- }
-
- @Override
- public ExternalResource getResource() {
- return resource;
- }
-
- @Override
- public void setResource(final ExternalResource resource) {
- checkType(resource, JPAExternalResource.class);
- this.resource = (JPAExternalResource) resource;
- }
-
- @Override
- public void setAccountIdItem(final RMappingItem item) {
- checkType(item, JPARMappingItem.class);
- this.addAccountIdItem((JPARMappingItem) item);
- }
-
- @Override
- public List<? extends RMappingItem> getItems() {
- return items;
- }
-
- @Override
- public boolean addItem(final RMappingItem item) {
- checkType(item, JPARMappingItem.class);
- return items.contains((JPARMappingItem) item) || items.add((JPARMappingItem) item);
- }
-
- @Override
- public boolean removeItem(final RMappingItem item) {
- checkType(item, JPARMappingItem.class);
- return items.remove((JPARMappingItem) item);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMappingItem.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMappingItem.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMappingItem.java
deleted file mode 100644
index 931d543..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMappingItem.java
+++ /dev/null
@@ -1,58 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.Mapping;
-import org.apache.syncope.core.persistence.api.entity.role.RMappingItem;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractMappingItem;
-
-@Entity
-@Table(name = JPARMappingItem.TABLE)
-public class JPARMappingItem extends AbstractMappingItem implements RMappingItem {
-
- public static final String TABLE = "RMappingItem";
-
- private static final long serialVersionUID = -2670787666933476166L;
-
- @Id
- private Long id;
-
- @ManyToOne
- private JPARMapping mapping;
-
- @Override
- public Long getKey() {
- return id;
- }
-
- @Override
- public Mapping<RMappingItem> getMapping() {
- return mapping;
- }
-
- @Override
- public void setMapping(final Mapping<?> mapping) {
- checkType(mapping, JPARMapping.class);
- this.mapping = (JPARMapping) mapping;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttr.java
deleted file mode 100644
index a640d8d..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttr.java
+++ /dev/null
@@ -1,140 +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.role;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.validation.Valid;
-import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttr;
-
-@Entity
-@Table(name = JPARPlainAttr.TABLE)
-public class JPARPlainAttr extends AbstractPlainAttr implements RPlainAttr {
-
- private static final long serialVersionUID = 2848159565890995780L;
-
- public static final String TABLE = "RPlainAttr";
-
- @Id
- private Long id;
-
- @ManyToOne(fetch = FetchType.EAGER)
- private JPARole owner;
-
- @Column(nullable = false)
- @OneToOne(cascade = CascadeType.MERGE)
- private JPARPlainAttrTemplate template;
-
- @OneToMany(cascade = CascadeType.MERGE, orphanRemoval = true, mappedBy = "attribute")
- @Valid
- private List<JPARPlainAttrValue> values;
-
- @OneToOne(cascade = CascadeType.ALL, mappedBy = "attribute")
- @Valid
- private JPARPlainAttrUniqueValue uniqueValue;
-
- public JPARPlainAttr() {
- super();
- values = new ArrayList<>();
- }
-
- @Override
- public Long getKey() {
- return id;
- }
-
- @Override
- public Role getOwner() {
- return owner;
- }
-
- @Override
- public void setOwner(final Attributable<?, ?, ?> owner) {
- checkType(owner, JPARole.class);
- this.owner = (JPARole) owner;
- }
-
- @Override
- public RPlainAttrTemplate getTemplate() {
- return template;
- }
-
- @Override
- public void setTemplate(final RPlainAttrTemplate template) {
- checkType(template, JPARPlainAttrTemplate.class);
- this.template = (JPARPlainAttrTemplate) template;
- }
-
- @Override
- public RPlainSchema getSchema() {
- return template == null ? null : template.getSchema();
- }
-
- @Override
- public void setSchema(final PlainSchema schema) {
- LOG.warn("This is role attribute, set template to select schema");
- }
-
- @Override
- protected boolean addValue(final PlainAttrValue attrValue) {
- checkType(attrValue, JPARPlainAttrValue.class);
- return values.add((JPARPlainAttrValue) attrValue);
- }
-
- @Override
- public boolean removeValue(final PlainAttrValue attrValue) {
- checkType(attrValue, JPARPlainAttrValue.class);
- return values.remove((JPARPlainAttrValue) attrValue);
- }
-
- @Override
- public List<? extends RPlainAttrValue> getValues() {
- return values;
- }
-
- @Override
- public RPlainAttrUniqueValue getUniqueValue() {
- return uniqueValue;
- }
-
- @Override
- public void setUniqueValue(final PlainAttrUniqueValue uniqueValue) {
- checkType(owner, JPARPlainAttrUniqueValue.class);
- this.uniqueValue = (JPARPlainAttrUniqueValue) uniqueValue;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrTemplate.java
deleted file mode 100644
index b3e2a3c..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrTemplate.java
+++ /dev/null
@@ -1,75 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrTemplate;
-
-@Entity
-@Table(name = JPARPlainAttrTemplate.TABLE)
-public class JPARPlainAttrTemplate extends AbstractPlainAttrTemplate<RPlainSchema> implements RPlainAttrTemplate {
-
- private static final long serialVersionUID = 6943917051517266268L;
-
- public static final String TABLE = "RPlainAttrTemplate";
-
- @Id
- private Long id;
-
- @ManyToOne
- private JPARole owner;
-
- @Override
- public Long getKey() {
- return id;
- }
-
- @ManyToOne
- @JoinColumn(name = "schema_name")
- private JPARPlainSchema schema;
-
- @Override
- public RPlainSchema getSchema() {
- return schema;
- }
-
- @Override
- public void setSchema(final RPlainSchema schema) {
- checkType(schema, JPARPlainSchema.class);
- this.schema = (JPARPlainSchema) schema;
- }
-
- @Override
- public Role getOwner() {
- return owner;
- }
-
- @Override
- public void setOwner(final Role owner) {
- checkType(owner, JPARole.class);
- this.owner = (JPARole) owner;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrUniqueValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrUniqueValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrUniqueValue.java
deleted file mode 100644
index 59ffb2a..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrUniqueValue.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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
-
-@Entity
-@Table(name = JPARPlainAttrUniqueValue.TABLE)
-public class JPARPlainAttrUniqueValue extends AbstractPlainAttrValue implements RPlainAttrUniqueValue {
-
- private static final long serialVersionUID = 4681561795607192855L;
-
- public static final String TABLE = "RPlainAttrUniqueValue";
-
- @Id
- private Long id;
-
- @OneToOne(optional = false)
- private JPARPlainAttr attribute;
-
- @ManyToOne(optional = false)
- @JoinColumn(name = "schema_name")
- private JPARPlainSchema schema;
-
- @Override
- public Long getKey() {
- return id;
- }
-
- @Override
- public RPlainAttr getAttr() {
- return attribute;
- }
-
- @Override
- public void setAttr(final PlainAttr attr) {
- checkType(attr, JPARPlainAttr.class);
- this.attribute = (JPARPlainAttr) attr;
- }
-
- @Override
- public RPlainSchema getSchema() {
- return schema;
- }
-
- @Override
- public void setSchema(final PlainSchema schema) {
- checkType(schema, JPARPlainSchema.class);
- this.schema = (JPARPlainSchema) schema;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrValue.java
deleted file mode 100644
index 6db5e98..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrValue.java
+++ /dev/null
@@ -1,64 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
-
-@Entity
-@Table(name = JPARPlainAttrValue.TABLE)
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
-public class JPARPlainAttrValue extends AbstractPlainAttrValue implements RPlainAttrValue {
-
- private static final long serialVersionUID = -766808291128424707L;
-
- public static final String TABLE = "RPlainAttrValue";
-
- @Id
- private Long id;
-
- @ManyToOne
- @NotNull
- private JPARPlainAttr attribute;
-
- @Override
- public Long getKey() {
- return id;
- }
-
- @Override
- public RPlainAttr getAttr() {
- return attribute;
- }
-
- @Override
- public void setAttr(final PlainAttr attr) {
- checkType(attr, JPARPlainAttr.class);
- this.attribute = (JPARPlainAttr) attr;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainSchema.java
deleted file mode 100644
index 98d3285..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainSchema.java
+++ /dev/null
@@ -1,36 +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.role;
-
-import javax.persistence.Cacheable;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainSchema;
-
-@Entity
-@Table(name = JPARPlainSchema.TABLE)
-@Cacheable
-public class JPARPlainSchema extends AbstractPlainSchema implements RPlainSchema {
-
- private static final long serialVersionUID = -7417234690221851342L;
-
- public static final String TABLE = "RPlainSchema";
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttr.java
deleted file mode 100644
index e82282d..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttr.java
+++ /dev/null
@@ -1,82 +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.role;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttr;
-
-@Entity
-@Table(name = JPARVirAttr.TABLE)
-public class JPARVirAttr extends AbstractVirAttr implements RVirAttr {
-
- private static final long serialVersionUID = -1747430556914428649L;
-
- public static final String TABLE = "RVirAttr";
-
- @ManyToOne
- private JPARole owner;
-
- @Column(nullable = false)
- @OneToOne(cascade = CascadeType.MERGE)
- private JPARVirAttrTemplate template;
-
- @Override
- public Role getOwner() {
- return owner;
- }
-
- @Override
- public void setOwner(final Attributable<?, ?, ?> owner) {
- checkType(owner, JPARole.class);
- this.owner = (JPARole) owner;
- }
-
- @Override
- public RVirAttrTemplate getTemplate() {
- return template;
- }
-
- @Override
- public void setTemplate(final RVirAttrTemplate template) {
- checkType(template, JPARVirAttrTemplate.class);
- this.template = (JPARVirAttrTemplate) template;
- }
-
- @Override
- public RVirSchema getSchema() {
- return template == null ? null : template.getSchema();
- }
-
- @Override
- public void setSchema(final VirSchema schema) {
- LOG.warn("This is role attribute, set template to select schema");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttrTemplate.java
deleted file mode 100644
index 067eb26..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttrTemplate.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.persistence.jpa.entity.role;
-
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttrTemplate;
-
-@Entity
-@Table(name = JPARVirAttrTemplate.TABLE)
-public class JPARVirAttrTemplate extends AbstractVirAttrTemplate<RVirSchema> implements RVirAttrTemplate {
-
- private static final long serialVersionUID = 4896495904794493479L;
-
- public static final String TABLE = "RVirAttrTemplate";
-
- @ManyToOne
- private JPARole owner;
-
- @ManyToOne
- @JoinColumn(name = "schema_name")
- private JPARVirSchema schema;
-
- @Override
- public RVirSchema getSchema() {
- return schema;
- }
-
- @Override
- public void setSchema(final RVirSchema schema) {
- checkType(schema, JPARVirSchema.class);
- this.schema = (JPARVirSchema) schema;
- }
-
- @Override
- public Role getOwner() {
- return owner;
- }
-
- @Override
- public void setOwner(final Role role) {
- checkType(role, JPARole.class);
- this.owner = (JPARole) role;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirSchema.java
deleted file mode 100644
index cadf3dc..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirSchema.java
+++ /dev/null
@@ -1,36 +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.role;
-
-import javax.persistence.Cacheable;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractVirSchema;
-
-@Entity
-@Table(name = JPARVirSchema.TABLE)
-@Cacheable
-public class JPARVirSchema extends AbstractVirSchema implements RVirSchema {
-
- private static final long serialVersionUID = -2595041749349652939L;
-
- public static final String TABLE = "RVirSchema";
-
-}
[05/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/WorkflowServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/WorkflowServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/WorkflowServiceImpl.java
index d3a44e4..30229a6 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/WorkflowServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/WorkflowServiceImpl.java
@@ -50,7 +50,7 @@ public class WorkflowServiceImpl extends AbstractServiceImpl implements Workflow
if (kind == SubjectType.USER) {
logic.exportUserDefinition(accept, os);
} else {
- logic.exportRoleDefinition(accept, os);
+ logic.exportGroupDefinition(accept, os);
}
}
};
@@ -69,7 +69,7 @@ public class WorkflowServiceImpl extends AbstractServiceImpl implements Workflow
if (kind == SubjectType.USER) {
logic.exportUserDiagram(os);
} else {
- logic.exportRoleDiagram(os);
+ logic.exportGroupDiagram(os);
}
}
};
@@ -89,7 +89,7 @@ public class WorkflowServiceImpl extends AbstractServiceImpl implements Workflow
if (kind == SubjectType.USER) {
logic.importUserDefinition(contentType, definition);
} else {
- logic.importRoleDefinition(contentType, definition);
+ logic.importGroupDefinition(contentType, definition);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java
index 7b532b4..3db5052 100644
--- a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java
+++ b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java
@@ -68,7 +68,7 @@ import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.common.lib.types.WorkflowFormPropertyType;
import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.misc.security.UnauthorizedRoleException;
+import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
import org.apache.syncope.core.misc.spring.BeanUtils;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
@@ -249,7 +249,7 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
@Override
public WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO, boolean storePassword) throws
- UnauthorizedRoleException, WorkflowException {
+ UnauthorizedGroupException, WorkflowException {
return create(userTO, false, storePassword);
}
@@ -445,7 +445,7 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
@Override
public WorkflowResult<Long> execute(final UserTO userTO, final String taskId)
- throws UnauthorizedRoleException, WorkflowException {
+ throws UnauthorizedGroupException, WorkflowException {
User user = userDAO.authFetch(userTO.getKey());
@@ -709,8 +709,8 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
taskCandidateOrAssigned(user.getKey().toString())));
List<String> candidateGroups = new ArrayList<>();
- for (Long roleId : user.getRoleKeys()) {
- candidateGroups.add(roleId.toString());
+ for (Long groupId : user.getGroupKeys()) {
+ candidateGroups.add(groupId.toString());
}
if (!candidateGroups.isEmpty()) {
forms.addAll(getForms(taskService.createTaskQuery().
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupManager.java
----------------------------------------------------------------------
diff --git a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupManager.java b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupManager.java
index 96f0aeb..0033824 100644
--- a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupManager.java
+++ b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupManager.java
@@ -28,7 +28,7 @@ import org.activiti.engine.impl.GroupQueryImpl;
import org.activiti.engine.impl.Page;
import org.activiti.engine.impl.persistence.entity.GroupEntity;
import org.activiti.engine.impl.persistence.entity.GroupIdentityManager;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.user.User;
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,7 +39,7 @@ public class SyncopeGroupManager implements GroupIdentityManager, SyncopeSession
private UserDAO userDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Override
public Class<?> getType() {
@@ -53,7 +53,7 @@ public class SyncopeGroupManager implements GroupIdentityManager, SyncopeSession
@Override
public GroupQuery createNewGroupQuery() {
- return new SyncopeGroupQueryImpl(roleDAO);
+ return new SyncopeGroupQueryImpl(groupDAO);
}
@Override
@@ -67,8 +67,8 @@ public class SyncopeGroupManager implements GroupIdentityManager, SyncopeSession
User user = userDAO.find(userId);
if (user != null) {
result = new ArrayList<>();
- for (Long roleId : user.getRoleKeys()) {
- result.add(new GroupEntity(roleId.toString()));
+ for (Long groupId : user.getGroupKeys()) {
+ result.add(new GroupEntity(groupId.toString()));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupQueryImpl.java
----------------------------------------------------------------------
diff --git a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupQueryImpl.java b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupQueryImpl.java
index efa2f4d..1ec4b54 100644
--- a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupQueryImpl.java
+++ b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupQueryImpl.java
@@ -26,25 +26,24 @@ import org.activiti.engine.ActivitiException;
import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.GroupQuery;
import org.activiti.engine.impl.persistence.entity.GroupEntity;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
public class SyncopeGroupQueryImpl implements GroupQuery {
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
- private Long roleId;
+ private Long groupId;
private List<Group> result;
- public SyncopeGroupQueryImpl(final RoleDAO roleDAO) {
- this.roleDAO = roleDAO;
+ public SyncopeGroupQueryImpl(final GroupDAO groupDAO) {
+ this.groupDAO = groupDAO;
}
@Override
public GroupQuery groupId(final String groupId) {
try {
- roleId = Long.valueOf(groupId);
+ this.groupId = Long.valueOf(groupId);
} catch (NumberFormatException e) {
}
@@ -96,23 +95,23 @@ public class SyncopeGroupQueryImpl implements GroupQuery {
return this;
}
- private Group fromSyncopeRole(Role role) {
- return new GroupEntity(role.getKey().toString());
+ private Group fromSyncopeGroup(final org.apache.syncope.core.persistence.api.entity.group.Group group) {
+ return new GroupEntity(group.getKey().toString());
}
private void execute() {
- if (roleId != null) {
- Role role = roleDAO.find(roleId);
- if (role == null) {
+ if (groupId != null) {
+ org.apache.syncope.core.persistence.api.entity.group.Group syncopeGroup = groupDAO.find(groupId);
+ if (syncopeGroup == null) {
result = Collections.emptyList();
} else {
- result = Collections.singletonList(fromSyncopeRole(role));
+ result = Collections.singletonList(fromSyncopeGroup(syncopeGroup));
}
}
if (result == null) {
- result = new ArrayList<Group>();
- for (Role role : roleDAO.findAll()) {
- result.add(fromSyncopeRole(role));
+ result = new ArrayList<>();
+ for ( org.apache.syncope.core.persistence.api.entity.group.Group syncopeGroup : groupDAO.findAll()) {
+ result.add(fromSyncopeGroup(syncopeGroup));
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserManager.java
----------------------------------------------------------------------
diff --git a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserManager.java b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserManager.java
index 456d241..7112967 100644
--- a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserManager.java
+++ b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserManager.java
@@ -33,7 +33,7 @@ import org.activiti.engine.impl.persistence.entity.IdentityInfoEntity;
import org.activiti.engine.impl.persistence.entity.UserEntity;
import org.activiti.engine.impl.persistence.entity.UserIdentityManager;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,7 +43,7 @@ public class SyncopeUserManager implements UserIdentityManager, SyncopeSession {
private UserDAO userDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private EntitlementDAO entitlementDAO;
@@ -65,7 +65,7 @@ public class SyncopeUserManager implements UserIdentityManager, SyncopeSession {
@Override
public UserQuery createNewUserQuery() {
- return new SyncopeUserQueryImpl(userDAO, roleDAO, entitlementDAO);
+ return new SyncopeUserQueryImpl(userDAO, groupDAO, entitlementDAO);
}
@Override
@@ -79,8 +79,8 @@ public class SyncopeUserManager implements UserIdentityManager, SyncopeSession {
org.apache.syncope.core.persistence.api.entity.user.User user = userDAO.find(userKey);
if (user != null) {
result = new ArrayList<>();
- for (Long roleId : user.getRoleKeys()) {
- result.add(new GroupEntity(roleId.toString()));
+ for (Long groupId : user.getGroupKeys()) {
+ result.add(new GroupEntity(groupId.toString()));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java
----------------------------------------------------------------------
diff --git a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java
index f51d094..43b0306 100644
--- a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java
+++ b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java
@@ -25,18 +25,18 @@ import org.activiti.engine.ActivitiException;
import org.activiti.engine.identity.User;
import org.activiti.engine.identity.UserQuery;
import org.activiti.engine.impl.persistence.entity.UserEntity;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
public class SyncopeUserQueryImpl implements UserQuery {
private UserDAO userDAO;
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
private EntitlementDAO entitlementDAO;
@@ -46,9 +46,9 @@ public class SyncopeUserQueryImpl implements UserQuery {
private List<User> result;
- public SyncopeUserQueryImpl(final UserDAO userDAO, final RoleDAO roleDAO, final EntitlementDAO entitlementDAO) {
+ public SyncopeUserQueryImpl(final UserDAO userDAO, final GroupDAO groupDAO, final EntitlementDAO entitlementDAO) {
this.userDAO = userDAO;
- this.roleDAO = roleDAO;
+ this.groupDAO = groupDAO;
this.entitlementDAO = entitlementDAO;
}
@@ -142,18 +142,18 @@ public class SyncopeUserQueryImpl implements UserQuery {
if (user == null) {
result = Collections.<User>emptyList();
} else {
- if (memberOf == null || user.getRoleKeys().contains(memberOf)) {
+ if (memberOf == null || user.getGroupKeys().contains(memberOf)) {
result = Collections.singletonList(fromSyncopeUser(user));
}
}
}
if (memberOf != null) {
- Role role = roleDAO.find(memberOf);
- if (role == null) {
+ Group group = groupDAO.find(memberOf);
+ if (group == null) {
result = Collections.<User>emptyList();
} else {
result = new ArrayList<>();
- List<Membership> memberships = roleDAO.findMemberships(role);
+ List<Membership> memberships = groupDAO.findMemberships(group);
User user;
for (Membership membership : memberships) {
user = fromSyncopeUser(membership.getUser());
@@ -168,7 +168,7 @@ public class SyncopeUserQueryImpl implements UserQuery {
result = new ArrayList<>();
List<org.apache.syncope.core.persistence.api.entity.user.User> users =
- userDAO.findAll(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), page, itemsPerPage);
+ userDAO.findAll(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), page, itemsPerPage);
for (org.apache.syncope.core.persistence.api.entity.user.User user : users) {
result.add(fromSyncopeUser(user));
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-activiti/src/main/resources/workflow.properties
----------------------------------------------------------------------
diff --git a/core/workflow-activiti/src/main/resources/workflow.properties b/core/workflow-activiti/src/main/resources/workflow.properties
index 04e7d05..5a975cf 100644
--- a/core/workflow-activiti/src/main/resources/workflow.properties
+++ b/core/workflow-activiti/src/main/resources/workflow.properties
@@ -17,4 +17,4 @@
wf.directory=${conf.directory}
jobExecutorActivate=true
uwfAdapter=org.apache.syncope.core.workflow.activiti.ActivitiUserWorkflowAdapter
-rwfAdapter=org.apache.syncope.core.workflow.java.DefaultRoleWorkflowAdapter
\ No newline at end of file
+gwfAdapter=org.apache.syncope.core.workflow.java.DefaultGroupWorkflowAdapter
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/GroupWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/GroupWorkflowAdapter.java b/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/GroupWorkflowAdapter.java
new file mode 100644
index 0000000..26864ba
--- /dev/null
+++ b/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/GroupWorkflowAdapter.java
@@ -0,0 +1,61 @@
+/*
+ * 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.workflow.api;
+
+import org.apache.syncope.core.provisioning.api.WorkflowResult;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.GroupTO;
+
+/**
+ * Interface for calling underlying workflow implementations.
+ */
+public interface GroupWorkflowAdapter extends WorkflowAdapter {
+
+ /**
+ * Create a group.
+ *
+ * @param groupTO group to be created and whether to propagate it as active
+ * @return group just created
+ */
+ WorkflowResult<Long> create(GroupTO groupTO);
+
+ /**
+ * Execute a task on a group.
+ *
+ * @param groupTO group to be subject to task
+ * @param taskId to be executed
+ * @return group just updated
+ */
+ WorkflowResult<Long> execute(GroupTO groupTO, String taskId);
+
+ /**
+ * Update a group.
+ *
+ * @param groupMod modification set to be performed
+ * @return group just updated and propagations to be performed
+ */
+ WorkflowResult<Long> update(GroupMod groupMod);
+
+ /**
+ * Delete a group.
+ *
+ * @param groupKey group to be deleted
+ */
+ void delete(Long groupKey);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/RoleWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/RoleWorkflowAdapter.java b/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/RoleWorkflowAdapter.java
deleted file mode 100644
index ce67a4d..0000000
--- a/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/RoleWorkflowAdapter.java
+++ /dev/null
@@ -1,71 +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.workflow.api;
-
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-
-/**
- * Interface for calling underlying workflow implementations.
- */
-public interface RoleWorkflowAdapter extends WorkflowAdapter {
-
- /**
- * Create a role.
- *
- * @param roleTO role to be created and wether to propagate it as active
- * @return role just created
- * @throws WorkflowException workflow exception
- */
- WorkflowResult<Long> create(RoleTO roleTO) throws WorkflowException;
-
- /**
- * Execute a task on a role.
- *
- * @param roleTO role to be subject to task
- * @param taskId to be executed
- * @return role just updated
- * @throws NotFoundException role not found exception
- * @throws WorkflowException workflow exception
- */
- WorkflowResult<Long> execute(RoleTO roleTO, String taskId)
- throws NotFoundException, WorkflowException;
-
- /**
- * Update a role.
- *
- * @param roleMod modification set to be performed
- * @return role just updated and propagations to be performed
- * @throws NotFoundException role not found exception
- * @throws WorkflowException workflow exception
- */
- WorkflowResult<Long> update(RoleMod roleMod)
- throws NotFoundException, WorkflowException;
-
- /**
- * Delete a role.
- *
- * @param roleKey role to be deleted
- * @throws NotFoundException role not found exception
- * @throws WorkflowException workflow exception
- */
- void delete(Long roleKey) throws NotFoundException, WorkflowException;
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java b/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java
index 6475bcc..f91b83f 100644
--- a/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java
+++ b/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java
@@ -35,10 +35,8 @@ public interface UserWorkflowAdapter extends WorkflowAdapter {
* @param userTO user to be created and whether to propagate it as active
* @param storePassword whether password shall be stored into the internal storage
* @return user just created
- * @throws WorkflowException workflow exception
*/
- WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO, boolean storePassword)
- throws WorkflowException;
+ WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO, boolean storePassword);
/**
* Create an user, optionally disabling password policy check.
@@ -47,10 +45,9 @@ public interface UserWorkflowAdapter extends WorkflowAdapter {
* @param disablePwdPolicyCheck disable password policy check?
* @param storePassword whether password shall be stored into the internal storage
* @return user just created
- * @throws WorkflowException workflow exception
*/
- WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO, boolean disablePwdPolicyCheck,
- boolean storePassword) throws WorkflowException;
+ WorkflowResult<Map.Entry<Long, Boolean>> create(
+ UserTO userTO, boolean disablePwdPolicyCheck, boolean storePassword);
/**
* Create an user, optionally disabling password policy check.
@@ -60,10 +57,9 @@ public interface UserWorkflowAdapter extends WorkflowAdapter {
* @param enabled specify true/false to force active/supended status
* @param storePassword whether password shall be stored into the internal storage
* @return user just created
- * @throws WorkflowException workflow exception
*/
- WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO, boolean disablePwdPolicyCheck, final Boolean enabled,
- boolean storePassword) throws WorkflowException;
+ WorkflowResult<Map.Entry<Long, Boolean>> create(
+ UserTO userTO, boolean disablePwdPolicyCheck, final Boolean enabled, boolean storePassword);
/**
* Execute a task on an user.
@@ -71,9 +67,8 @@ public interface UserWorkflowAdapter extends WorkflowAdapter {
* @param userTO user to be subject to task
* @param taskId to be executed
* @return user just updated
- * @throws WorkflowException workflow exception
*/
- WorkflowResult<Long> execute(UserTO userTO, String taskId) throws WorkflowException;
+ WorkflowResult<Long> execute(UserTO userTO, String taskId);
/**
* Activate an user.
@@ -81,54 +76,47 @@ public interface UserWorkflowAdapter extends WorkflowAdapter {
* @param userKey user to be activated
* @param token to be verified for activation
* @return user just updated
- * @throws WorkflowException workflow exception
*/
- WorkflowResult<Long> activate(Long userKey, String token) throws WorkflowException;
+ WorkflowResult<Long> activate(Long userKey, String token);
/**
* Update an user.
*
* @param userMod modification set to be performed
* @return user just updated and propagations to be performed
- * @throws WorkflowException workflow exception
*/
- WorkflowResult<Map.Entry<UserMod, Boolean>> update(UserMod userMod)
- throws WorkflowException;
+ WorkflowResult<Map.Entry<UserMod, Boolean>> update(UserMod userMod);
/**
* Suspend an user.
*
* @param userKey user to be suspended
* @return user just suspended
- * @throws WorkflowException workflow exception
*/
- WorkflowResult<Long> suspend(Long userKey) throws WorkflowException;
+ WorkflowResult<Long> suspend(Long userKey);
/**
* Suspend an user.
*
* @param user to be suspended
* @return user just suspended
- * @throws WorkflowException workflow exception
*/
- WorkflowResult<Long> suspend(User user) throws WorkflowException;
+ WorkflowResult<Long> suspend(User user);
/**
* Reactivate an user.
*
* @param userKey user to be reactivated
* @return user just reactivated
- * @throws WorkflowException workflow exception
*/
- WorkflowResult<Long> reactivate(Long userKey) throws WorkflowException;
+ WorkflowResult<Long> reactivate(Long userKey);
/**
* Request password reset for an user.
*
* @param userKey user requesting password reset
- * @throws WorkflowException workflow exception
*/
- void requestPasswordReset(Long userKey) throws WorkflowException;
+ void requestPasswordReset(Long userKey);
/**
* Confirm password reset for an user.
@@ -136,16 +124,13 @@ public interface UserWorkflowAdapter extends WorkflowAdapter {
* @param userKey user confirming password reset
* @param token security token
* @param password new password value
- * @throws WorkflowException workflow exception
*/
- void confirmPasswordReset(Long userKey, String token, String password)
- throws WorkflowException;
+ void confirmPasswordReset(Long userKey, String token, String password);
/**
* Delete an user.
*
* @param userKey user to be deleted
- * @throws WorkflowException workflow exception
*/
- void delete(Long userKey) throws WorkflowException;
+ void delete(Long userKey);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/WorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/WorkflowAdapter.java b/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/WorkflowAdapter.java
index 85d8822..0c92d66 100644
--- a/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/WorkflowAdapter.java
+++ b/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/WorkflowAdapter.java
@@ -23,7 +23,6 @@ import java.io.OutputStream;
import java.util.List;
import org.apache.syncope.common.lib.mod.AbstractAttributableMod;
import org.apache.syncope.common.lib.to.WorkflowFormTO;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
public interface WorkflowAdapter {
@@ -37,26 +36,23 @@ public interface WorkflowAdapter {
*
* @param format export format
* @param os export stream
- * @throws WorkflowException workflow exception
*/
- void exportDefinition(WorkflowDefinitionFormat format, OutputStream os) throws WorkflowException;
+ void exportDefinition(WorkflowDefinitionFormat format, OutputStream os);
/**
* Export workflow graphical representation (if available).
*
* @param os export stream
- * @throws WorkflowException workflow exception
*/
- void exportDiagram(OutputStream os) throws WorkflowException;
+ void exportDiagram(OutputStream os);
/**
* Update workflow definition.
*
* @param format import format
* @param definition definition
- * @throws WorkflowException workflow exception
*/
- void importDefinition(WorkflowDefinitionFormat format, String definition) throws WorkflowException;
+ void importDefinition(WorkflowDefinitionFormat format, String definition);
/**
* Get all defined forms for current workflow process instances.
@@ -79,29 +75,22 @@ public interface WorkflowAdapter {
*
* @param workflowId workflow id
* @return form (if present), otherwise null
- * @throws NotFoundException definition not found exception
- * @throws WorkflowException workflow exception
*/
- WorkflowFormTO getForm(String workflowId) throws NotFoundException, WorkflowException;
+ WorkflowFormTO getForm(String workflowId);
/**
* Claim a form for a given user.
*
* @param taskId Workflow task to which the form is associated
* @return updated form
- * @throws NotFoundException not found exception
- * @throws WorkflowException workflow exception
*/
- WorkflowFormTO claimForm(String taskId) throws NotFoundException, WorkflowException;
+ WorkflowFormTO claimForm(String taskId);
/**
* Submit a form.
*
* @param form to be submitted
* @return user updated by this form submit
- * @throws NotFoundException not found exception
- * @throws WorkflowException workflow exception
*/
- WorkflowResult<? extends AbstractAttributableMod> submitForm(WorkflowFormTO form)
- throws NotFoundException, WorkflowException;
+ WorkflowResult<? extends AbstractAttributableMod> submitForm(WorkflowFormTO form);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractGroupWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractGroupWorkflowAdapter.java b/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractGroupWorkflowAdapter.java
new file mode 100644
index 0000000..27a8c74
--- /dev/null
+++ b/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractGroupWorkflowAdapter.java
@@ -0,0 +1,66 @@
+/*
+ * 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.workflow.java;
+
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.provisioning.api.WorkflowResult;
+import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
+import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
+import org.apache.syncope.core.workflow.api.WorkflowException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional(rollbackFor = { Throwable.class })
+public abstract class AbstractGroupWorkflowAdapter implements GroupWorkflowAdapter {
+
+ @Autowired
+ protected GroupDataBinder dataBinder;
+
+ @Autowired
+ protected GroupDAO groupDAO;
+
+ @Autowired
+ protected EntityFactory entityFactory;
+
+ @Override
+ public String getPrefix() {
+ return null;
+ }
+
+ protected abstract WorkflowResult<Long> doUpdate(Group group, GroupMod groupMod)
+ throws WorkflowException;
+
+ @Override
+ public WorkflowResult<Long> update(final GroupMod groupMod)
+ throws NotFoundException, WorkflowException {
+
+ return doUpdate(groupDAO.authFetch(groupMod.getKey()), groupMod);
+ }
+
+ protected abstract void doDelete(Group group) throws WorkflowException;
+
+ @Override
+ public void delete(final Long groupKey) throws NotFoundException, WorkflowException {
+ doDelete(groupDAO.authFetch(groupKey));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractRoleWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractRoleWorkflowAdapter.java b/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractRoleWorkflowAdapter.java
deleted file mode 100644
index 54e00ab..0000000
--- a/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractRoleWorkflowAdapter.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.workflow.java;
-
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
-import org.apache.syncope.core.persistence.api.entity.EntityFactory;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.data.RoleDataBinder;
-import org.apache.syncope.core.workflow.api.RoleWorkflowAdapter;
-import org.apache.syncope.core.workflow.api.WorkflowException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional(rollbackFor = { Throwable.class })
-public abstract class AbstractRoleWorkflowAdapter implements RoleWorkflowAdapter {
-
- @Autowired
- protected RoleDataBinder dataBinder;
-
- @Autowired
- protected RoleDAO roleDAO;
-
- @Autowired
- protected EntityFactory entityFactory;
-
- @Override
- public String getPrefix() {
- return null;
- }
-
- protected abstract WorkflowResult<Long> doUpdate(Role role, RoleMod roleMod)
- throws WorkflowException;
-
- @Override
- public WorkflowResult<Long> update(final RoleMod roleMod)
- throws NotFoundException, WorkflowException {
-
- return doUpdate(roleDAO.authFetch(roleMod.getKey()), roleMod);
- }
-
- protected abstract void doDelete(Role role) throws WorkflowException;
-
- @Override
- public void delete(final Long roleKey) throws NotFoundException, WorkflowException {
- doDelete(roleDAO.authFetch(roleKey));
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultGroupWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultGroupWorkflowAdapter.java b/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultGroupWorkflowAdapter.java
new file mode 100644
index 0000000..5fc683a
--- /dev/null
+++ b/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultGroupWorkflowAdapter.java
@@ -0,0 +1,129 @@
+/*
+ * 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.workflow.java;
+
+import java.io.OutputStream;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.WorkflowFormTO;
+import org.apache.syncope.common.lib.types.PropagationByResource;
+import org.apache.syncope.common.lib.types.ResourceOperation;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.provisioning.api.WorkflowResult;
+import org.apache.syncope.core.workflow.api.WorkflowDefinitionFormat;
+import org.apache.syncope.core.workflow.api.WorkflowException;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Simple implementation basically not involving any workflow engine.
+ */
+@Transactional(rollbackFor = { Throwable.class })
+public class DefaultGroupWorkflowAdapter extends AbstractGroupWorkflowAdapter {
+
+ @Override
+ public WorkflowResult<Long> create(final GroupTO groupTO) throws WorkflowException {
+ Group group = entityFactory.newEntity(Group.class);
+ dataBinder.create(group, groupTO);
+ group = groupDAO.save(group);
+
+ final PropagationByResource propByRes = new PropagationByResource();
+ propByRes.set(ResourceOperation.CREATE, group.getResourceNames());
+
+ return new WorkflowResult<>(group.getKey(), propByRes, "create");
+ }
+
+ @Override
+ protected WorkflowResult<Long> doUpdate(final Group group, final GroupMod groupMod)
+ throws WorkflowException {
+
+ PropagationByResource propByRes = dataBinder.update(group, groupMod);
+
+ Group updated = groupDAO.save(group);
+
+ return new WorkflowResult<>(updated.getKey(), propByRes, "update");
+ }
+
+ @Override
+ protected void doDelete(final Group group)
+ throws WorkflowException {
+
+ groupDAO.delete(group);
+ }
+
+ @Override
+ public WorkflowResult<Long> execute(final GroupTO group, final String taskId)
+ throws NotFoundException, WorkflowException {
+
+ throw new WorkflowException(new UnsupportedOperationException("Not supported."));
+ }
+
+ @Override
+ public void exportDefinition(final WorkflowDefinitionFormat format, final OutputStream os)
+ throws WorkflowException {
+
+ throw new WorkflowException(new UnsupportedOperationException("Not supported."));
+ }
+
+ @Override
+ public void exportDiagram(final OutputStream os) throws WorkflowException {
+ throw new WorkflowException(new UnsupportedOperationException("Not supported."));
+ }
+
+ @Override
+ public void importDefinition(final WorkflowDefinitionFormat format, final String definition)
+ throws NotFoundException, WorkflowException {
+
+ throw new WorkflowException(new UnsupportedOperationException("Not supported."));
+ }
+
+ @Override
+ public List<WorkflowFormTO> getForms() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List<WorkflowFormTO> getForms(final String workflowId, final String name) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public WorkflowFormTO getForm(final String workflowId)
+ throws NotFoundException, WorkflowException {
+
+ return null;
+ }
+
+ @Override
+ public WorkflowFormTO claimForm(final String taskId)
+ throws NotFoundException, WorkflowException {
+
+ throw new WorkflowException(new UnsupportedOperationException("Not supported."));
+ }
+
+ @Override
+ public WorkflowResult<GroupMod> submitForm(final WorkflowFormTO form)
+ throws NotFoundException, WorkflowException {
+
+ throw new WorkflowException(new UnsupportedOperationException("Not supported."));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultRoleWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultRoleWorkflowAdapter.java b/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultRoleWorkflowAdapter.java
deleted file mode 100644
index d4f8b52..0000000
--- a/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultRoleWorkflowAdapter.java
+++ /dev/null
@@ -1,129 +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.workflow.java;
-
-import java.io.OutputStream;
-import java.util.Collections;
-import java.util.List;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.to.WorkflowFormTO;
-import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.workflow.api.WorkflowDefinitionFormat;
-import org.apache.syncope.core.workflow.api.WorkflowException;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Simple implementation basically not involving any workflow engine.
- */
-@Transactional(rollbackFor = { Throwable.class })
-public class DefaultRoleWorkflowAdapter extends AbstractRoleWorkflowAdapter {
-
- @Override
- public WorkflowResult<Long> create(final RoleTO roleTO) throws WorkflowException {
- Role role = entityFactory.newEntity(Role.class);
- dataBinder.create(role, roleTO);
- role = roleDAO.save(role);
-
- final PropagationByResource propByRes = new PropagationByResource();
- propByRes.set(ResourceOperation.CREATE, role.getResourceNames());
-
- return new WorkflowResult<>(role.getKey(), propByRes, "create");
- }
-
- @Override
- protected WorkflowResult<Long> doUpdate(final Role role, final RoleMod roleMod)
- throws WorkflowException {
-
- PropagationByResource propByRes = dataBinder.update(role, roleMod);
-
- Role updated = roleDAO.save(role);
-
- return new WorkflowResult<>(updated.getKey(), propByRes, "update");
- }
-
- @Override
- protected void doDelete(final Role role)
- throws WorkflowException {
-
- roleDAO.delete(role);
- }
-
- @Override
- public WorkflowResult<Long> execute(RoleTO roleTO, String taskId)
- throws NotFoundException, WorkflowException {
-
- throw new WorkflowException(new UnsupportedOperationException("Not supported."));
- }
-
- @Override
- public void exportDefinition(final WorkflowDefinitionFormat format, final OutputStream os)
- throws WorkflowException {
-
- throw new WorkflowException(new UnsupportedOperationException("Not supported."));
- }
-
- @Override
- public void exportDiagram(final OutputStream os) throws WorkflowException {
- throw new WorkflowException(new UnsupportedOperationException("Not supported."));
- }
-
- @Override
- public void importDefinition(final WorkflowDefinitionFormat format, final String definition)
- throws NotFoundException, WorkflowException {
-
- throw new WorkflowException(new UnsupportedOperationException("Not supported."));
- }
-
- @Override
- public List<WorkflowFormTO> getForms() {
- return Collections.emptyList();
- }
-
- @Override
- public List<WorkflowFormTO> getForms(final String workflowId, final String name) {
- return Collections.emptyList();
- }
-
- @Override
- public WorkflowFormTO getForm(final String workflowId)
- throws NotFoundException, WorkflowException {
-
- return null;
- }
-
- @Override
- public WorkflowFormTO claimForm(final String taskId)
- throws NotFoundException, WorkflowException {
-
- throw new WorkflowException(new UnsupportedOperationException("Not supported."));
- }
-
- @Override
- public WorkflowResult<RoleMod> submitForm(final WorkflowFormTO form)
- throws NotFoundException, WorkflowException {
-
- throw new WorkflowException(new UnsupportedOperationException("Not supported."));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-java/src/main/resources/workflow.properties
----------------------------------------------------------------------
diff --git a/core/workflow-java/src/main/resources/workflow.properties b/core/workflow-java/src/main/resources/workflow.properties
index 9f0e35e..7167164 100644
--- a/core/workflow-java/src/main/resources/workflow.properties
+++ b/core/workflow-java/src/main/resources/workflow.properties
@@ -17,4 +17,4 @@
wf.directory=${conf.directory}
jobExecutorActivate=false
uwfAdapter=org.apache.syncope.core.workflow.java.DefaultUserWorkflowAdapter
-rwfAdapter=org.apache.syncope.core.workflow.java.DefaultRoleWorkflowAdapter
\ No newline at end of file
+gwfAdapter=org.apache.syncope.core.workflow.java.DefaultGroupWorkflowAdapter
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/workflow-java/src/main/resources/workflowContext.xml
----------------------------------------------------------------------
diff --git a/core/workflow-java/src/main/resources/workflowContext.xml b/core/workflow-java/src/main/resources/workflowContext.xml
index 54ac139..8a6935e 100644
--- a/core/workflow-java/src/main/resources/workflowContext.xml
+++ b/core/workflow-java/src/main/resources/workflowContext.xml
@@ -23,6 +23,6 @@ under the License.
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="uwfAdapter" class="${uwfAdapter}"/>
- <bean id="rwfAdapter" class="${rwfAdapter}"/>
+ <bean id="gwfAdapter" class="${gwfAdapter}"/>
</beans>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/deb/core/pom.xml
----------------------------------------------------------------------
diff --git a/deb/core/pom.xml b/deb/core/pom.xml
index 5b50a6e..45183a4 100644
--- a/deb/core/pom.xml
+++ b/deb/core/pom.xml
@@ -157,7 +157,7 @@ under the License.
<includes>
<include>provisioning.properties</include>
<include>userRoutes.xml</include>
- <include>roleRoutes.xml</include>
+ <include>groupRoutes.xml</include>
</includes>
<targetPath>${project.build.directory}/etc</targetPath>
<filtering>true</filtering>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/deb/core/src/deb/control/conffiles
----------------------------------------------------------------------
diff --git a/deb/core/src/deb/control/conffiles b/deb/core/src/deb/control/conffiles
index a8458f8..3bdc093 100644
--- a/deb/core/src/deb/control/conffiles
+++ b/deb/core/src/deb/control/conffiles
@@ -7,7 +7,7 @@
/etc/apache-syncope/mail.properties
/etc/apache-syncope/persistence.properties
/etc/apache-syncope/provisioning.properties
-/etc/apache-syncope/roleRoutes.xml
+/etc/apache-syncope/groupRoutes.xml
/etc/apache-syncope/security.properties
/etc/apache-syncope/userRoutes.xml
/etc/apache-syncope/userWorkflow.bpmn20.xml
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/deb/core/src/deb/control/control
----------------------------------------------------------------------
diff --git a/deb/core/src/deb/control/control b/deb/core/src/deb/control/control
index 2b41faf..e9563a3 100644
--- a/deb/core/src/deb/control/control
+++ b/deb/core/src/deb/control/control
@@ -9,6 +9,6 @@ Description: Apache Syncope Core Web Application
Apache Syncope is an Open Source system for managing digital identities in enterprise environments,
implemented in JEE technology and released under Apache 2.0 license.
Identity management (or IdM) represents the joint result of business process and IT to manage user data
- on systems and applications. IdM involves considering user attributes, roles, resources and
+ on systems and applications. IdM involves considering user attributes, groups, resources and
entitlements in trying to give a decent answer to the question bumping up every time in an
IT administrator's mind: Who has access to What, When, How, and Why?
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutePanel.java
----------------------------------------------------------------------
diff --git a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutePanel.java b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutePanel.java
index e96dab5..597f327 100644
--- a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutePanel.java
+++ b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutePanel.java
@@ -145,8 +145,8 @@ public class CamelRoutePanel extends AbstractExtensionPanel {
if (restClient.isCamelEnabledFor(SubjectType.USER)) {
list.addAll(restClient.list(SubjectType.USER));
}
- if (restClient.isCamelEnabledFor(SubjectType.ROLE)) {
- list.addAll(restClient.list(SubjectType.ROLE));
+ if (restClient.isCamelEnabledFor(SubjectType.GROUP)) {
+ list.addAll(restClient.list(SubjectType.GROUP));
}
Collections.sort(list, comparator);
@@ -159,8 +159,8 @@ public class CamelRoutePanel extends AbstractExtensionPanel {
return (restClient.isCamelEnabledFor(SubjectType.USER)
? restClient.list(SubjectType.USER).size()
: 0)
- + (restClient.isCamelEnabledFor(SubjectType.ROLE)
- ? restClient.list(SubjectType.ROLE).size()
+ + (restClient.isCamelEnabledFor(SubjectType.GROUP)
+ ? restClient.list(SubjectType.GROUP).size()
: 0);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRouteRestClient.java
----------------------------------------------------------------------
diff --git a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRouteRestClient.java b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRouteRestClient.java
index 509f208..2ccbe6c 100644
--- a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRouteRestClient.java
+++ b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRouteRestClient.java
@@ -47,7 +47,7 @@ public class CamelRouteRestClient extends BaseRestClient {
public boolean isCamelEnabledFor(final SubjectType subjectType) {
return subjectType == SubjectType.USER
? SyncopeSession.get().getSyncopeTO().getUserProvisioningManager().indexOf("Camel") != -1
- : SyncopeSession.get().getSyncopeTO().getRoleProvisioningManager().indexOf("Camel") != -1;
+ : SyncopeSession.get().getSyncopeTO().getGroupProvisioningManager().indexOf("Camel") != -1;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/logic/src/main/java/org/apache/syncope/core/logic/init/CamelRouteLoader.java
----------------------------------------------------------------------
diff --git a/ext/camel/logic/src/main/java/org/apache/syncope/core/logic/init/CamelRouteLoader.java b/ext/camel/logic/src/main/java/org/apache/syncope/core/logic/init/CamelRouteLoader.java
index eaae724..3fe8592 100644
--- a/ext/camel/logic/src/main/java/org/apache/syncope/core/logic/init/CamelRouteLoader.java
+++ b/ext/camel/logic/src/main/java/org/apache/syncope/core/logic/init/CamelRouteLoader.java
@@ -53,8 +53,8 @@ public class CamelRouteLoader implements SyncopeLoader {
@javax.annotation.Resource(name = "userRoutes")
private ResourceWithFallbackLoader userRoutesLoader;
- @javax.annotation.Resource(name = "roleRoutes")
- private ResourceWithFallbackLoader roleRoutesLoader;
+ @javax.annotation.Resource(name = "groupRoutes")
+ private ResourceWithFallbackLoader groupRoutesLoader;
@Autowired
private DataSource dataSource;
@@ -74,7 +74,7 @@ public class CamelRouteLoader implements SyncopeLoader {
synchronized (this) {
if (!loaded) {
loadRoutes(userRoutesLoader.getResource(), SubjectType.USER);
- loadRoutes(roleRoutesLoader.getResource(), SubjectType.ROLE);
+ loadRoutes(groupRoutesLoader.getResource(), SubjectType.GROUP);
loadEntitlements();
loaded = true;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
new file mode 100644
index 0000000..8ab600a
--- /dev/null
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
@@ -0,0 +1,175 @@
+/*
+ * 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.provisioning.camel;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.camel.Exchange;
+import org.apache.camel.PollingConsumer;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.core.provisioning.api.GroupProvisioningManager;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
+
+public class CamelGroupProvisioningManager
+ extends AbstractCamelProvisioningManager implements GroupProvisioningManager {
+
+ @Override
+ public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO subject) {
+ return create(subject, Collections.<String>emptySet());
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO groupTO, final Set<String> excludedResources) {
+ PollingConsumer pollingConsumer = getConsumer("direct:createGroupPort");
+
+ Map<String, Object> props = new HashMap<>();
+ props.put("excludedResources", excludedResources);
+
+ sendMessage("direct:createGroup", groupTO, props);
+
+ Exchange exchange = pollingConsumer.receive();
+
+ if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
+ throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
+ }
+
+ return exchange.getIn().getBody(Map.Entry.class);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO groupTO, final Map<Long, String> groupOwnerMap,
+ final Set<String> excludedResources) throws PropagationException {
+
+ PollingConsumer pollingConsumer = getConsumer("direct:createGroupInSyncPort");
+
+ Map<String, Object> props = new HashMap<>();
+ props.put("groupOwnerMap", groupOwnerMap);
+ props.put("excludedResources", excludedResources);
+
+ sendMessage("direct:createGroupInSync", groupTO, props);
+
+ Exchange exchange = pollingConsumer.receive();
+
+ if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
+ throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
+ }
+
+ return exchange.getIn().getBody(Map.Entry.class);
+ }
+
+ @Override
+ public Map.Entry<Long, List<PropagationStatus>> update(final GroupMod subjectMod) {
+ return update(subjectMod, Collections.<String>emptySet());
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Map.Entry<Long, List<PropagationStatus>> update(
+ final GroupMod subjectMod, final Set<String> excludedResources) {
+
+ PollingConsumer pollingConsumer = getConsumer("direct:updateGroupPort");
+
+ Map<String, Object> props = new HashMap<>();
+ props.put("excludedResources", excludedResources);
+
+ sendMessage("direct:updateGroup", subjectMod, props);
+
+ Exchange exchange = pollingConsumer.receive();
+
+ if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
+ throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
+ }
+
+ return exchange.getIn().getBody(Map.Entry.class);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<PropagationStatus> delete(final Long groupKey) {
+ PollingConsumer pollingConsumer = getConsumer("direct:deleteGroupPort");
+
+ sendMessage("direct:deleteGroup", groupKey);
+
+ Exchange exchange = pollingConsumer.receive();
+
+ if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
+ throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
+ }
+
+ return exchange.getIn().getBody(List.class);
+ }
+
+ @Override
+ public Long unlink(final GroupMod groupMod) {
+ PollingConsumer pollingConsumer = getConsumer("direct:unlinkGroupPort");
+
+ sendMessage("direct:unlinkGroup", groupMod);
+
+ Exchange exchange = pollingConsumer.receive();
+
+ if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
+ throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
+ }
+
+ return exchange.getIn().getBody(Long.class);
+ }
+
+ @Override
+ public Long link(final GroupMod groupMod) {
+ PollingConsumer pollingConsumer = getConsumer("direct:linkGroupPort");
+
+ sendMessage("direct:linkGroup", groupMod);
+
+ Exchange exchange = pollingConsumer.receive();
+
+ if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
+ throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
+ }
+
+ return exchange.getIn().getBody(Long.class);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<PropagationStatus> deprovision(final Long groupKey, Collection<String> resources) {
+ PollingConsumer pollingConsumer = getConsumer("direct:deprovisionGroupPort");
+
+ Map<String, Object> props = new HashMap<>();
+ props.put("resources", resources);
+
+ sendMessage("direct:deprovisionGroup", groupKey, props);
+
+ Exchange exchange = pollingConsumer.receive();
+
+ if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
+ throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
+ }
+
+ return exchange.getIn().getBody(List.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelRoleProvisioningManager.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelRoleProvisioningManager.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelRoleProvisioningManager.java
deleted file mode 100644
index 096816a..0000000
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelRoleProvisioningManager.java
+++ /dev/null
@@ -1,174 +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.provisioning.camel;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.camel.Exchange;
-import org.apache.camel.PollingConsumer;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.PropagationStatus;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.core.provisioning.api.RoleProvisioningManager;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
-
-public class CamelRoleProvisioningManager extends AbstractCamelProvisioningManager implements RoleProvisioningManager {
-
- @Override
- public Map.Entry<Long, List<PropagationStatus>> create(final RoleTO subject) {
- return create(subject, Collections.<String>emptySet());
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> create(final RoleTO roleTO, final Set<String> excludedResources) {
- PollingConsumer pollingConsumer = getConsumer("direct:createRolePort");
-
- Map<String, Object> props = new HashMap<>();
- props.put("excludedResources", excludedResources);
-
- sendMessage("direct:createRole", roleTO, props);
-
- Exchange exchange = pollingConsumer.receive();
-
- if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
- throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
- }
-
- return exchange.getIn().getBody(Map.Entry.class);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> create(final RoleTO roleTO, final Map<Long, String> roleOwnerMap,
- final Set<String> excludedResources) throws PropagationException {
-
- PollingConsumer pollingConsumer = getConsumer("direct:createRoleInSyncPort");
-
- Map<String, Object> props = new HashMap<>();
- props.put("roleOwnerMap", roleOwnerMap);
- props.put("excludedResources", excludedResources);
-
- sendMessage("direct:createRoleInSync", roleTO, props);
-
- Exchange exchange = pollingConsumer.receive();
-
- if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
- throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
- }
-
- return exchange.getIn().getBody(Map.Entry.class);
- }
-
- @Override
- public Map.Entry<Long, List<PropagationStatus>> update(final RoleMod subjectMod) {
- return update(subjectMod, Collections.<String>emptySet());
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> update(
- final RoleMod subjectMod, final Set<String> excludedResources) {
-
- PollingConsumer pollingConsumer = getConsumer("direct:updateRolePort");
-
- Map<String, Object> props = new HashMap<>();
- props.put("excludedResources", excludedResources);
-
- sendMessage("direct:updateRole", subjectMod, props);
-
- Exchange exchange = pollingConsumer.receive();
-
- if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
- throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
- }
-
- return exchange.getIn().getBody(Map.Entry.class);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public List<PropagationStatus> delete(final Long roleKey) {
- PollingConsumer pollingConsumer = getConsumer("direct:deleteRolePort");
-
- sendMessage("direct:deleteRole", roleKey);
-
- Exchange exchange = pollingConsumer.receive();
-
- if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
- throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
- }
-
- return exchange.getIn().getBody(List.class);
- }
-
- @Override
- public Long unlink(final RoleMod roleMod) {
- PollingConsumer pollingConsumer = getConsumer("direct:unlinkRolePort");
-
- sendMessage("direct:unlinkRole", roleMod);
-
- Exchange exchange = pollingConsumer.receive();
-
- if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
- throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
- }
-
- return exchange.getIn().getBody(Long.class);
- }
-
- @Override
- public Long link(final RoleMod roleMod) {
- PollingConsumer pollingConsumer = getConsumer("direct:linkRolePort");
-
- sendMessage("direct:linkRole", roleMod);
-
- Exchange exchange = pollingConsumer.receive();
-
- if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
- throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
- }
-
- return exchange.getIn().getBody(Long.class);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public List<PropagationStatus> deprovision(final Long roleKey, Collection<String> resources) {
- PollingConsumer pollingConsumer = getConsumer("direct:deprovisionRolePort");
-
- Map<String, Object> props = new HashMap<>();
- props.put("resources", resources);
-
- sendMessage("direct:deprovisionRole", roleKey, props);
-
- Exchange exchange = pollingConsumer.receive();
-
- if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
- throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
- }
-
- return exchange.getIn().getBody(List.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
new file mode 100644
index 0000000..97a2783
--- /dev/null
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
@@ -0,0 +1,72 @@
+package org.apache.syncope.core.provisioning.camel.processor;
+
+/*
+ * 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.
+ */
+import java.util.AbstractMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.core.misc.security.AuthContextUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.provisioning.api.WorkflowResult;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
+import org.springframework.stereotype.Component;
+
+@Component
+public class GroupCreateInSyncProcessor implements Processor {
+
+ @Autowired
+ protected PropagationManager propagationManager;
+
+ @Autowired
+ protected PropagationTaskExecutor taskExecutor;
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void process(final Exchange exchange) {
+ WorkflowResult<Long> created = (WorkflowResult) exchange.getIn().getBody();
+
+ GroupTO actual = exchange.getProperty("subject", GroupTO.class);
+ Map<Long, String> groupOwnerMap = exchange.getProperty("groupOwnerMap", Map.class);
+ Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
+
+ AttrTO groupOwner = actual.getPlainAttrMap().get(StringUtils.EMPTY);
+ if (groupOwner != null) {
+ groupOwnerMap.put(created.getResult(), groupOwner.getValues().iterator().next());
+ }
+
+ AuthContextUtil.extendAuthContext(
+ created.getResult(), GroupEntitlementUtil.getEntitlementNameFromGroupKey(created.getResult()));
+
+ List<PropagationTask> tasks = propagationManager.getGroupCreateTaskIds(
+ created, actual.getVirAttrs(), excludedResource);
+
+ taskExecutor.execute(tasks);
+
+ exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(created.getResult(), null));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
new file mode 100644
index 0000000..239e209
--- /dev/null
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
@@ -0,0 +1,76 @@
+/*
+ * 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.provisioning.camel.processor;
+
+import java.util.AbstractMap;
+import java.util.List;
+import java.util.Set;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.core.misc.security.AuthContextUtil;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.provisioning.api.WorkflowResult;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class GroupCreateProcessor implements Processor {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GroupCreateProcessor.class);
+
+ @Autowired
+ protected PropagationManager propagationManager;
+
+ @Autowired
+ protected PropagationTaskExecutor taskExecutor;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void process(final Exchange exchange) {
+ WorkflowResult<Long> created = (WorkflowResult) exchange.getIn().getBody();
+ GroupTO subject = exchange.getProperty("subject", GroupTO.class);
+ Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
+
+ AuthContextUtil.extendAuthContext(created.getResult(), GroupEntitlementUtil.getEntitlementNameFromGroupKey(created.getResult()));
+
+ List<PropagationTask> tasks =
+ propagationManager.getGroupCreateTaskIds(created, subject.getVirAttrs(), excludedResource);
+ PropagationReporter propagationReporter =
+ ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+ try {
+ taskExecutor.execute(tasks, propagationReporter);
+ } catch (PropagationException e) {
+ LOG.error("Error propagation primary resource", e);
+ propagationReporter.onPrimaryResourceFailure(tasks);
+ }
+
+ exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(
+ created.getResult(), propagationReporter.getStatuses()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
new file mode 100644
index 0000000..7b1ece2
--- /dev/null
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
@@ -0,0 +1,105 @@
+/*
+ * 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.provisioning.camel.processor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.syncope.common.lib.types.PropagationByResource;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.provisioning.api.WorkflowResult;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
+import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class GroupDeleteProcessor implements Processor {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GroupDeleteProcessor.class);
+
+ @Autowired
+ protected GroupWorkflowAdapter gwfAdapter;
+
+ @Autowired
+ protected PropagationManager propagationManager;
+
+ @Autowired
+ protected PropagationTaskExecutor taskExecutor;
+
+ @Autowired
+ protected GroupDAO groupDAO;
+
+ @Override
+ public void process(final Exchange exchange) throws Exception {
+ final List<Group> toBeDeprovisioned = new ArrayList<>();
+
+ Long subjectKey = exchange.getIn().getBody(Long.class);
+ final Group syncopeGroup = groupDAO.find(subjectKey);
+
+ if (syncopeGroup != null) {
+ toBeDeprovisioned.add(syncopeGroup);
+
+ final List<Group> descendants = groupDAO.findDescendants(toBeDeprovisioned.get(0));
+ if (descendants != null) {
+ toBeDeprovisioned.addAll(descendants);
+ }
+ }
+
+ final List<PropagationTask> tasks = new ArrayList<>();
+
+ for (Group group : toBeDeprovisioned) {
+ // Generate propagation tasks for deleting users from group resources, if they are on those resources only
+ // because of the reason being deleted (see SYNCOPE-357)
+ for (Map.Entry<Long, PropagationByResource> entry
+ : groupDAO.findUsersWithIndirectResources(group.getKey()).entrySet()) {
+
+ WorkflowResult<Long> wfResult =
+ new WorkflowResult<>(entry.getKey(), entry.getValue(), Collections.<String>emptySet());
+ tasks.addAll(propagationManager.getUserDeleteTaskIds(wfResult));
+ }
+
+ // Generate propagation tasks for deleting this group from resources
+ tasks.addAll(propagationManager.getGroupDeleteTaskIds(group.getKey()));
+ }
+
+ PropagationReporter propagationReporter =
+ ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+ try {
+ taskExecutor.execute(tasks, propagationReporter);
+ } catch (PropagationException e) {
+ LOG.error("Error propagation primary resource", e);
+ propagationReporter.onPrimaryResourceFailure(tasks);
+ }
+
+ exchange.setProperty("statuses", propagationReporter.getStatuses());
+ }
+
+}
[16/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/security/Encryptor.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/Encryptor.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/Encryptor.java
index aac337a..ce3b36c 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/Encryptor.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/Encryptor.java
@@ -75,17 +75,17 @@ public final class Encryptor {
*/
private static final boolean DEFAULT_ULSSC = true;
- private static String secretKey;
+ private static String SECRET_KEY;
- private static Integer saltIterations;
+ private static Integer SALT_ITERATIONS;
- private static Integer saltSizeBytes;
+ private static Integer SALT_SIZE_BYTES;
- private static Boolean ipopsier;
+ private static Boolean IPOPSIER;
- private static Boolean iposimbd;
+ private static Boolean IPOSIMBD;
- private static Boolean ulssc;
+ private static Boolean ULSSC;
static {
InputStream propStream = null;
@@ -94,46 +94,46 @@ public final class Encryptor {
Properties props = new Properties();
props.load(propStream);
- secretKey = props.getProperty("secretKey");
- saltIterations = Integer.valueOf(props.getProperty("digester.saltIterations"));
- saltSizeBytes = Integer.valueOf(props.getProperty("digester.saltSizeBytes"));
- ipopsier = Boolean.valueOf(props.getProperty("digester.invertPositionOfPlainSaltInEncryptionResults"));
- iposimbd = Boolean.valueOf(props.getProperty("digester.invertPositionOfSaltInMessageBeforeDigesting"));
- ulssc = Boolean.valueOf(props.getProperty("digester.useLenientSaltSizeCheck"));
+ SECRET_KEY = props.getProperty("secretKey");
+ SALT_ITERATIONS = Integer.valueOf(props.getProperty("digester.saltIterations"));
+ SALT_SIZE_BYTES = Integer.valueOf(props.getProperty("digester.saltSizeBytes"));
+ IPOPSIER = Boolean.valueOf(props.getProperty("digester.invertPositionOfPlainSaltInEncryptionResults"));
+ IPOSIMBD = Boolean.valueOf(props.getProperty("digester.invertPositionOfSaltInMessageBeforeDigesting"));
+ ULSSC = Boolean.valueOf(props.getProperty("digester.useLenientSaltSizeCheck"));
} catch (Exception e) {
LOG.error("Could not read security parameters", e);
} finally {
IOUtils.closeQuietly(propStream);
}
- if (secretKey == null) {
- secretKey = DEFAULT_SECRET_KEY;
+ if (SECRET_KEY == null) {
+ SECRET_KEY = DEFAULT_SECRET_KEY;
LOG.debug("secretKey not found, reverting to default");
}
- if (saltIterations == null) {
- saltIterations = DEFAULT_SALT_ITERATIONS;
+ if (SALT_ITERATIONS == null) {
+ SALT_ITERATIONS = DEFAULT_SALT_ITERATIONS;
LOG.debug("digester.saltIterations not found, reverting to default");
}
- if (saltSizeBytes == null) {
- saltSizeBytes = DEFAULT_SALT_SIZE_BYTES;
+ if (SALT_SIZE_BYTES == null) {
+ SALT_SIZE_BYTES = DEFAULT_SALT_SIZE_BYTES;
LOG.debug("digester.saltSizeBytes not found, reverting to default");
}
- if (ipopsier == null) {
- ipopsier = DEFAULT_IPOPSIER;
+ if (IPOPSIER == null) {
+ IPOPSIER = DEFAULT_IPOPSIER;
LOG.debug("digester.invertPositionOfPlainSaltInEncryptionResults not found, reverting to default");
}
- if (iposimbd == null) {
- iposimbd = DEFAULT_IPOSIMBD;
+ if (IPOSIMBD == null) {
+ IPOSIMBD = DEFAULT_IPOSIMBD;
LOG.debug("digester.invertPositionOfSaltInMessageBeforeDigesting not found, reverting to default");
}
- if (ulssc == null) {
- ulssc = DEFAULT_ULSSC;
+ if (ULSSC == null) {
+ ULSSC = DEFAULT_ULSSC;
LOG.debug("digester.useLenientSaltSizeCheck not found, reverting to default");
}
}
public static Encryptor getInstance() {
- return getInstance(secretKey);
+ return getInstance(SECRET_KEY);
}
public static Encryptor getInstance(final String secretKey) {
@@ -163,7 +163,7 @@ public final class Encryptor {
try {
keySpec = new SecretKeySpec(ArrayUtils.subarray(
- actualKey.getBytes(SyncopeConstants.DEFAULT_ENCODING), 0, 16),
+ actualKey.getBytes(SyncopeConstants.DEFAULT_CHARSET), 0, 16),
CipherAlgorithm.AES.getAlgorithm());
} catch (Exception e) {
LOG.error("Error during key specification", e);
@@ -178,7 +178,7 @@ public final class Encryptor {
if (value != null) {
if (cipherAlgorithm == null || cipherAlgorithm == CipherAlgorithm.AES) {
- final byte[] cleartext = value.getBytes(SyncopeConstants.DEFAULT_ENCODING);
+ final byte[] cleartext = value.getBytes(SyncopeConstants.DEFAULT_CHARSET);
final Cipher cipher = Cipher.getInstance(CipherAlgorithm.AES.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, keySpec);
@@ -221,12 +221,12 @@ public final class Encryptor {
String value = null;
if (encodedValue != null && cipherAlgorithm == CipherAlgorithm.AES) {
- final byte[] encoded = encodedValue.getBytes(SyncopeConstants.DEFAULT_ENCODING);
+ final byte[] encoded = encodedValue.getBytes(SyncopeConstants.DEFAULT_CHARSET);
final Cipher cipher = Cipher.getInstance(CipherAlgorithm.AES.getAlgorithm());
cipher.init(Cipher.DECRYPT_MODE, keySpec);
- value = new String(cipher.doFinal(Base64.decode(encoded)), SyncopeConstants.DEFAULT_ENCODING);
+ value = new String(cipher.doFinal(Base64.decode(encoded)), SyncopeConstants.DEFAULT_CHARSET);
}
return value;
@@ -238,11 +238,11 @@ public final class Encryptor {
if (cipherAlgorithm.getAlgorithm().startsWith("S-")) {
// Salted ...
digester.setAlgorithm(cipherAlgorithm.getAlgorithm().replaceFirst("S\\-", ""));
- digester.setIterations(saltIterations);
- digester.setSaltSizeBytes(saltSizeBytes);
- digester.setInvertPositionOfPlainSaltInEncryptionResults(ipopsier);
- digester.setInvertPositionOfSaltInMessageBeforeDigesting(iposimbd);
- digester.setUseLenientSaltSizeCheck(ulssc);
+ digester.setIterations(SALT_ITERATIONS);
+ digester.setSaltSizeBytes(SALT_SIZE_BYTES);
+ digester.setInvertPositionOfPlainSaltInEncryptionResults(IPOPSIER);
+ digester.setInvertPositionOfSaltInMessageBeforeDigesting(IPOSIMBD);
+ digester.setUseLenientSaltSizeCheck(ULSSC);
} else {
// Not salted ...
digester.setAlgorithm(cipherAlgorithm.getAlgorithm());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/security/PasswordGenerator.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/PasswordGenerator.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/PasswordGenerator.java
index 3f8060e..8ed136b 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/PasswordGenerator.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/PasswordGenerator.java
@@ -26,7 +26,7 @@ import org.apache.syncope.common.lib.types.PasswordPolicySpec;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+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.misc.policy.InvalidPasswordPolicySpecException;
import org.apache.syncope.core.misc.policy.PolicyPattern;
@@ -66,11 +66,11 @@ public class PasswordGenerator {
ppSpecs.add(globalPP.getSpecification(PasswordPolicySpec.class));
}
- for (Role role : user.getRoles()) {
- if (role.getPasswordPolicy() != null
- && role.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
+ for (Group group : user.getGroups()) {
+ if (group.getPasswordPolicy() != null
+ && group.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
- ppSpecs.add(role.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
+ ppSpecs.add(group.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
}
}
@@ -287,13 +287,15 @@ public class PasswordGenerator {
if (policySpec.isUppercaseRequired()
&& !PolicyPattern.ALPHA_UPPERCASE.matcher(StringUtils.join(generatedPassword)).matches()) {
- generatedPassword[firstEmptyChar(generatedPassword)] = SecureRandomUtil.generateRandomLetter().toUpperCase();
+ generatedPassword[firstEmptyChar(generatedPassword)] =
+ SecureRandomUtil.generateRandomLetter().toUpperCase();
}
if (policySpec.isLowercaseRequired()
&& !PolicyPattern.ALPHA_LOWERCASE.matcher(StringUtils.join(generatedPassword)).matches()) {
- generatedPassword[firstEmptyChar(generatedPassword)] = SecureRandomUtil.generateRandomLetter().toLowerCase();
+ generatedPassword[firstEmptyChar(generatedPassword)] =
+ SecureRandomUtil.generateRandomLetter().toLowerCase();
}
if (policySpec.isNonAlphanumericRequired()
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtil.java
index 39a0112..7939a83 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtil.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtil.java
@@ -38,7 +38,7 @@ public final class SecureRandomUtil {
return RandomStringUtils.random(1, 0, 0, false, true, null, RANDOM);
}
- public static String generateRandomSpecialCharacter(char[] characters) {
+ public static String generateRandomSpecialCharacter(final char[] characters) {
return RandomStringUtils.random(1, 0, 0, false, false, characters, RANDOM);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeAuthenticationProvider.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeAuthenticationProvider.java
index 607deb6..0094aef 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeAuthenticationProvider.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeAuthenticationProvider.java
@@ -35,7 +35,7 @@ import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+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.provisioning.api.ConnectorFactory;
import org.apache.syncope.core.misc.AuditManager;
@@ -50,7 +50,6 @@ import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.transaction.annotation.Transactional;
@@ -123,9 +122,7 @@ public class SyncopeAuthenticationProvider implements AuthenticationProvider {
@Override
@Transactional(noRollbackFor = { BadCredentialsException.class, DisabledException.class })
- public Authentication authenticate(final Authentication authentication)
- throws AuthenticationException {
-
+ public Authentication authenticate(final Authentication authentication) {
boolean authenticated = false;
User user = null;
@@ -174,9 +171,9 @@ public class SyncopeAuthenticationProvider implements AuthenticationProvider {
null,
authenticated,
authentication,
- "Successfully authenticated, with roles: " + token.getAuthorities());
+ "Successfully authenticated, with groups: " + token.getAuthorities());
- LOG.debug("User {} successfully authenticated, with roles {}",
+ LOG.debug("User {} successfully authenticated, with groups {}",
authentication.getPrincipal(), token.getAuthorities());
} else {
auditManager.audit(
@@ -198,7 +195,7 @@ public class SyncopeAuthenticationProvider implements AuthenticationProvider {
return token;
}
- protected void updateLoginAttributes(User user, boolean authenticated) {
+ protected void updateLoginAttributes(final User user, final boolean authenticated) {
boolean userModified = false;
if (authenticated) {
@@ -235,13 +232,13 @@ public class SyncopeAuthenticationProvider implements AuthenticationProvider {
}
}
- // 2. look for owned roles, pick the ones whose account policy has authentication resources
- for (Role role : user.getRoles()) {
- if (role.getAccountPolicy() != null && !role.getAccountPolicy().getResources().isEmpty()) {
+ // 2. look for owned groups, pick the ones whose account policy has authentication resources
+ for (Group group : user.getGroups()) {
+ if (group.getAccountPolicy() != null && !group.getAccountPolicy().getResources().isEmpty()) {
if (result == null) {
- result = role.getAccountPolicy().getResources();
+ result = group.getAccountPolicy().getResources();
} else {
- result.retainAll(role.getAccountPolicy().getResources());
+ result.retainAll(group.getAccountPolicy().getResources());
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeUserDetailsService.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeUserDetailsService.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeUserDetailsService.java
index 16eecf7..d617ae2 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeUserDetailsService.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeUserDetailsService.java
@@ -23,15 +23,14 @@ import java.util.List;
import java.util.Set;
import javax.annotation.Resource;
import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
-import org.springframework.dao.DataAccessException;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
@@ -45,7 +44,7 @@ public class SyncopeUserDetailsService implements UserDetailsService {
protected UserDAO userDAO;
@Autowired
- protected RoleDAO roleDAO;
+ protected GroupDAO groupDAO;
@Autowired
protected EntitlementDAO entitlementDAO;
@@ -57,7 +56,7 @@ public class SyncopeUserDetailsService implements UserDetailsService {
protected String anonymousUser;
@Override
- public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException, DataAccessException {
+ public UserDetails loadUserByUsername(final String username) {
final Set<SimpleGrantedAuthority> authorities = new HashSet<>();
if (anonymousUser.equals(username)) {
authorities.add(new SimpleGrantedAuthority(SyncopeConstants.ANONYMOUS_ENTITLEMENT));
@@ -72,27 +71,27 @@ public class SyncopeUserDetailsService implements UserDetailsService {
throw new UsernameNotFoundException("Could not find any user with id " + username);
}
- // Give entitlements based on roles assigned to user (and their ancestors)
- final Set<Role> roles = new HashSet<>(user.getRoles());
- for (Role role : user.getRoles()) {
- roles.addAll(roleDAO.findAncestors(role));
+ // Give entitlements based on groups assigned to user (and their ancestors)
+ final Set<Group> groups = new HashSet<>(user.getGroups());
+ for (Group group : user.getGroups()) {
+ groups.addAll(groupDAO.findAncestors(group));
}
- for (Role role : roles) {
- for (Entitlement entitlement : role.getEntitlements()) {
+ for (Group group : groups) {
+ for (Entitlement entitlement : group.getEntitlements()) {
authorities.add(new SimpleGrantedAuthority(entitlement.getKey()));
}
}
- // Give role operational entitlements for owned roles
- List<Role> ownedRoles = roleDAO.findOwnedByUser(user.getKey());
- if (!ownedRoles.isEmpty()) {
- authorities.add(new SimpleGrantedAuthority("ROLE_CREATE"));
- authorities.add(new SimpleGrantedAuthority("ROLE_READ"));
- authorities.add(new SimpleGrantedAuthority("ROLE_UPDATE"));
- authorities.add(new SimpleGrantedAuthority("ROLE_DELETE"));
+ // Give group operational entitlements for owned groups
+ List<Group> ownedGroups = groupDAO.findOwnedByUser(user.getKey());
+ if (!ownedGroups.isEmpty()) {
+ authorities.add(new SimpleGrantedAuthority("GROUP_CREATE"));
+ authorities.add(new SimpleGrantedAuthority("GROUP_READ"));
+ authorities.add(new SimpleGrantedAuthority("GROUP_UPDATE"));
+ authorities.add(new SimpleGrantedAuthority("GROUP_DELETE"));
- for (Role role : ownedRoles) {
+ for (Group group : ownedGroups) {
authorities.add(new SimpleGrantedAuthority(
- RoleEntitlementUtil.getEntitlementNameFromRoleKey(role.getKey())));
+ GroupEntitlementUtil.getEntitlementNameFromGroupKey(group.getKey())));
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java
new file mode 100644
index 0000000..006be64
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java
@@ -0,0 +1,42 @@
+/*
+ * 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.misc.security;
+
+import java.util.Collections;
+import java.util.Set;
+
+public class UnauthorizedGroupException extends RuntimeException {
+
+ private static final long serialVersionUID = 7540587364235915081L;
+
+ private final Set<Long> groupIds;
+
+ public UnauthorizedGroupException(final Set<Long> groupIds) {
+ super("Missing entitlement for group(s) " + groupIds);
+ this.groupIds = groupIds;
+ }
+
+ public UnauthorizedGroupException(final Long groupId) {
+ this(Collections.singleton(groupId));
+ }
+
+ public Set<Long> getGroupIds() {
+ return groupIds;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedRoleException.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedRoleException.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedRoleException.java
deleted file mode 100644
index 8c29871..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedRoleException.java
+++ /dev/null
@@ -1,42 +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.misc.security;
-
-import java.util.Collections;
-import java.util.Set;
-
-public class UnauthorizedRoleException extends RuntimeException {
-
- private static final long serialVersionUID = 7540587364235915081L;
-
- private final Set<Long> roleIds;
-
- public UnauthorizedRoleException(final Set<Long> roleIds) {
- super("Missing entitlement for role(s) " + roleIds);
- this.roleIds = roleIds;
- }
-
- public UnauthorizedRoleException(final Long roleId) {
- this(Collections.singleton(roleId));
- }
-
- public Set<Long> getRoleIds() {
- return roleIds;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/AttributeDeserializer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/AttributeDeserializer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/AttributeDeserializer.java
index 3da92ee..5c2ab51 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/AttributeDeserializer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/AttributeDeserializer.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.misc.serialization;
import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
@@ -40,7 +39,7 @@ class AttributeDeserializer extends JsonDeserializer<Attribute> {
@Override
public Attribute deserialize(final JsonParser jp, final DeserializationContext ctx)
- throws IOException, JsonProcessingException {
+ throws IOException {
ObjectNode tree = jp.readValueAsTree();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/AttributeSerializer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/AttributeSerializer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/AttributeSerializer.java
index 2fff021..3c79c28 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/AttributeSerializer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/AttributeSerializer.java
@@ -19,27 +19,22 @@
package org.apache.syncope.core.misc.serialization;
import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import org.identityconnectors.common.Base64;
import org.identityconnectors.common.security.GuardedString;
import org.identityconnectors.framework.common.objects.Attribute;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
class AttributeSerializer extends JsonSerializer<Attribute> {
- private static final Logger LOG = LoggerFactory.getLogger(AttributeSerializer.class);
-
public static final String BYTE_ARRAY_PREFIX = "<binary>";
public static final String BYTE_ARRAY_SUFFIX = "</binary>";
@Override
public void serialize(final Attribute source, final JsonGenerator jgen, final SerializerProvider sp)
- throws IOException, JsonProcessingException {
+ throws IOException {
jgen.writeStartObject();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/GuardedStringDeserializer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/GuardedStringDeserializer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/GuardedStringDeserializer.java
index d8c372d..1cd0ec0 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/GuardedStringDeserializer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/GuardedStringDeserializer.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.misc.serialization;
import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -37,7 +36,7 @@ class GuardedStringDeserializer extends JsonDeserializer<GuardedString> {
@Override
public GuardedString deserialize(final JsonParser jp, final DeserializationContext ctx)
- throws IOException, JsonProcessingException {
+ throws IOException {
ObjectNode tree = jp.readValueAsTree();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/GuardedStringSerializer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/GuardedStringSerializer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/GuardedStringSerializer.java
index de9f60a..c86fb2e 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/GuardedStringSerializer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/GuardedStringSerializer.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.misc.serialization;
import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
@@ -36,7 +35,7 @@ class GuardedStringSerializer extends JsonSerializer<GuardedString> {
@Override
public void serialize(final GuardedString source, final JsonGenerator jgen, final SerializerProvider sp)
- throws IOException, JsonProcessingException {
+ throws IOException {
jgen.writeStartObject();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/SyncTokenDeserializer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/SyncTokenDeserializer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/SyncTokenDeserializer.java
index 3497373..cc25ef3 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/SyncTokenDeserializer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/SyncTokenDeserializer.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.misc.serialization;
import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
@@ -32,7 +31,7 @@ class SyncTokenDeserializer extends JsonDeserializer<SyncToken> {
@Override
public SyncToken deserialize(final JsonParser jp, final DeserializationContext ctx)
- throws IOException, JsonProcessingException {
+ throws IOException {
ObjectNode tree = jp.readValueAsTree();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/SyncTokenSerializer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/SyncTokenSerializer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/SyncTokenSerializer.java
index c2f2183..eb75eb2 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/SyncTokenSerializer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/SyncTokenSerializer.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.misc.serialization;
import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
@@ -30,7 +29,7 @@ class SyncTokenSerializer extends JsonSerializer<SyncToken> {
@Override
public void serialize(final SyncToken source, final JsonGenerator jgen, final SerializerProvider sp)
- throws IOException, JsonProcessingException {
+ throws IOException {
jgen.writeStartObject();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/UnwrappedObjectMapper.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/UnwrappedObjectMapper.java b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/UnwrappedObjectMapper.java
index b79b6bd..61770e0 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/UnwrappedObjectMapper.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/serialization/UnwrappedObjectMapper.java
@@ -18,10 +18,8 @@
*/
package org.apache.syncope.core.misc.serialization;
-import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.IOException;
@@ -57,28 +55,28 @@ public class UnwrappedObjectMapper extends ObjectMapper {
@Override
public void writeValue(final JsonGenerator jgen, final Object value)
- throws IOException, JsonGenerationException, JsonMappingException {
+ throws IOException {
super.writeValue(jgen, unwrapMap(value));
}
@Override
public void writeValue(final File resultFile, final Object value)
- throws IOException, JsonGenerationException, JsonMappingException {
+ throws IOException {
super.writeValue(resultFile, unwrapMap(value));
}
@Override
public void writeValue(final OutputStream out, final Object value)
- throws IOException, JsonGenerationException, JsonMappingException {
+ throws IOException {
super.writeValue(out, unwrapMap(value));
}
@Override
public void writeValue(final Writer w, final Object value)
- throws IOException, JsonGenerationException, JsonMappingException {
+ throws IOException {
super.writeValue(w, unwrapMap(value));
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/spring/ApplicationContextProvider.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/spring/ApplicationContextProvider.java b/core/misc/src/main/java/org/apache/syncope/core/misc/spring/ApplicationContextProvider.java
index dfbcbe4..1aa4367 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/spring/ApplicationContextProvider.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/spring/ApplicationContextProvider.java
@@ -25,14 +25,14 @@ import org.springframework.context.ConfigurableApplicationContext;
public class ApplicationContextProvider implements ApplicationContextAware {
- private static ConfigurableApplicationContext ctx;
+ private static ConfigurableApplicationContext CTX;
public static ConfigurableApplicationContext getApplicationContext() {
- return ctx;
+ return CTX;
}
public static DefaultListableBeanFactory getBeanFactory() {
- return (DefaultListableBeanFactory) ctx.getBeanFactory();
+ return (DefaultListableBeanFactory) CTX.getBeanFactory();
}
/**
@@ -42,6 +42,6 @@ public class ApplicationContextProvider implements ApplicationContextAware {
*/
@Override
public void setApplicationContext(final ApplicationContext ctx) {
- ApplicationContextProvider.ctx = (ConfigurableApplicationContext) ctx;
+ CTX = (ConfigurableApplicationContext) ctx;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/spring/BeanUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/spring/BeanUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/spring/BeanUtils.java
index 97b57db..5f9fd4d 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/spring/BeanUtils.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/spring/BeanUtils.java
@@ -29,7 +29,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import org.springframework.beans.BeansException;
import org.springframework.beans.FatalBeanException;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -58,12 +57,12 @@ public final class BeanUtils {
* This is just a convenience method. For more complex transfer needs,
* consider using a full BeanWrapper.
* </p>
+ *
* @param source the source bean
* @param target the target bean
- * @throws BeansException if the copying failed
* @see org.springframework.beans.BeanWrapper
*/
- public static void copyProperties(final Object source, final Object target) throws BeansException {
+ public static void copyProperties(final Object source, final Object target) {
copyProperties(source, target, null, (String[]) null);
}
@@ -82,12 +81,9 @@ public final class BeanUtils {
* @param source the source bean
* @param target the target bean
* @param editable the class (or interface) to restrict property setting to
- * @throws BeansException if the copying failed
* @see org.springframework.beans.BeanWrapper
*/
- public static void copyProperties(final Object source, final Object target, final Class<?> editable)
- throws BeansException {
-
+ public static void copyProperties(final Object source, final Object target, final Class<?> editable) {
copyProperties(source, target, editable, (String[]) null);
}
@@ -106,12 +102,9 @@ public final class BeanUtils {
* @param source the source bean
* @param target the target bean
* @param ignoreProperties array of property names to ignore
- * @throws BeansException if the copying failed
* @see org.springframework.beans.BeanWrapper
*/
- public static void copyProperties(final Object source, final Object target, final String... ignoreProperties)
- throws BeansException {
-
+ public static void copyProperties(final Object source, final Object target, final String... ignoreProperties) {
copyProperties(source, target, null, ignoreProperties);
}
@@ -127,12 +120,11 @@ public final class BeanUtils {
* @param target the target bean
* @param editable the class (or interface) to restrict property setting to
* @param ignoreProperties array of property names to ignore
- * @throws BeansException if the copying failed
* @see org.springframework.beans.BeanWrapper
*/
@SuppressWarnings("unchecked")
- private static void copyProperties(final Object source, final Object target, final Class<?> editable,
- final String... ignoreProperties) throws BeansException {
+ private static void copyProperties(
+ final Object source, final Object target, final Class<?> editable, final String... ignoreProperties) {
Assert.notNull(source, "Source must not be null");
Assert.notNull(target, "Target must not be null");
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/resources/security.properties
----------------------------------------------------------------------
diff --git a/core/misc/src/main/resources/security.properties b/core/misc/src/main/resources/security.properties
index c0fcd37..a0557b5 100644
--- a/core/misc/src/main/resources/security.properties
+++ b/core/misc/src/main/resources/security.properties
@@ -27,4 +27,5 @@ digester.saltIterations=1
digester.saltSizeBytes=8
digester.invertPositionOfPlainSaltInEncryptionResults=true
digester.invertPositionOfSaltInMessageBeforeDigesting=true
-digester.useLenientSaltSizeCheck=true
\ No newline at end of file
+digester.useLenientSaltSizeCheck=true
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
----------------------------------------------------------------------
diff --git a/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java b/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
index 27cd0b6..f358de2 100644
--- a/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
+++ b/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
@@ -20,7 +20,7 @@ package org.apache.syncope.core.misc.search;
import static org.junit.Assert.assertEquals;
-import org.apache.syncope.common.lib.search.RoleFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.search.SpecialAttr;
import org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder;
import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
@@ -84,12 +84,12 @@ public class SearchCondConverterTest {
}
@Test
- public void roles() {
- String fiqlExpression = new UserFiqlSearchConditionBuilder().hasRoles(1L).query();
- assertEquals(SpecialAttr.ROLES + "==1", fiqlExpression);
+ public void groups() {
+ String fiqlExpression = new UserFiqlSearchConditionBuilder().inGroups(1L).query();
+ assertEquals(SpecialAttr.GROUPS + "==1", fiqlExpression);
MembershipCond membCond = new MembershipCond();
- membCond.setRoleId(1L);
+ membCond.setGroupId(1L);
SearchCond simpleCond = SearchCond.getLeafCond(membCond);
assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
@@ -109,7 +109,7 @@ public class SearchCondConverterTest {
@Test
public void entitlements() {
- String fiqlExpression = new RoleFiqlSearchConditionBuilder().hasEntitlements("USER_LIST").query();
+ String fiqlExpression = new GroupFiqlSearchConditionBuilder().hasEntitlements("USER_LIST").query();
assertEquals(SpecialAttr.ENTITLEMENTS + "==USER_LIST", fiqlExpression);
EntitlementCond entCond = new EntitlementCond();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java
new file mode 100644
index 0000000..b0f104a
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java
@@ -0,0 +1,88 @@
+/*
+ * 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;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Pattern;
+import org.apache.syncope.core.persistence.api.entity.Entitlement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Utility class for manipulating entitlements.
+ */
+public final class GroupEntitlementUtil {
+
+ private static final Pattern GROUP_ENTITLEMENT_NAME_PATTERN = Pattern.compile("^GROUP_([\\d])+");
+
+ private static final Logger LOG = LoggerFactory.getLogger(GroupEntitlementUtil.class);
+
+ public static String getEntitlementNameFromGroupKey(final Long groupKey) {
+ return "GROUP_" + groupKey;
+ }
+
+ public static boolean isGroupEntitlement(final String entitlementName) {
+ return GROUP_ENTITLEMENT_NAME_PATTERN.matcher(entitlementName).matches();
+ }
+
+ public static Long getGroupKey(final String entitlementName) {
+ Long result = null;
+
+ if (isGroupEntitlement(entitlementName)) {
+ try {
+ result = Long.valueOf(entitlementName.substring(entitlementName.indexOf('_') + 1));
+ } catch (Exception e) {
+ LOG.error("unable to parse {} to Long", entitlementName, e);
+ }
+ }
+
+ return result;
+ }
+
+ public static Set<Long> getGroupKeys(final Set<String> entitlements) {
+ Set<Long> result = new HashSet<>();
+
+ for (String entitlement : entitlements) {
+ if (isGroupEntitlement(entitlement)) {
+ Long groupId = getGroupKey(entitlement);
+ if (groupId != null) {
+ result.add(groupId);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ public static Set<Long> getGroupKeys(final List<Entitlement> entitlements) {
+ Set<String> names = new HashSet<>(entitlements.size());
+ for (Entitlement entitlement : entitlements) {
+ names.add(entitlement.getKey());
+ }
+ return GroupEntitlementUtil.getGroupKeys(names);
+ }
+
+ /**
+ * Private default constructor, for static-only classes.
+ */
+ private GroupEntitlementUtil() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/RoleEntitlementUtil.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/RoleEntitlementUtil.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/RoleEntitlementUtil.java
deleted file mode 100644
index f395828..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/RoleEntitlementUtil.java
+++ /dev/null
@@ -1,88 +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;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Pattern;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Utility class for manipulating entitlements.
- */
-public final class RoleEntitlementUtil {
-
- private static final Pattern ROLE_ENTITLEMENT_NAME_PATTERN = Pattern.compile("^ROLE_([\\d])+");
-
- private static final Logger LOG = LoggerFactory.getLogger(RoleEntitlementUtil.class);
-
- public static String getEntitlementNameFromRoleKey(final Long roleKey) {
- return "ROLE_" + roleKey;
- }
-
- public static boolean isRoleEntitlement(final String entitlementName) {
- return ROLE_ENTITLEMENT_NAME_PATTERN.matcher(entitlementName).matches();
- }
-
- public static Long getRoleKey(final String entitlementName) {
- Long result = null;
-
- if (isRoleEntitlement(entitlementName)) {
- try {
- result = Long.valueOf(entitlementName.substring(entitlementName.indexOf('_') + 1));
- } catch (Exception e) {
- LOG.error("unable to parse {} to Long", entitlementName, e);
- }
- }
-
- return result;
- }
-
- public static Set<Long> getRoleKeys(final Set<String> entitlements) {
- Set<Long> result = new HashSet<>();
-
- for (String entitlement : entitlements) {
- if (isRoleEntitlement(entitlement)) {
- Long roleId = getRoleKey(entitlement);
- if (roleId != null) {
- result.add(roleId);
- }
- }
- }
-
- return result;
- }
-
- public static Set<Long> getRoleKeys(final List<Entitlement> entitlements) {
- Set<String> names = new HashSet<>(entitlements.size());
- for (Entitlement entitlement : entitlements) {
- names.add(entitlement.getKey());
- }
- return getRoleKeys(names);
- }
-
- /**
- * Private default constructor, for static-only classes.
- */
- private RoleEntitlementUtil() {
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java
index 213e947..818fb61 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java
@@ -120,7 +120,7 @@ public class InvalidEntityException extends ValidationException {
StringBuilder sb = new StringBuilder();
for (Class<?> entity : violations.keySet()) {
- sb.append(entity.getSimpleName()).append(" ").append(violations.get(entity).toString()).append(", ");
+ sb.append(entity.getSimpleName()).append(' ').append(violations.get(entity).toString()).append(", ");
}
sb.delete(sb.lastIndexOf(", "), sb.length());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java
index d529973..0f92150 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java
@@ -37,7 +37,7 @@ public class InvalidPlainAttrValueException extends ValidationException {
this("Could not validate " + value.getValue());
}
- public InvalidPlainAttrValueException(final PlainAttrValue value, Throwable cause) {
+ public InvalidPlainAttrValueException(final PlainAttrValue value, final Throwable cause) {
this("Could not validate " + value.getValue(), cause);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/Validator.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/Validator.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/Validator.java
index 2f55132..c9fad02 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/Validator.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/Validator.java
@@ -22,6 +22,5 @@ import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
public interface Validator {
- void validate(String value, PlainAttrValue attrValue)
- throws ParsingValidationException, InvalidPlainAttrValueException;
+ void validate(String value, PlainAttrValue attrValue);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConnInstanceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConnInstanceDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConnInstanceDAO.java
index a263df7..b669338 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConnInstanceDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConnInstanceDAO.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
public interface ConnInstanceDAO extends DAO<ConnInstance, Long> {
@@ -28,7 +27,7 @@ public interface ConnInstanceDAO extends DAO<ConnInstance, Long> {
List<ConnInstance> findAll();
- ConnInstance save(ConnInstance connector) throws InvalidEntityException;
+ ConnInstance save(ConnInstance connector);
void delete(Long key);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerAttrDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerAttrDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerAttrDAO.java
index 49d6748..9aa3ac3 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerAttrDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerAttrDAO.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
public interface DerAttrDAO extends DAO<DerAttr, Long> {
@@ -28,7 +27,7 @@ public interface DerAttrDAO extends DAO<DerAttr, Long> {
<T extends DerAttr> List<T> findAll(Class<T> reference);
- <T extends DerAttr> T save(T derAttr) throws InvalidEntityException;
+ <T extends DerAttr> T save(T derAttr);
<T extends DerAttr> void delete(Long key, Class<T> reference);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java
index 78a481f..3376e3f 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
@@ -32,7 +31,7 @@ public interface DerSchemaDAO extends DAO<DerSchema, String> {
<T extends DerAttr> List<T> findAttrs(DerSchema schema, Class<T> reference);
- <T extends DerSchema> T save(T derSchema) throws InvalidEntityException;
+ <T extends DerSchema> T save(T derSchema);
void delete(String name, AttributableUtil attributableUtil);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java
index e1ef492..560ff91 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java
@@ -19,9 +19,8 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
public interface EntitlementDAO extends DAO<Entitlement, String> {
@@ -29,9 +28,9 @@ public interface EntitlementDAO extends DAO<Entitlement, String> {
List<Entitlement> findAll();
- Entitlement save(Entitlement entitlement) throws InvalidEntityException;
+ Entitlement save(Entitlement entitlement);
- Entitlement saveRoleEntitlement(Role role);
+ Entitlement saveGroupEntitlement(Group group);
void delete(String key);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
index 18cb51b..01f4f63 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
import org.apache.syncope.core.persistence.api.entity.Policy;
@@ -38,7 +37,7 @@ public interface ExternalResourceDAO extends DAO<ExternalResource, String> {
List<ExternalResource> findAllByPriority();
- ExternalResource save(ExternalResource resource) throws InvalidEntityException;
+ ExternalResource save(ExternalResource resource);
<T extends MappingItem> void deleteMapping(
String schemaName, IntMappingType intMappingType, Class<T> reference);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/GroupDAO.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..56ea6c2
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/GroupDAO.java
@@ -0,0 +1,91 @@
+/*
+ * 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 java.util.List;
+import java.util.Map;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.common.lib.types.PropagationByResource;
+import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.core.persistence.api.entity.Entitlement;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.Policy;
+import org.apache.syncope.core.persistence.api.entity.membership.Membership;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+
+public interface GroupDAO extends SubjectDAO<GPlainAttr, GDerAttr, GVirAttr> {
+
+ Group find(Long key);
+
+ List<Group> find(String name);
+
+ Group find(String name, Long parent);
+
+ List<Group> findOwnedByUser(Long userId);
+
+ List<Group> findOwnedByGroup(Long groupId);
+
+ List<Group> findByEntitlement(Entitlement entitlement);
+
+ List<Group> findByPolicy(Policy policy);
+
+ List<Group> findWithoutPolicy(PolicyType type);
+
+ List<Group> findAncestors(Group group);
+
+ List<Group> findChildren(Group group);
+
+ List<Group> findDescendants(Group group);
+
+ List<Group> findByDerAttrValue(String schemaName, String value);
+
+ List<Group> findByAttrValue(String schemaName, GPlainAttrValue attrValue);
+
+ Group findByAttrUniqueValue(String schemaName, GPlainAttrValue attrUniqueValue);
+
+ List<Group> findByResource(ExternalResource resource);
+
+ List<Group> findAll();
+
+ List<Group> findAll(int page, int itemsPerPage, List<OrderByClause> orderBy);
+
+ List<Membership> findMemberships(Group group);
+
+ int count();
+
+ Group save(Group group);
+
+ void delete(Group group);
+
+ void delete(Long key);
+
+ Group authFetch(Long key);
+
+ /**
+ * Finds users having resources assigned exclusively because of memberships of the given group.
+ *
+ * @param groupKey group key
+ * @return map containing pairs with user key and operations to be performed on those resources (DELETE, typically).
+ */
+ Map<Long, PropagationByResource> findUsersWithIndirectResources(Long groupKey);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java
index 3ba7f3f..0ce4b6a 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java
@@ -20,7 +20,6 @@ package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.common.lib.types.LoggerType;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.Logger;
public interface LoggerDAO extends DAO<Logger, String> {
@@ -29,7 +28,7 @@ public interface LoggerDAO extends DAO<Logger, String> {
List<Logger> findAll(LoggerType type);
- Logger save(Logger logger) throws InvalidEntityException;
+ Logger save(Logger logger);
void delete(String key);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MembershipDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MembershipDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MembershipDAO.java
index 62d50fe..964e0e8 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MembershipDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MembershipDAO.java
@@ -19,20 +19,19 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.User;
public interface MembershipDAO extends DAO<Membership, Long> {
Membership find(Long key);
- Membership find(User user, Role role);
+ Membership find(User user, Group group);
List<Membership> findAll();
- Membership save(Membership membership) throws InvalidEntityException;
+ Membership save(Membership membership);
void delete(Long key);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotificationDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotificationDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotificationDAO.java
index a70489c..866e588 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotificationDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotificationDAO.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.Notification;
public interface NotificationDAO extends DAO<Notification, Long> {
@@ -28,7 +27,7 @@ public interface NotificationDAO extends DAO<Notification, Long> {
List<Notification> findAll();
- Notification save(Notification notification) throws InvalidEntityException;
+ Notification save(Notification notification);
void delete(Long key);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrValueDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrValueDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrValueDAO.java
index d20a253..b554442 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrValueDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrValueDAO.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
public interface PlainAttrValueDAO extends DAO<PlainAttrValue, Long> {
@@ -28,7 +27,7 @@ public interface PlainAttrValueDAO extends DAO<PlainAttrValue, Long> {
<T extends PlainAttrValue> List<T> findAll(Class<T> reference);
- <T extends PlainAttrValue> T save(T attributeValue) throws InvalidEntityException;
+ <T extends PlainAttrValue> T save(T attributeValue);
<T extends PlainAttrValue> void delete(Long key, Class<T> reference);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java
index 791ddaf..717a3c4 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
@@ -32,7 +31,7 @@ public interface PlainSchemaDAO extends DAO<PlainSchema, String> {
<T extends PlainAttr> List<T> findAttrs(PlainSchema schema, Class<T> reference);
- <T extends PlainSchema> T save(T schema) throws InvalidEntityException;
+ <T extends PlainSchema> T save(T schema);
void delete(String name, AttributableUtil attributableUtil);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportDAO.java
index 3be0df7..f94b5a4 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportDAO.java
@@ -20,7 +20,6 @@ package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.Report;
public interface ReportDAO extends DAO<Report, Long> {
@@ -33,7 +32,7 @@ public interface ReportDAO extends DAO<Report, Long> {
int count();
- Report save(Report report) throws InvalidEntityException;
+ Report save(Report report);
void delete(Long key);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportExecDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportExecDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportExecDAO.java
index 726628f..1adcd87 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportExecDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportExecDAO.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.Report;
import org.apache.syncope.core.persistence.api.entity.ReportExec;
@@ -33,7 +32,7 @@ public interface ReportExecDAO extends DAO<ReportExec, Long> {
List<ReportExec> findAll();
- ReportExec save(ReportExec execution) throws InvalidEntityException;
+ ReportExec save(ReportExec execution);
void delete(Long key);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java
----------------------------------------------------------------------
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
deleted file mode 100644
index bad9b47..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java
+++ /dev/null
@@ -1,92 +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 java.util.List;
-import java.util.Map;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.Policy;
-import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-
-public interface RoleDAO extends SubjectDAO<RPlainAttr, RDerAttr, RVirAttr> {
-
- Role find(Long key);
-
- List<Role> find(String name);
-
- Role find(String name, Long parent);
-
- List<Role> findOwnedByUser(Long userId);
-
- List<Role> findOwnedByRole(Long roleId);
-
- List<Role> findByEntitlement(Entitlement entitlement);
-
- List<Role> findByPolicy(Policy policy);
-
- List<Role> findWithoutPolicy(PolicyType type);
-
- List<Role> findAncestors(Role role);
-
- List<Role> findChildren(Role role);
-
- List<Role> findDescendants(Role role);
-
- List<Role> findByDerAttrValue(String schemaName, String value);
-
- List<Role> findByAttrValue(String schemaName, RPlainAttrValue attrValue);
-
- Role findByAttrUniqueValue(String schemaName, RPlainAttrValue attrUniqueValue);
-
- List<Role> findByResource(ExternalResource resource);
-
- List<Role> findAll();
-
- List<Role> findAll(int page, int itemsPerPage, List<OrderByClause> orderBy);
-
- List<Membership> findMemberships(Role role);
-
- int count();
-
- Role save(Role role) throws InvalidEntityException;
-
- void delete(Role role);
-
- void delete(Long key);
-
- Role authFetch(Long key);
-
- /**
- * Finds users having resources assigned exclusively because of memberships of the given role.
- *
- * @param roleKey role key
- * @return map containing pairs with user key and operations to be performed on those resources (DELETE, typically).
- */
- Map<Long, PropagationByResource> findUsersWithIndirectResources(Long roleKey);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SecurityQuestionDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SecurityQuestionDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SecurityQuestionDAO.java
index ba66a4b..e001f41 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SecurityQuestionDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SecurityQuestionDAO.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
public interface SecurityQuestionDAO extends DAO<SecurityQuestion, Long> {
@@ -28,7 +27,7 @@ public interface SecurityQuestionDAO extends DAO<SecurityQuestion, Long> {
List<SecurityQuestion> findAll();
- SecurityQuestion save(SecurityQuestion securityQuestion) throws InvalidEntityException;
+ SecurityQuestion save(SecurityQuestion securityQuestion);
void delete(Long key);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java
index 08e1851..c90cdf8 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java
@@ -23,64 +23,61 @@ import java.util.Set;
import org.apache.syncope.common.lib.types.SubjectType;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.Subject;
-import org.apache.syncope.core.persistence.api.entity.VirAttr;
public interface SubjectSearchDAO extends DAO<Subject<?, ?, ?>, Long> {
/**
- * @param adminRoles the set of admin roles owned by the caller
+ * @param adminGroups the set of admin groups owned by the caller
* @param searchCondition the search condition
- * @param type user or role
+ * @param type user or group
* @return size of search result
*/
- int count(Set<Long> adminRoles, SearchCond searchCondition, SubjectType type);
+ int count(Set<Long> adminGroups, SearchCond searchCondition, SubjectType type);
/**
- * @param adminRoles the set of admin roles owned by the caller
+ * @param adminGroups the set of admin groups owned by the caller
* @param searchCondition the search condition
- * @param type user or role
- * @param <T> user/role
- * @return the list of users/roles matching the given search condition
+ * @param type user or group
+ * @param <T> user/group
+ * @return the list of users/groups matching the given search condition
*/
<T extends Subject<?, ?, ?>> List<T> search(
- Set<Long> adminRoles, SearchCond searchCondition, SubjectType type);
+ Set<Long> adminGroups, SearchCond searchCondition, SubjectType type);
/**
- * @param adminRoles the set of admin roles owned by the caller
+ * @param adminGroups the set of admin groups owned by the caller
* @param searchCondition the search condition
* @param orderBy list of ordering clauses
- * @param type user or role
- * @param <T> user/role
- * @return the list of users/roles matching the given search condition
+ * @param type user or group
+ * @param <T> user/group
+ * @return the list of users/groups matching the given search condition
*/
<T extends Subject<?, ?, ?>> List<T> search(
- Set<Long> adminRoles, SearchCond searchCondition, List<OrderByClause> orderBy, SubjectType type);
+ Set<Long> adminGroups, SearchCond searchCondition, List<OrderByClause> orderBy, SubjectType type);
/**
- * @param adminRoles the set of admin roles owned by the caller
+ * @param adminGroups the set of admin groups owned by the caller
* @param searchCondition the search condition
* @param page position of the first result, start from 1
* @param itemsPerPage number of results per page
* @param orderBy list of ordering clauses
- * @param type user or role
- * @param <T> user/role
- * @return the list of users/roles matching the given search condition (in the given page)
+ * @param type user or group
+ * @param <T> user/group
+ * @return the list of users/groups matching the given search condition (in the given page)
*/
<T extends Subject<?, ?, ?>> List<T> search(
- Set<Long> adminRoles, SearchCond searchCondition, int page, int itemsPerPage,
+ Set<Long> adminGroups, SearchCond searchCondition, int page, int itemsPerPage,
List<OrderByClause> orderBy, SubjectType type);
/**
- * Verify if user/role matches the given search condition.
+ * Verify if user/group matches the given search condition.
*
* @param subject to be checked
* @param searchCondition to be verified
- * @param type user or role
- * @param <T> user/role
- * @return true if user/role matches searchCondition
+ * @param type user or group
+ * @param <T> user/group
+ * @return true if user/group matches searchCondition
*/
<T extends Subject<?, ?, ?>> boolean matches(T subject, SearchCond searchCondition, SubjectType type);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskDAO.java
index 28c90a6..0b82276 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskDAO.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.task.Task;
@@ -42,7 +41,7 @@ public interface TaskDAO extends DAO<Task, Long> {
int count(TaskType type);
- <T extends Task> T save(T task) throws InvalidEntityException;
+ <T extends Task> T save(T task);
void delete(Long key);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskExecDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskExecDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskExecDAO.java
index e0f58ff..103016d 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskExecDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskExecDAO.java
@@ -20,7 +20,6 @@ package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.task.Task;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
@@ -34,9 +33,9 @@ public interface TaskExecDAO extends DAO<TaskExec, Long> {
List<TaskExec> findAll(TaskType type);
- TaskExec save(TaskExec execution) throws InvalidEntityException;
+ TaskExec save(TaskExec execution);
- void saveAndAdd(Long taskId, TaskExec execution) throws InvalidEntityException;
+ void saveAndAdd(Long taskId, TaskExec execution);
void delete(Long key);
[20/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/report/RoleReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/RoleReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/RoleReportletConf.java
deleted file mode 100644
index 9f73d3d..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/RoleReportletConf.java
+++ /dev/null
@@ -1,109 +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.report;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.annotation.FormAttributeField;
-import org.apache.syncope.common.lib.types.IntMappingType;
-
-@XmlRootElement(name = "roleReportletConf")
-@XmlType
-public class RoleReportletConf extends AbstractReportletConf {
-
- private static final long serialVersionUID = -8488503068032439699L;
-
- @XmlEnum
- @XmlType(name = "roleReportletConfFeature")
- public enum Feature {
-
- key,
- name,
- roleOwner,
- userOwner,
- entitlements,
- users,
- resources
-
- }
-
- @FormAttributeField(userSearch = true)
- private String matchingCond;
-
- @FormAttributeField(schema = IntMappingType.RolePlainSchema)
- private final List<String> plainAttrs = new ArrayList<>();
-
- @FormAttributeField(schema = IntMappingType.RoleDerivedSchema)
- private final List<String> derAttrs = new ArrayList<>();
-
- @FormAttributeField(schema = IntMappingType.RoleVirtualSchema)
- private final List<String> virAttrs = new ArrayList<>();
-
- private final List<Feature> features = new ArrayList<>();
-
- public RoleReportletConf() {
- super();
- }
-
- public RoleReportletConf(final String name) {
- super(name);
- }
-
- @XmlElementWrapper(name = "plainAttributes")
- @XmlElement(name = "plainAttribute")
- @JsonProperty("plainAttributes")
- public List<String> getPlainAttrs() {
- return plainAttrs;
- }
-
- @XmlElementWrapper(name = "derivedAttributes")
- @XmlElement(name = "attribute")
- @JsonProperty("derivedAttributes")
- public List<String> getDerAttrs() {
- return derAttrs;
- }
-
- @XmlElementWrapper(name = "virtualAttributes")
- @XmlElement(name = "attribute")
- @JsonProperty("virtualAttributes")
- public List<String> getVirAttrs() {
- return virAttrs;
- }
-
- @XmlElementWrapper(name = "features")
- @XmlElement(name = "feature")
- @JsonProperty("features")
- public List<Feature> getFeatures() {
- return features;
- }
-
- public String getMatchingCond() {
- return matchingCond;
- }
-
- public void setMatchingCond(final String matchingCond) {
- this.matchingCond = matchingCond;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/report/StaticReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/StaticReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/StaticReportletConf.java
index 9160089..6d867b2 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/StaticReportletConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/StaticReportletConf.java
@@ -60,7 +60,7 @@ public class StaticReportletConf extends AbstractReportletConf {
: new Date(dateField.getTime());
}
- public void setDateField(Date dateField) {
+ public void setDateField(final Date dateField) {
this.dateField = dateField == null
? null
: new Date(dateField.getTime());
@@ -70,7 +70,7 @@ public class StaticReportletConf extends AbstractReportletConf {
return doubleField;
}
- public void setDoubleField(Double doubleField) {
+ public void setDoubleField(final Double doubleField) {
this.doubleField = doubleField;
}
@@ -85,7 +85,7 @@ public class StaticReportletConf extends AbstractReportletConf {
return longField;
}
- public void setLongField(Long longField) {
+ public void setLongField(final Long longField) {
this.longField = longField;
}
@@ -93,7 +93,7 @@ public class StaticReportletConf extends AbstractReportletConf {
return stringField;
}
- public void setStringField(String stringField) {
+ public void setStringField(final String stringField) {
this.stringField = stringField;
}
@@ -101,7 +101,7 @@ public class StaticReportletConf extends AbstractReportletConf {
return traceLevel;
}
- public void setTraceLevel(TraceLevel traceLevel) {
+ public void setTraceLevel(final TraceLevel traceLevel) {
this.traceLevel = traceLevel;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
index 78735eb..ce783ff 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
@@ -21,18 +21,15 @@ package org.apache.syncope.common.lib.report;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
-
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.annotation.FormAttributeField;
-import org.apache.syncope.common.lib.types.IntMappingType;
@XmlRootElement(name = "userReportletConf")
@XmlType
-public class UserReportletConf extends AbstractReportletConf {
+public class UserReportletConf extends AbstractSubjectReportletConf {
@XmlEnum
@XmlType(name = "userReportletConfFeature")
@@ -54,18 +51,6 @@ public class UserReportletConf extends AbstractReportletConf {
private static final long serialVersionUID = 6602717600064602764L;
- @FormAttributeField(userSearch = true)
- private String matchingCond;
-
- @FormAttributeField(schema = IntMappingType.UserPlainSchema)
- private final List<String> plainAttrs = new ArrayList<>();
-
- @FormAttributeField(schema = IntMappingType.UserDerivedSchema)
- private final List<String> derAttrs = new ArrayList<>();
-
- @FormAttributeField(schema = IntMappingType.UserVirtualSchema)
- private final List<String> virAttrs = new ArrayList<>();
-
private final List<Feature> features = new ArrayList<>();
public UserReportletConf() {
@@ -76,27 +61,6 @@ public class UserReportletConf extends AbstractReportletConf {
super(name);
}
- @XmlElementWrapper(name = "plainAttributes")
- @XmlElement(name = "plainAttribute")
- @JsonProperty("plainAttributes")
- public List<String> getPlainAttrs() {
- return plainAttrs;
- }
-
- @XmlElementWrapper(name = "derivedAttributes")
- @XmlElement(name = "attribute")
- @JsonProperty("derivedAttributes")
- public List<String> getDerAttrs() {
- return derAttrs;
- }
-
- @XmlElementWrapper(name = "virtualAttributes")
- @XmlElement(name = "attribute")
- @JsonProperty("virtualAttributes")
- public List<String> getVirAttrs() {
- return virAttrs;
- }
-
@XmlElementWrapper(name = "features")
@XmlElement(name = "feature")
@JsonProperty("features")
@@ -104,11 +68,4 @@ public class UserReportletConf extends AbstractReportletConf {
return features;
}
- public String getMatchingCond() {
- return matchingCond;
- }
-
- public void setMatchingCond(final String matchingCond) {
- this.matchingCond = matchingCond;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/AbstractFiqlSearchConditionBuilder.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/AbstractFiqlSearchConditionBuilder.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/AbstractFiqlSearchConditionBuilder.java
new file mode 100644
index 0000000..9279e72
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/AbstractFiqlSearchConditionBuilder.java
@@ -0,0 +1,112 @@
+/*
+ * 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.search;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.cxf.jaxrs.ext.search.SearchUtils;
+import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
+import org.apache.cxf.jaxrs.ext.search.client.FiqlSearchConditionBuilder;
+import org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser;
+
+public abstract class AbstractFiqlSearchConditionBuilder extends FiqlSearchConditionBuilder {
+
+ public static final Map<String, String> CONTEXTUAL_PROPERTIES = new HashMap<String, String>() {
+
+ private static final long serialVersionUID = 3109256773218160485L;
+
+ {
+ put(SearchUtils.LAX_PROPERTY_MATCH, "true");
+ }
+ };
+
+ protected AbstractFiqlSearchConditionBuilder() {
+ super();
+ }
+
+ protected AbstractFiqlSearchConditionBuilder(final Map<String, String> properties) {
+ super(properties);
+ }
+
+ @Override
+ protected Builder newBuilderInstance() {
+ return new Builder(properties);
+ }
+
+ public SyncopeProperty is(final String property) {
+ return newBuilderInstance().is(property);
+ }
+
+ public CompleteCondition isNull(final String property) {
+ return newBuilderInstance().is(property).nullValue();
+ }
+
+ public CompleteCondition isNotNull(final String property) {
+ return newBuilderInstance().is(property).notNullValue();
+ }
+
+ public CompleteCondition hasResources(final String resource, final String... moreResources) {
+ return newBuilderInstance().is(SpecialAttr.RESOURCES.toString()).hasResources(resource, moreResources);
+ }
+
+ public CompleteCondition hasNotResources(final String resource, final String... moreResources) {
+ return newBuilderInstance().is(SpecialAttr.RESOURCES.toString()).hasNotResources(resource, moreResources);
+ }
+
+ protected static class Builder extends FiqlSearchConditionBuilder.Builder
+ implements SyncopeProperty, CompleteCondition {
+
+ protected Builder(final Map<String, String> properties) {
+ super(properties);
+ }
+
+ protected Builder(final Builder parent) {
+ super(parent);
+ }
+
+ @Override
+ public SyncopeProperty is(final String property) {
+ Builder b = new Builder(this);
+ b.result = property;
+ return b;
+ }
+
+ @Override
+ public CompleteCondition nullValue() {
+ return condition(FiqlParser.EQ, SpecialAttr.NULL);
+ }
+
+ @Override
+ public CompleteCondition notNullValue() {
+ return condition(FiqlParser.NEQ, SpecialAttr.NULL);
+ }
+
+ @Override
+ public CompleteCondition hasResources(final String resource, final String... moreResources) {
+ this.result = SpecialAttr.RESOURCES.toString();
+ return condition(FiqlParser.EQ, resource, (Object[]) moreResources);
+ }
+
+ @Override
+ public CompleteCondition hasNotResources(final String resource, final String... moreResources) {
+ this.result = SpecialAttr.RESOURCES.toString();
+ return condition(FiqlParser.NEQ, resource, (Object[]) moreResources);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
new file mode 100644
index 0000000..4822d2a
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
@@ -0,0 +1,90 @@
+/*
+ * 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.search;
+
+import java.util.Map;
+import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
+import org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser;
+
+/**
+ * Extends <tt>SyncopeFiqlSearchConditionBuilder</tt> by providing some additional facilities for searching
+ * groups in Syncope.
+ */
+public class GroupFiqlSearchConditionBuilder extends AbstractFiqlSearchConditionBuilder {
+
+ public GroupFiqlSearchConditionBuilder() {
+ super();
+ }
+
+ public GroupFiqlSearchConditionBuilder(final Map<String, String> properties) {
+ super(properties);
+ }
+
+ @Override
+ protected Builder newBuilderInstance() {
+ return new Builder(properties);
+ }
+
+ @Override
+ public GroupProperty is(final String property) {
+ return newBuilderInstance().is(property);
+ }
+
+ public CompleteCondition hasEntitlements(final String entitlement, final String... moreEntitlements) {
+ return newBuilderInstance().is(SpecialAttr.ENTITLEMENTS.toString()).
+ hasEntitlements(entitlement, moreEntitlements);
+ }
+
+ public CompleteCondition hasNotEntitlements(final String entitlement, final String... moreEntitlements) {
+ return newBuilderInstance().is(SpecialAttr.ENTITLEMENTS.toString()).
+ hasNotEntitlements(entitlement, moreEntitlements);
+ }
+
+ protected static class Builder extends AbstractFiqlSearchConditionBuilder.Builder
+ implements GroupProperty, CompleteCondition {
+
+ public Builder(final Map<String, String> properties) {
+ super(properties);
+ }
+
+ public Builder(final Builder parent) {
+ super(parent);
+ }
+
+ @Override
+ public GroupProperty is(final String property) {
+ Builder b = new Builder(this);
+ b.result = property;
+ return b;
+ }
+
+ @Override
+ public CompleteCondition hasEntitlements(final String entitlement, final String... moreEntitlements) {
+ this.result = SpecialAttr.ENTITLEMENTS.toString();
+ return condition(FiqlParser.EQ, entitlement, (Object[]) moreEntitlements);
+ }
+
+ @Override
+ public CompleteCondition hasNotEntitlements(final String entitlement, final String... moreEntitlements) {
+ this.result = SpecialAttr.ENTITLEMENTS.toString();
+ return condition(FiqlParser.NEQ, entitlement, (Object[]) moreEntitlements);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
new file mode 100644
index 0000000..7868016
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
@@ -0,0 +1,29 @@
+/*
+ * 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.search;
+
+import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
+
+public interface GroupProperty extends SyncopeProperty {
+
+ CompleteCondition hasEntitlements(String entitlement, String... moreEntitlements);
+
+ CompleteCondition hasNotEntitlements(String entitlement, String... moreEntitlements);
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/RoleFiqlSearchConditionBuilder.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/RoleFiqlSearchConditionBuilder.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/RoleFiqlSearchConditionBuilder.java
deleted file mode 100644
index b6cbb6d..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/RoleFiqlSearchConditionBuilder.java
+++ /dev/null
@@ -1,90 +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.search;
-
-import java.util.Map;
-import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
-import org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser;
-
-/**
- * Extends <tt>SyncopeFiqlSearchConditionBuilder</tt> by providing some additional facilities for searching
- * roles in Syncope.
- */
-public class RoleFiqlSearchConditionBuilder extends SyncopeFiqlSearchConditionBuilder {
-
- public RoleFiqlSearchConditionBuilder() {
- super();
- }
-
- public RoleFiqlSearchConditionBuilder(final Map<String, String> properties) {
- super(properties);
- }
-
- @Override
- protected Builder newBuilderInstance() {
- return new Builder(properties);
- }
-
- @Override
- public RoleProperty is(final String property) {
- return newBuilderInstance().is(property);
- }
-
- public CompleteCondition hasEntitlements(final String entitlement, final String... moreEntitlements) {
- return newBuilderInstance().is(SpecialAttr.ENTITLEMENTS.toString()).
- hasEntitlements(entitlement, moreEntitlements);
- }
-
- public CompleteCondition hasNotEntitlements(final String entitlement, final String... moreEntitlements) {
- return newBuilderInstance().is(SpecialAttr.ENTITLEMENTS.toString()).
- hasNotEntitlements(entitlement, moreEntitlements);
- }
-
- protected static class Builder extends SyncopeFiqlSearchConditionBuilder.Builder
- implements RoleProperty, CompleteCondition {
-
- public Builder(final Map<String, String> properties) {
- super(properties);
- }
-
- public Builder(final Builder parent) {
- super(parent);
- }
-
- @Override
- public RoleProperty is(final String property) {
- Builder b = new Builder(this);
- b.result = property;
- return b;
- }
-
- @Override
- public CompleteCondition hasEntitlements(final String entitlement, final String... moreEntitlements) {
- this.result = SpecialAttr.ENTITLEMENTS.toString();
- return condition(FiqlParser.EQ, entitlement, (Object[]) moreEntitlements);
- }
-
- @Override
- public CompleteCondition hasNotEntitlements(final String entitlement, final String... moreEntitlements) {
- this.result = SpecialAttr.ENTITLEMENTS.toString();
- return condition(FiqlParser.NEQ, entitlement, (Object[]) moreEntitlements);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/RoleProperty.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/RoleProperty.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/RoleProperty.java
deleted file mode 100644
index 433ed11..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/RoleProperty.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.common.lib.search;
-
-import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
-
-public interface RoleProperty extends SyncopeProperty {
-
- CompleteCondition hasEntitlements(String entitlement, String... moreEntitlements);
-
- CompleteCondition hasNotEntitlements(String entitlement, String... moreEntitlements);
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
index 4945cca..7a27a2b 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
@@ -26,23 +26,23 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.to.AbstractAttributableTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.SubjectType;
-public class SearchableFields {
+public final class SearchableFields {
- protected static final String[] ATTRIBUTES_NOTINCLUDED = {
+ private static final String[] ATTRIBUTES_NOTINCLUDED = {
"serialVersionUID", "password"
};
- public static final List<String> get(final SubjectType subjectType) {
+ public static List<String> get(final SubjectType subjectType) {
return get(subjectType == SubjectType.USER
? UserTO.class
- : RoleTO.class);
+ : GroupTO.class);
}
- public static final List<String> get(final Class<? extends AbstractAttributableTO> attributableRef) {
+ public static List<String> get(final Class<? extends AbstractAttributableTO> attributableRef) {
final List<String> fieldNames = new ArrayList<>();
// loop on class and all superclasses searching for field
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
index b4c2f21..22e339e 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
@@ -22,7 +22,7 @@ public enum SpecialAttr {
NULL("$null"),
RESOURCES("$resources"),
- ROLES("$roles"),
+ GROUPS("$groups"),
ENTITLEMENTS("$entitlements");
private final String literal;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeFiqlSearchConditionBuilder.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeFiqlSearchConditionBuilder.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeFiqlSearchConditionBuilder.java
deleted file mode 100644
index 6c710a2..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeFiqlSearchConditionBuilder.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.common.lib.search;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.cxf.jaxrs.ext.search.SearchUtils;
-import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
-import org.apache.cxf.jaxrs.ext.search.client.FiqlSearchConditionBuilder;
-import org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser;
-
-public abstract class SyncopeFiqlSearchConditionBuilder extends FiqlSearchConditionBuilder {
-
- public static final Map<String, String> CONTEXTUAL_PROPERTIES;
-
- static {
- CONTEXTUAL_PROPERTIES = new HashMap<String, String>();
- CONTEXTUAL_PROPERTIES.put(SearchUtils.LAX_PROPERTY_MATCH, "true");
- }
-
- protected SyncopeFiqlSearchConditionBuilder() {
- super();
- }
-
- protected SyncopeFiqlSearchConditionBuilder(final Map<String, String> properties) {
- super(properties);
- }
-
- @Override
- protected Builder newBuilderInstance() {
- return new Builder(properties);
- }
-
- public SyncopeProperty is(final String property) {
- return newBuilderInstance().is(property);
- }
-
- public CompleteCondition isNull(final String property) {
- return newBuilderInstance().is(property).nullValue();
- }
-
- public CompleteCondition isNotNull(final String property) {
- return newBuilderInstance().is(property).notNullValue();
- }
-
- public CompleteCondition hasResources(final String resource, final String... moreResources) {
- return newBuilderInstance().is(SpecialAttr.RESOURCES.toString()).hasResources(resource, moreResources);
- }
-
- public CompleteCondition hasNotResources(final String resource, final String... moreResources) {
- return newBuilderInstance().is(SpecialAttr.RESOURCES.toString()).hasNotResources(resource, moreResources);
- }
-
- protected static class Builder extends FiqlSearchConditionBuilder.Builder
- implements SyncopeProperty, CompleteCondition {
-
- protected Builder(final Map<String, String> properties) {
- super(properties);
- }
-
- protected Builder(final Builder parent) {
- super(parent);
- }
-
- @Override
- public SyncopeProperty is(final String property) {
- Builder b = new Builder(this);
- b.result = property;
- return b;
- }
-
- @Override
- public CompleteCondition nullValue() {
- return condition(FiqlParser.EQ, SpecialAttr.NULL);
- }
-
- @Override
- public CompleteCondition notNullValue() {
- return condition(FiqlParser.NEQ, SpecialAttr.NULL);
- }
-
- @Override
- public CompleteCondition hasResources(final String resource, final String... moreResources) {
- this.result = SpecialAttr.RESOURCES.toString();
- return condition(FiqlParser.EQ, resource, (Object[]) moreResources);
- }
-
- @Override
- public CompleteCondition hasNotResources(final String resource, final String... moreResources) {
- this.result = SpecialAttr.RESOURCES.toString();
- return condition(FiqlParser.NEQ, resource, (Object[]) moreResources);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeProperty.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeProperty.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeProperty.java
index 0f833f8..7673b86 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeProperty.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SyncopeProperty.java
@@ -24,12 +24,12 @@ import org.apache.cxf.jaxrs.ext.search.client.Property;
/**
* Extension of fluent interface, for {@link SyncopeFiqlSearchConditionBuilder}.
*/
-public abstract interface SyncopeProperty extends Property {
+public interface SyncopeProperty extends Property {
CompleteCondition nullValue();
CompleteCondition notNullValue();
-
+
CompleteCondition hasResources(String resource, String... moreResources);
CompleteCondition hasNotResources(String resource, String... moreResources);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/UserFiqlSearchConditionBuilder.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/UserFiqlSearchConditionBuilder.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/UserFiqlSearchConditionBuilder.java
index ef16e3d..020866d 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/UserFiqlSearchConditionBuilder.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/UserFiqlSearchConditionBuilder.java
@@ -26,7 +26,7 @@ import org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser;
* Extends <tt>SyncopeFiqlSearchConditionBuilder</tt> by providing some additional facilities for searching
* users in Syncope.
*/
-public class UserFiqlSearchConditionBuilder extends SyncopeFiqlSearchConditionBuilder {
+public class UserFiqlSearchConditionBuilder extends AbstractFiqlSearchConditionBuilder {
public UserFiqlSearchConditionBuilder() {
super();
@@ -46,12 +46,12 @@ public class UserFiqlSearchConditionBuilder extends SyncopeFiqlSearchConditionBu
return newBuilderInstance().is(property);
}
- public CompleteCondition hasRoles(final Long role, final Long... moreRoles) {
- return newBuilderInstance().is(SpecialAttr.ROLES.toString()).hasRoles(role, moreRoles);
+ public CompleteCondition inGroups(final Long group, final Long... moreGroups) {
+ return newBuilderInstance().is(SpecialAttr.GROUPS.toString()).inGroups(group, moreGroups);
}
- public CompleteCondition hasNotRoles(final Long role, final Long... moreRoles) {
- return newBuilderInstance().is(SpecialAttr.ROLES.toString()).hasNotRoles(role, moreRoles);
+ public CompleteCondition notInGroups(final Long group, final Long... moreGroups) {
+ return newBuilderInstance().is(SpecialAttr.GROUPS.toString()).notInGroups(group, moreGroups);
}
public CompleteCondition hasResources(final String resource, final String... moreResources) {
@@ -62,7 +62,7 @@ public class UserFiqlSearchConditionBuilder extends SyncopeFiqlSearchConditionBu
return newBuilderInstance().is(SpecialAttr.RESOURCES.toString()).hasNotResources(resource, moreResources);
}
- protected static class Builder extends SyncopeFiqlSearchConditionBuilder.Builder
+ protected static class Builder extends AbstractFiqlSearchConditionBuilder.Builder
implements UserProperty, CompleteCondition {
public Builder(final Map<String, String> properties) {
@@ -81,15 +81,15 @@ public class UserFiqlSearchConditionBuilder extends SyncopeFiqlSearchConditionBu
}
@Override
- public CompleteCondition hasRoles(final Long role, final Long... moreRoles) {
- this.result = SpecialAttr.ROLES.toString();
- return condition(FiqlParser.EQ, role, (Object[]) moreRoles);
+ public CompleteCondition inGroups(final Long group, final Long... moreGroups) {
+ this.result = SpecialAttr.GROUPS.toString();
+ return condition(FiqlParser.EQ, group, (Object[]) moreGroups);
}
@Override
- public CompleteCondition hasNotRoles(final Long role, final Long... moreRoles) {
- this.result = SpecialAttr.ROLES.toString();
- return condition(FiqlParser.NEQ, role, (Object[]) moreRoles);
+ public CompleteCondition notInGroups(final Long group, final Long... moreGroups) {
+ this.result = SpecialAttr.GROUPS.toString();
+ return condition(FiqlParser.NEQ, group, (Object[]) moreGroups);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/search/UserProperty.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/UserProperty.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/UserProperty.java
index 886f27f..fb4d7d6 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/UserProperty.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/UserProperty.java
@@ -22,8 +22,8 @@ import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
public interface UserProperty extends SyncopeProperty {
- CompleteCondition hasRoles(Long role, Long... moreRoles);
+ CompleteCondition inGroups(Long group, Long... moreGroups);
- CompleteCondition hasNotRoles(Long role, Long... moreRoles);
+ CompleteCondition notInGroups(Long group, Long... moreGroups);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractExecTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractExecTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractExecTO.java
index 71b735f..eed8453 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractExecTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractExecTO.java
@@ -18,12 +18,10 @@
*/
package org.apache.syncope.common.lib.to;
-import java.util.Date;
import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlType
-public class AbstractExecTO extends AbstractBaseBean {
+public class AbstractExecTO extends AbstractStartEndBean {
private static final long serialVersionUID = -4621191979198357081L;
@@ -33,15 +31,11 @@ public class AbstractExecTO extends AbstractBaseBean {
protected String message;
- protected Date startDate;
-
- protected Date endDate;
-
public long getKey() {
return key;
}
- public void setKey(long key) {
+ public void setKey(final long key) {
this.key = key;
}
@@ -60,28 +54,4 @@ public class AbstractExecTO extends AbstractBaseBean {
public void setStatus(final String status) {
this.status = status;
}
-
- public Date getStartDate() {
- return startDate == null
- ? null
- : new Date(startDate.getTime());
- }
-
- public void setStartDate(final Date startDate) {
- if (startDate != null) {
- this.startDate = new Date(startDate.getTime());
- }
- }
-
- public Date getEndDate() {
- return endDate == null
- ? null
- : new Date(endDate.getTime());
- }
-
- public void setEndDate(final Date endDate) {
- if (endDate != null) {
- this.endDate = new Date(endDate.getTime());
- }
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
index 3851f4e..3ecb44f 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
@@ -46,13 +46,13 @@ public abstract class AbstractPolicyTO extends AbstractBaseBean {
private final List<String> usedByResources = new ArrayList<>();
- private final List<Long> usedByRoles = new ArrayList<>();
+ private final List<Long> usedByGroups = new ArrayList<>();
public long getKey() {
return key;
}
- public void setKey(long key) {
+ public void setKey(final long key) {
this.key = key;
}
@@ -79,11 +79,11 @@ public abstract class AbstractPolicyTO extends AbstractBaseBean {
return usedByResources;
}
- @XmlElementWrapper(name = "usedByRoles")
- @XmlElement(name = "role")
- @JsonProperty("usedByRoles")
- public List<Long> getUsedByRoles() {
- return usedByRoles;
+ @XmlElementWrapper(name = "usedByGroups")
+ @XmlElement(name = "group")
+ @JsonProperty("usedByGroups")
+ public List<Long> getUsedByGroups() {
+ return usedByGroups;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
index fe92877..c1dcf1c 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
@@ -50,13 +50,13 @@ public class AbstractProvisioningTaskTO extends SchedTaskTO {
private MatchingRule matchingRule;
- private List<String> actionsClassNames = new ArrayList<>();
+ private final List<String> actionsClassNames = new ArrayList<>();
public String getResource() {
return resource;
}
- public void setResource(String resource) {
+ public void setResource(final String resource) {
this.resource = resource;
}
@@ -64,7 +64,7 @@ public class AbstractProvisioningTaskTO extends SchedTaskTO {
return performCreate;
}
- public void setPerformCreate(boolean performCreate) {
+ public void setPerformCreate(final boolean performCreate) {
this.performCreate = performCreate;
}
@@ -72,7 +72,7 @@ public class AbstractProvisioningTaskTO extends SchedTaskTO {
return performUpdate;
}
- public void setPerformUpdate(boolean performUpdate) {
+ public void setPerformUpdate(final boolean performUpdate) {
this.performUpdate = performUpdate;
}
@@ -80,7 +80,7 @@ public class AbstractProvisioningTaskTO extends SchedTaskTO {
return performDelete;
}
- public void setPerformDelete(boolean performDelete) {
+ public void setPerformDelete(final boolean performDelete) {
this.performDelete = performDelete;
}
@@ -88,7 +88,7 @@ public class AbstractProvisioningTaskTO extends SchedTaskTO {
return syncStatus;
}
- public void setSyncStatus(boolean syncStatus) {
+ public void setSyncStatus(final boolean syncStatus) {
this.syncStatus = syncStatus;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java
new file mode 100644
index 0000000..4f3749f
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java
@@ -0,0 +1,57 @@
+/*
+ * 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 java.util.Date;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+
+@XmlType
+public class AbstractStartEndBean extends AbstractBaseBean {
+
+ private static final long serialVersionUID = 2399577415544539917L;
+
+ protected Date startDate;
+
+ protected Date endDate;
+
+ public Date getStartDate() {
+ return startDate == null
+ ? null
+ : new Date(startDate.getTime());
+ }
+
+ public void setStartDate(final Date startDate) {
+ if (startDate != null) {
+ this.startDate = new Date(startDate.getTime());
+ }
+ }
+
+ public Date getEndDate() {
+ return endDate == null
+ ? null
+ : new Date(endDate.getTime());
+ }
+
+ public void setEndDate(final Date endDate) {
+ if (endDate != null) {
+ this.endDate = new Date(endDate.getTime());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractTaskTO.java
index eb61493..21e1cb0 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractTaskTO.java
@@ -22,20 +22,18 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlRootElement(name = "abstractTask")
@XmlType
@XmlSeeAlso({ PropagationTaskTO.class, SchedTaskTO.class, NotificationTaskTO.class })
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
-public abstract class AbstractTaskTO extends AbstractBaseBean {
+public abstract class AbstractTaskTO extends AbstractStartEndBean {
private static final long serialVersionUID = 386450127003321197L;
@@ -45,10 +43,6 @@ public abstract class AbstractTaskTO extends AbstractBaseBean {
private final List<TaskExecTO> executions = new ArrayList<>();
- private Date startDate;
-
- private Date endDate;
-
public long getKey() {
return key;
}
@@ -71,28 +65,4 @@ public abstract class AbstractTaskTO extends AbstractBaseBean {
public List<TaskExecTO> getExecutions() {
return executions;
}
-
- public Date getStartDate() {
- return startDate == null
- ? null
- : new Date(startDate.getTime());
- }
-
- public void setStartDate(final Date startDate) {
- if (startDate != null) {
- this.startDate = new Date(startDate.getTime());
- }
- }
-
- public Date getEndDate() {
- return endDate == null
- ? null
- : new Date(endDate.getTime());
- }
-
- public void setEndDate(final Date endDate) {
- if (endDate != null) {
- this.endDate = new Date(endDate.getTime());
- }
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
index dfe52de..fb34a73 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
@@ -111,6 +111,8 @@ public class BulkActionResult extends AbstractBaseBean {
}
public Result(final String key, final Status value) {
+ super();
+
this.key = key;
this.value = value;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnBundleTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnBundleTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnBundleTO.java
index 87583a4..b62c353 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnBundleTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnBundleTO.java
@@ -44,7 +44,7 @@ public class ConnBundleTO extends AbstractBaseBean {
private String version;
- private List<ConnConfPropSchema> properties = new ArrayList<>();
+ private final List<ConnConfPropSchema> properties = new ArrayList<>();
public String getDisplayName() {
return displayName;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnIdObjectClassTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnIdObjectClassTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnIdObjectClassTO.java
index fd4d0b7..14810bb 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnIdObjectClassTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnIdObjectClassTO.java
@@ -49,16 +49,18 @@ public class ConnIdObjectClassTO extends AbstractBaseBean {
}
}
- public static ConnIdObjectClassTO ACCOUNT = new ConnIdObjectClassTO(DefaultType.ACCOUNT.getSpecialName());
+ public static final ConnIdObjectClassTO ACCOUNT = new ConnIdObjectClassTO(DefaultType.ACCOUNT.getSpecialName());
- public static ConnIdObjectClassTO GROUP = new ConnIdObjectClassTO(DefaultType.GROUP.getSpecialName());
+ public static final ConnIdObjectClassTO GROUP = new ConnIdObjectClassTO(DefaultType.GROUP.getSpecialName());
private String type;
public ConnIdObjectClassTO() {
+ super();
}
public ConnIdObjectClassTO(final String type) {
+ super();
this.type = type;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/EventCategoryTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/EventCategoryTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/EventCategoryTO.java
index 8e11686..918a4d6 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/EventCategoryTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/EventCategoryTO.java
@@ -40,19 +40,22 @@ public class EventCategoryTO extends AbstractBaseBean {
private String subcategory;
- private final List<String> events = new ArrayList<String>();
+ private final List<String> events = new ArrayList<>();
/**
* Constructor for Type.REST event category.
*/
public EventCategoryTO() {
- this.type = AuditElements.EventCategoryType.REST;
+ this(AuditElements.EventCategoryType.REST);
}
/**
* Constructor for the given Type event category.
+ *
+ * @param type event category type
*/
public EventCategoryTO(final AuditElements.EventCategoryType type) {
+ super();
this.type = type;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
new file mode 100644
index 0000000..12455c5
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
@@ -0,0 +1,258 @@
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "group")
+@XmlType
+@JsonIgnoreProperties({ "displayName" })
+public class GroupTO extends AbstractSubjectTO {
+
+ private static final long serialVersionUID = -7785920258290147542L;
+
+ private String name;
+
+ private long parent;
+
+ private Long userOwner;
+
+ private Long groupOwner;
+
+ private boolean inheritOwner;
+
+ private boolean inheritTemplates;
+
+ private boolean inheritPlainAttrs;
+
+ private boolean inheritDerAttrs;
+
+ private boolean inheritVirAttrs;
+
+ private boolean inheritPasswordPolicy;
+
+ private boolean inheritAccountPolicy;
+
+ private final List<String> entitlements = new ArrayList<>();
+
+ private final List<String> gPlainAttrTemplates = new ArrayList<>();
+
+ private final List<String> gDerAttrTemplates = new ArrayList<>();
+
+ private final List<String> gVirAttrTemplates = new ArrayList<>();
+
+ private final List<String> mPlainAttrTemplates = new ArrayList<>();
+
+ private final List<String> mDerAttrTemplates = new ArrayList<>();
+
+ private final List<String> mVirAttrTemplates = new ArrayList<>();
+
+ private Long passwordPolicy;
+
+ private Long accountPolicy;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public long getParent() {
+ return parent;
+ }
+
+ public void setParent(final long parent) {
+ this.parent = parent;
+ }
+
+ public Long getUserOwner() {
+ return userOwner;
+ }
+
+ public void setUserOwner(final Long userOwner) {
+ this.userOwner = userOwner;
+ }
+
+ public Long getGroupOwner() {
+ return groupOwner;
+ }
+
+ public void setGroupOwner(final Long groupOwner) {
+ this.groupOwner = groupOwner;
+ }
+
+ public boolean isInheritOwner() {
+ return inheritOwner;
+ }
+
+ public void setInheritOwner(final boolean inheritOwner) {
+ this.inheritOwner = inheritOwner;
+ }
+
+ public boolean isInheritTemplates() {
+ return inheritTemplates;
+ }
+
+ public void setInheritTemplates(final boolean inheritTemplates) {
+ this.inheritTemplates = inheritTemplates;
+ }
+
+ public boolean isInheritPlainAttrs() {
+ return inheritPlainAttrs;
+ }
+
+ public void setInheritPlainAttrs(final boolean inheritPlainAttrs) {
+ this.inheritPlainAttrs = inheritPlainAttrs;
+ }
+
+ public boolean isInheritDerAttrs() {
+ return inheritDerAttrs;
+ }
+
+ public void setInheritDerAttrs(final boolean inheritDerAttrs) {
+ this.inheritDerAttrs = inheritDerAttrs;
+ }
+
+ public boolean isInheritVirAttrs() {
+ return inheritVirAttrs;
+ }
+
+ public void setInheritVirAttrs(final boolean inheritVirAttrs) {
+ this.inheritVirAttrs = inheritVirAttrs;
+ }
+
+ @XmlElementWrapper(name = "entitlements")
+ @XmlElement(name = "entitlement")
+ @JsonProperty("entitlements")
+ public List<String> getEntitlements() {
+ return entitlements;
+ }
+
+ @XmlElementWrapper(name = "gPlainAttrTemplates")
+ @XmlElement(name = "gPlainAttrTemplate")
+ @JsonProperty("gPlainAttrTemplates")
+ public List<String> getGPlainAttrTemplates() {
+ return gPlainAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "gDerAttrTemplates")
+ @XmlElement(name = "gDerAttrTemplate")
+ @JsonProperty("gDerAttrTemplates")
+ public List<String> getGDerAttrTemplates() {
+ return gDerAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "gVirAttrTemplates")
+ @XmlElement(name = "gVirAttrTemplate")
+ @JsonProperty("gVirAttrTemplates")
+ public List<String> getGVirAttrTemplates() {
+ return gVirAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "mPlainAttrTemplates")
+ @XmlElement(name = "mPlainAttrTemplate")
+ @JsonProperty("mPlainAttrTemplates")
+ public List<String> getMPlainAttrTemplates() {
+ return mPlainAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "mDerAttrTemplates")
+ @XmlElement(name = "mDerAttrTemplate")
+ @JsonProperty("mDerAttrTemplates")
+ public List<String> getMDerAttrTemplates() {
+ return mDerAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "mVirAttrTemplates")
+ @XmlElement(name = "mVirAttrTemplate")
+ @JsonProperty("mVirAttrTemplates")
+ public List<String> getMVirAttrTemplates() {
+ return mVirAttrTemplates;
+ }
+
+ public Long getPasswordPolicy() {
+ return passwordPolicy;
+ }
+
+ public void setPasswordPolicy(final Long passwordPolicy) {
+ this.passwordPolicy = passwordPolicy;
+ }
+
+ public boolean isInheritPasswordPolicy() {
+ return inheritPasswordPolicy;
+ }
+
+ /**
+ * Specify if password policy must be inherited. In this case eventual passwordPolicy occurrence will be ignored.
+ *
+ * @param inheritPasswordPolicy 'true' to inherit policy, false otherwise.
+ */
+ public void setInheritPasswordPolicy(final boolean inheritPasswordPolicy) {
+ this.inheritPasswordPolicy = inheritPasswordPolicy;
+ }
+
+ public Long getAccountPolicy() {
+ return accountPolicy;
+ }
+
+ public void setAccountPolicy(final Long accountPolicy) {
+ this.accountPolicy = accountPolicy;
+ }
+
+ public boolean isInheritAccountPolicy() {
+ return inheritAccountPolicy;
+ }
+
+ /**
+ * Specify if account policy must be inherited. In this case eventual accountPolicy occurrence will be ignored.
+ *
+ * @param inheritAccountPolicy 'true' to inherit policy, false otherwise.
+ */
+ public void setInheritAccountPolicy(final boolean inheritAccountPolicy) {
+ this.inheritAccountPolicy = inheritAccountPolicy;
+ }
+
+ public String getDisplayName() {
+ return getKey() + " " + getName();
+ }
+
+ public static long fromDisplayName(final String displayName) {
+ long result = 0;
+ if (displayName != null && !displayName.isEmpty() && displayName.indexOf(' ') != -1) {
+ try {
+ result = Long.valueOf(displayName.split(" ")[0]);
+ } catch (NumberFormatException e) {
+ // just to avoid PMD warning about "empty catch block"
+ result = 0;
+ }
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
index aea9556..9ee378a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
@@ -58,7 +58,7 @@ public class MappingTO extends AbstractBaseBean {
protected boolean addAccountIdItem(final MappingItemTO accountIdItem) {
if (IntMappingType.UserVirtualSchema == accountIdItem.getIntMappingType()
- || IntMappingType.RoleVirtualSchema == accountIdItem.getIntMappingType()
+ || IntMappingType.GroupVirtualSchema == accountIdItem.getIntMappingType()
|| IntMappingType.MembershipVirtualSchema == accountIdItem.getIntMappingType()
|| IntMappingType.Password == accountIdItem.getIntMappingType()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
index d53e20a..b3007c1 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
@@ -27,23 +27,23 @@ public class MembershipTO extends AbstractAttributableTO {
private static final long serialVersionUID = 5992828670273935861L;
- private long roleId;
+ private long groupId;
- private String roleName;
+ private String groupName;
- public long getRoleId() {
- return roleId;
+ public long getGroupId() {
+ return groupId;
}
- public void setRoleId(final long roleId) {
- this.roleId = roleId;
+ public void setGroupId(final long groupId) {
+ this.groupId = groupId;
}
- public String getRoleName() {
- return roleName;
+ public String getGroupName() {
+ return groupName;
}
- public void setRoleName(final String roleName) {
- this.roleName = roleName;
+ public void setGroupName(final String groupName) {
+ this.groupName = groupName;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
index 51feffa..d56d2ea 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
@@ -41,7 +41,7 @@ public class NotificationTO extends AbstractBaseBean {
private String userAbout;
- private String roleAbout;
+ private String groupAbout;
private String recipients;
@@ -71,12 +71,12 @@ public class NotificationTO extends AbstractBaseBean {
this.userAbout = userAbout;
}
- public String getRoleAbout() {
- return roleAbout;
+ public String getGroupAbout() {
+ return groupAbout;
}
- public void setRoleAbout(final String roleAbout) {
- this.roleAbout = roleAbout;
+ public void setGroupAbout(final String groupAbout) {
+ this.groupAbout = groupAbout;
}
@XmlElementWrapper(name = "events")
@@ -97,7 +97,7 @@ public class NotificationTO extends AbstractBaseBean {
return key;
}
- public void setKey(Long key) {
+ public void setKey(final Long key) {
this.key = key;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTaskTO.java
index 48661f9..7e0e53d 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTaskTO.java
@@ -91,7 +91,7 @@ public class NotificationTaskTO extends AbstractTaskTO {
return executed;
}
- public void setExecuted(boolean executed) {
+ public void setExecuted(final boolean executed) {
this.executed = executed;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
index 05c4e5a..5ea4ed7 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
@@ -35,7 +35,7 @@ public class PasswordPolicyTO extends AbstractPolicyTO {
this(false);
}
- public PasswordPolicyTO(boolean global) {
+ public PasswordPolicyTO(final boolean global) {
super();
PolicyType type = global
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
index 13d2ff4..8ddf044 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
@@ -29,7 +29,7 @@ public class PushTaskTO extends AbstractProvisioningTaskTO {
private String userFilter;
- private String roleFilter;
+ private String groupFilter;
public String getUserFilter() {
return userFilter;
@@ -39,11 +39,11 @@ public class PushTaskTO extends AbstractProvisioningTaskTO {
this.userFilter = filter;
}
- public String getRoleFilter() {
- return roleFilter;
+ public String getGroupFilter() {
+ return groupFilter;
}
- public void setRoleFilter(final String roleFilter) {
- this.roleFilter = roleFilter;
+ public void setGroupFilter(final String filter) {
+ this.groupFilter = filter;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReportExecTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReportExecTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReportExecTO.java
index ef92b3b..5d78c58 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReportExecTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReportExecTO.java
@@ -33,7 +33,7 @@ public class ReportExecTO extends AbstractExecTO {
return report;
}
- public void setReport(long report) {
+ public void setReport(final long report) {
this.report = report;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReportTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReportTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReportTO.java
index 3d4d4fc..80f74f3 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReportTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReportTO.java
@@ -26,12 +26,11 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.AbstractBaseBean;
import org.apache.syncope.common.lib.report.AbstractReportletConf;
@XmlRootElement(name = "report")
@XmlType
-public class ReportTO extends AbstractBaseBean {
+public class ReportTO extends AbstractStartEndBean {
private static final long serialVersionUID = 5274568072084814410L;
@@ -51,15 +50,11 @@ public class ReportTO extends AbstractBaseBean {
private Date nextExec;
- private Date startDate;
-
- private Date endDate;
-
public long getKey() {
return key;
}
- public void setKey(long key) {
+ public void setKey(final long key) {
this.key = key;
}
@@ -101,6 +96,7 @@ public class ReportTO extends AbstractBaseBean {
this.latestExecStatus = latestExecStatus;
}
+ @SuppressWarnings("CPD-START")
public Date getLastExec() {
return lastExec == null
? null
@@ -125,27 +121,4 @@ public class ReportTO extends AbstractBaseBean {
}
}
- public Date getStartDate() {
- return startDate == null
- ? null
- : new Date(startDate.getTime());
- }
-
- public void setStartDate(final Date startDate) {
- if (startDate != null) {
- this.startDate = new Date(startDate.getTime());
- }
- }
-
- public Date getEndDate() {
- return endDate == null
- ? null
- : new Date(endDate.getTime());
- }
-
- public void setEndDate(final Date endDate) {
- if (endDate != null) {
- this.endDate = new Date(endDate.getTime());
- }
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
index 98f33d2..43f5ff0 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
@@ -54,7 +54,7 @@ public class ResourceTO extends AbstractAnnotatedBean {
private MappingTO umapping;
- private MappingTO rmapping;
+ private MappingTO gmapping;
private boolean propagationPrimary;
@@ -80,18 +80,17 @@ public class ResourceTO extends AbstractAnnotatedBean {
private Long syncPolicy;
- private Set<ConnConfProperty> connConfProperties;
+ private final Set<ConnConfProperty> connConfProperties = new HashSet<>();
private String usyncToken;
private String rsyncToken;
- private List<String> propagationActionsClassNames = new ArrayList<>();
+ private final List<String> propagationActionsClassNames = new ArrayList<>();
public ResourceTO() {
super();
- connConfProperties = new HashSet<>();
propagationMode = PropagationMode.TWO_PHASES;
propagationPriority = 0;
@@ -141,12 +140,12 @@ public class ResourceTO extends AbstractAnnotatedBean {
this.umapping = umapping;
}
- public MappingTO getRmapping() {
- return rmapping;
+ public MappingTO getGmapping() {
+ return gmapping;
}
- public void setRmapping(final MappingTO rmapping) {
- this.rmapping = rmapping;
+ public void setGmapping(final MappingTO gmapping) {
+ this.gmapping = gmapping;
}
public boolean isPropagationPrimary() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
deleted file mode 100644
index 7f0f0af..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
+++ /dev/null
@@ -1,258 +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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "role")
-@XmlType
-@JsonIgnoreProperties({ "displayName" })
-public class RoleTO extends AbstractSubjectTO {
-
- private static final long serialVersionUID = -7785920258290147542L;
-
- private String name;
-
- private long parent;
-
- private Long userOwner;
-
- private Long roleOwner;
-
- private boolean inheritOwner;
-
- private boolean inheritTemplates;
-
- private boolean inheritPlainAttrs;
-
- private boolean inheritDerAttrs;
-
- private boolean inheritVirAttrs;
-
- private boolean inheritPasswordPolicy;
-
- private boolean inheritAccountPolicy;
-
- private final List<String> entitlements = new ArrayList<>();
-
- private List<String> rPlainAttrTemplates = new ArrayList<>();
-
- private List<String> rDerAttrTemplates = new ArrayList<>();
-
- private List<String> rVirAttrTemplates = new ArrayList<>();
-
- private List<String> mPlainAttrTemplates = new ArrayList<>();
-
- private List<String> mDerAttrTemplates = new ArrayList<>();
-
- private List<String> mVirAttrTemplates = new ArrayList<>();
-
- private Long passwordPolicy;
-
- private Long accountPolicy;
-
- public String getName() {
- return name;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
- public long getParent() {
- return parent;
- }
-
- public void setParent(final long parent) {
- this.parent = parent;
- }
-
- public Long getUserOwner() {
- return userOwner;
- }
-
- public void setUserOwner(final Long userOwner) {
- this.userOwner = userOwner;
- }
-
- public Long getRoleOwner() {
- return roleOwner;
- }
-
- public void setRoleOwner(final Long roleOwner) {
- this.roleOwner = roleOwner;
- }
-
- public boolean isInheritOwner() {
- return inheritOwner;
- }
-
- public void setInheritOwner(final boolean inheritOwner) {
- this.inheritOwner = inheritOwner;
- }
-
- public boolean isInheritTemplates() {
- return inheritTemplates;
- }
-
- public void setInheritTemplates(boolean inheritTemplates) {
- this.inheritTemplates = inheritTemplates;
- }
-
- public boolean isInheritPlainAttrs() {
- return inheritPlainAttrs;
- }
-
- public void setInheritPlainAttrs(final boolean inheritPlainAttrs) {
- this.inheritPlainAttrs = inheritPlainAttrs;
- }
-
- public boolean isInheritDerAttrs() {
- return inheritDerAttrs;
- }
-
- public void setInheritDerAttrs(final boolean inheritDerAttrs) {
- this.inheritDerAttrs = inheritDerAttrs;
- }
-
- public boolean isInheritVirAttrs() {
- return inheritVirAttrs;
- }
-
- public void setInheritVirAttrs(final boolean inheritVirAttrs) {
- this.inheritVirAttrs = inheritVirAttrs;
- }
-
- @XmlElementWrapper(name = "entitlements")
- @XmlElement(name = "entitlement")
- @JsonProperty("entitlements")
- public List<String> getEntitlements() {
- return entitlements;
- }
-
- @XmlElementWrapper(name = "rPlainAttrTemplates")
- @XmlElement(name = "rPlainAttrTemplate")
- @JsonProperty("rPlainAttrTemplates")
- public List<String> getRPlainAttrTemplates() {
- return rPlainAttrTemplates;
- }
-
- @XmlElementWrapper(name = "rDerAttrTemplates")
- @XmlElement(name = "rDerAttrTemplate")
- @JsonProperty("rDerAttrTemplates")
- public List<String> getRDerAttrTemplates() {
- return rDerAttrTemplates;
- }
-
- @XmlElementWrapper(name = "rVirAttrTemplates")
- @XmlElement(name = "rVirAttrTemplate")
- @JsonProperty("rVirAttrTemplates")
- public List<String> getRVirAttrTemplates() {
- return rVirAttrTemplates;
- }
-
- @XmlElementWrapper(name = "mPlainAttrTemplates")
- @XmlElement(name = "mPlainAttrTemplate")
- @JsonProperty("mPlainAttrTemplates")
- public List<String> getMPlainAttrTemplates() {
- return mPlainAttrTemplates;
- }
-
- @XmlElementWrapper(name = "mDerAttrTemplates")
- @XmlElement(name = "mDerAttrTemplate")
- @JsonProperty("mDerAttrTemplates")
- public List<String> getMDerAttrTemplates() {
- return mDerAttrTemplates;
- }
-
- @XmlElementWrapper(name = "mVirAttrTemplates")
- @XmlElement(name = "mVirAttrTemplate")
- @JsonProperty("mVirAttrTemplates")
- public List<String> getMVirAttrTemplates() {
- return mVirAttrTemplates;
- }
-
- public Long getPasswordPolicy() {
- return passwordPolicy;
- }
-
- public void setPasswordPolicy(final Long passwordPolicy) {
- this.passwordPolicy = passwordPolicy;
- }
-
- public boolean isInheritPasswordPolicy() {
- return inheritPasswordPolicy;
- }
-
- /**
- * Specify if password policy must be inherited. In this case eventual passwordPolicy occurrence will be ignored.
- *
- * @param inheritPasswordPolicy 'true' to inherit policy, false otherwise.
- */
- public void setInheritPasswordPolicy(final boolean inheritPasswordPolicy) {
- this.inheritPasswordPolicy = inheritPasswordPolicy;
- }
-
- public Long getAccountPolicy() {
- return accountPolicy;
- }
-
- public void setAccountPolicy(final Long accountPolicy) {
- this.accountPolicy = accountPolicy;
- }
-
- public boolean isInheritAccountPolicy() {
- return inheritAccountPolicy;
- }
-
- /**
- * Specify if account policy must be inherited. In this case eventual accountPolicy occurrence will be ignored.
- *
- * @param inheritAccountPolicy 'true' to inherit policy, false otherwise.
- */
- public void setInheritAccountPolicy(final boolean inheritAccountPolicy) {
- this.inheritAccountPolicy = inheritAccountPolicy;
- }
-
- public String getDisplayName() {
- return getKey() + " " + getName();
- }
-
- public static long fromDisplayName(final String displayName) {
- long result = 0;
- if (displayName != null && !displayName.isEmpty() && displayName.indexOf(' ') != -1) {
- try {
- result = Long.valueOf(displayName.split(" ")[0]);
- } catch (NumberFormatException e) {
- // just to avoid PMD warning about "empty catch block"
- result = 0;
- }
- }
-
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchedTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchedTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchedTaskTO.java
index 330a12d..abea52d 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchedTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchedTaskTO.java
@@ -59,6 +59,7 @@ public class SchedTaskTO extends AbstractTaskTO {
this.jobClassName = jobClassName;
}
+ @SuppressWarnings("CPD-START")
public Date getLastExec() {
return lastExec == null
? null
@@ -83,6 +84,8 @@ public class SchedTaskTO extends AbstractTaskTO {
}
}
+ @SuppressWarnings("CPD-END")
+
public String getDescription() {
return description;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
index 9e33e96..175926a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
@@ -29,7 +29,7 @@ public class SyncTaskTO extends AbstractProvisioningTaskTO {
private UserTO userTemplate;
- private RoleTO roleTemplate;
+ private GroupTO groupTemplate;
private boolean fullReconciliation;
@@ -41,19 +41,19 @@ public class SyncTaskTO extends AbstractProvisioningTaskTO {
this.userTemplate = userTemplate;
}
- public RoleTO getRoleTemplate() {
- return roleTemplate;
+ public GroupTO getGroupTemplate() {
+ return groupTemplate;
}
- public void setRoleTemplate(final RoleTO roleTemplate) {
- this.roleTemplate = roleTemplate;
+ public void setGroupTemplate(final GroupTO groupTemplate) {
+ this.groupTemplate = groupTemplate;
}
public boolean isFullReconciliation() {
return fullReconciliation;
}
- public void setFullReconciliation(boolean fullReconciliation) {
+ public void setFullReconciliation(final boolean fullReconciliation) {
this.fullReconciliation = fullReconciliation;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
index b7d767b..e4af2bb 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
@@ -47,11 +47,11 @@ public class SyncopeTO extends AbstractBaseBean {
private String userWorkflowAdapter;
- private String roleWorkflowAdapter;
+ private String groupWorkflowAdapter;
private String userProvisioningManager;
- private String roleProvisioningManager;
+ private String groupProvisioningManager;
private final List<String> reportlets = new ArrayList<>();
@@ -102,16 +102,16 @@ public class SyncopeTO extends AbstractBaseBean {
return userWorkflowAdapter;
}
- public String getRoleWorkflowAdapter() {
- return roleWorkflowAdapter;
+ public String getGroupWorkflowAdapter() {
+ return groupWorkflowAdapter;
}
public String getUserProvisioningManager() {
return userProvisioningManager;
}
- public String getRoleProvisioningManager() {
- return roleProvisioningManager;
+ public String getGroupProvisioningManager() {
+ return groupProvisioningManager;
}
@XmlElementWrapper(name = "reportlets")
@@ -201,16 +201,16 @@ public class SyncopeTO extends AbstractBaseBean {
this.userWorkflowAdapter = userWorkflowAdapter;
}
- public void setRoleWorkflowAdapter(final String roleWorkflowAdapter) {
- this.roleWorkflowAdapter = roleWorkflowAdapter;
+ public void setGroupWorkflowAdapter(final String groupWorkflowAdapter) {
+ this.groupWorkflowAdapter = groupWorkflowAdapter;
}
public void setUserProvisioningManager(final String userProvisioningManager) {
this.userProvisioningManager = userProvisioningManager;
}
- public void setRoleProvisioningManager(final String roleProvisioningManager) {
- this.roleProvisioningManager = roleProvisioningManager;
+ public void setGroupProvisioningManager(final String groupProvisioningManager) {
+ this.groupProvisioningManager = groupProvisioningManager;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
index aceefe1..786bfc9 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
@@ -86,7 +86,7 @@ public class UserTO extends AbstractSubjectTO {
} else {
result = new HashMap<>(getMemberships().size());
for (MembershipTO membership : getMemberships()) {
- result.put(membership.getRoleId(), membership);
+ result.put(membership.getGroupId(), membership);
}
result = Collections.unmodifiableMap(result);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
index 90dc7c2..0eed28e 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
@@ -58,7 +58,7 @@ public class WorkflowFormTO extends AbstractBaseBean {
return userKey;
}
- public void setUserKey(long userKey) {
+ public void setUserKey(final long userKey) {
this.userKey = userKey;
}
[36/57] syncope git commit: [SYNCOPE-119] (re)Introducing Roles
Posted by il...@apache.org.
[SYNCOPE-119] (re)Introducing Roles
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/18958ba2
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/18958ba2
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/18958ba2
Branch: refs/heads/master
Commit: 18958ba234672741adba9b9fa42a503166b9692a
Parents: 423e4cc
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Apr 10 15:11:19 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Apr 10 15:11:19 2015 +0200
----------------------------------------------------------------------
.../apache/syncope/common/lib/to/RoleTO.java | 87 +++++++++++++
.../syncope/common/lib/types/Entitlement.java | 103 +++++++++++++++
.../common/rest/api/service/RoleService.java | 97 ++++++++++++++
.../syncope/core/logic/NotificationLogic.java | 20 +--
.../apache/syncope/core/logic/RoleLogic.java | 129 +++++++++++++++++++
.../core/misc/search/SearchCondConverter.java | 6 +-
.../core/persistence/api/dao/RoleDAO.java | 40 ++++++
.../core/persistence/api/entity/Role.java | 43 +++++++
.../core/persistence/jpa/dao/JPARealmDAO.java | 11 ++
.../core/persistence/jpa/dao/JPARoleDAO.java | 89 +++++++++++++
.../persistence/jpa/entity/JPAConnInstance.java | 2 +-
.../jpa/entity/JPAEntityFactory.java | 3 +
.../jpa/entity/JPAExternalResource.java | 2 +-
.../persistence/jpa/entity/JPANotification.java | 2 +-
.../core/persistence/jpa/entity/JPARole.java | 125 ++++++++++++++++++
.../resources/META-INF/spring-orm-oracle.xml | 9 ++
.../resources/META-INF/spring-orm-sqlserver.xml | 9 ++
.../src/main/resources/META-INF/spring-orm.xml | 9 ++
.../src/main/resources/content.xml | 9 +-
.../persistence/jpa/entity/EntitlementTest.java | 2 +-
.../core/persistence/jpa/entity/RoleTest.java | 109 ++++++++++++++++
.../persistence/jpa/relationship/RealmTest.java | 60 +++++++++
.../src/test/resources/content.xml | 126 ++++++++++--------
.../provisioning/api/data/RoleDataBinder.java | 31 +++++
.../java/data/RoleDataBinderImpl.java | 96 ++++++++++++++
.../core/rest/cxf/service/RoleServiceImpl.java | 67 ++++++++++
.../fit/core/reference/AbstractITCase.java | 4 +
.../syncope/fit/core/reference/RoleITCase.java | 124 ++++++++++++++++++
28 files changed, 1344 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
new file mode 100644
index 0000000..f7e46de
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
@@ -0,0 +1,87 @@
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.apache.syncope.common.lib.types.Entitlement;
+
+@XmlRootElement(name = "role")
+@XmlType
+public class RoleTO extends AbstractBaseBean {
+
+ private static final long serialVersionUID = 4560822655754800031L;
+
+ private long key;
+
+ private String name;
+
+ private String criteria;
+
+ private final Set<Entitlement> entitlements = EnumSet.noneOf(Entitlement.class);
+
+ private final List<String> realms = new ArrayList<>();
+
+ public long getKey() {
+ return key;
+ }
+
+ public void setKey(final long key) {
+ this.key = key;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getCriteria() {
+ return criteria;
+ }
+
+ public void setCriteria(final String criteria) {
+ this.criteria = criteria;
+ }
+
+ @XmlElementWrapper(name = "entitlements")
+ @XmlElement(name = "entitlement")
+ @JsonProperty("entitlements")
+ public Set<Entitlement> getEntitlements() {
+ return entitlements;
+ }
+
+ @XmlElementWrapper(name = "realms")
+ @XmlElement(name = "realm")
+ @JsonProperty("realms")
+ public List<String> getRealms() {
+ return realms;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
new file mode 100644
index 0000000..8e40551
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
@@ -0,0 +1,103 @@
+/*
+ * 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.types;
+
+public enum Entitlement {
+
+ REALM_LIST,
+ REALM_CREATE,
+ REALM_UPDATE,
+ REALM_DELETE,
+ ROLE_LIST,
+ ROLE_CREATE,
+ ROLE_READ,
+ ROLE_UPDATE,
+ ROLE_DELETE,
+ SCHEMA_LIST,
+ SCHEMA_CREATE,
+ SCHEMA_READ,
+ SCHEMA_UPDATE,
+ SCHEMA_DELETE,
+ USER_LIST,
+ USER_CREATE,
+ USER_READ,
+ USER_UPDATE,
+ USER_DELETE,
+ USER_VIEW,
+ GROUP_LIST,
+ GROUP_CREATE,
+ GROUP_READ,
+ GROUP_UPDATE,
+ GROUP_DELETE,
+ RESOURCE_LIST,
+ RESOURCE_CREATE,
+ RESOURCE_READ,
+ RESOURCE_UPDATE,
+ RESOURCE_DELETE,
+ RESOURCE_GETCONNECTOROBJECT,
+ CONNECTOR_LIST,
+ CONNECTOR_CREATE,
+ CONNECTOR_READ,
+ CONNECTOR_UPDATE,
+ CONNECTOR_DELETE,
+ CONNECTOR_RELOAD,
+ CONFIGURATION_EXPORT,
+ CONFIGURATION_LIST,
+ CONFIGURATION_SET,
+ CONFIGURATION_DELETE,
+ TASK_LIST,
+ TASK_CREATE,
+ TASK_READ,
+ TASK_UPDATE,
+ TASK_DELETE,
+ TASK_EXECUTE,
+ POLICY_LIST,
+ POLICY_CREATE,
+ POLICY_READ,
+ POLICY_UPDATE,
+ POLICY_DELETE,
+ WORKFLOW_DEF_READ,
+ WORKFLOW_DEF_UPDATE,
+ WORKFLOW_TASK_LIST,
+ WORKFLOW_FORM_LIST,
+ WORKFLOW_FORM_READ,
+ WORKFLOW_FORM_CLAIM,
+ WORKFLOW_FORM_SUBMIT,
+ NOTIFICATION_LIST,
+ NOTIFICATION_CREATE,
+ NOTIFICATION_READ,
+ NOTIFICATION_UPDATE,
+ NOTIFICATION_DELETE,
+ REPORT_LIST,
+ REPORT_READ,
+ REPORT_CREATE,
+ REPORT_UPDATE,
+ REPORT_DELETE,
+ REPORT_EXECUTE,
+ LOG_LIST,
+ LOG_SET_LEVEL,
+ LOG_DELETE,
+ AUDIT_LIST,
+ AUDIT_ENABLE,
+ AUDIT_DISABLE,
+ SECURITY_QUESTION_CREATE,
+ SECURITY_QUESTION_UPDATE,
+ SECURITY_QUESTION_DELETE;
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
new file mode 100644
index 0000000..172af5f
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
@@ -0,0 +1,97 @@
+/*
+ * 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 java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.model.wadl.Description;
+import org.apache.cxf.jaxrs.model.wadl.Descriptions;
+import org.apache.cxf.jaxrs.model.wadl.DocTarget;
+import org.apache.syncope.common.lib.to.RoleTO;
+
+/**
+ * REST operations for roles.
+ */
+@Path("roles")
+public interface RoleService extends JAXRSService {
+
+ /**
+ * Returns a list of all roles.
+ *
+ * @return list of all roles.
+ */
+ @GET
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ List<RoleTO> list();
+
+ /**
+ * Returns role with matching id.
+ *
+ * @param roleKey role id to be read
+ * @return role with matching id
+ */
+ @GET
+ @Path("{roleKey}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ RoleTO read(@NotNull @PathParam("roleKey") Long roleKey);
+
+ /**
+ * Creates a new role.
+ *
+ * @param roleTO role to be created
+ * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created role
+ */
+ @Descriptions({
+ @Description(target = DocTarget.RESPONSE,
+ value = "Featuring <tt>Location</tt> header of created role")
+ })
+ @POST
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ Response create(@NotNull RoleTO roleTO);
+
+ /**
+ * Updates the role matching the provided id.
+ *
+ * @param roleKey role id to be updated
+ * @param roleTO role to be stored
+ */
+ @PUT
+ @Path("{roleKey}")
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ void update(@NotNull @PathParam("roleKey") Long roleKey, @NotNull RoleTO roleTO);
+
+ /**
+ * Deletes the role matching the provided id.
+ *
+ * @param roleKey role id to be deleted
+ */
+ @DELETE
+ @Path("{roleKey}")
+ void delete(@NotNull @PathParam("roleKey") Long roleKey);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/logic/src/main/java/org/apache/syncope/core/logic/NotificationLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/NotificationLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/NotificationLogic.java
index 8b8c387..c7ad949 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/NotificationLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/NotificationLogic.java
@@ -43,12 +43,12 @@ public class NotificationLogic extends AbstractTransactionalLogic<NotificationTO
private NotificationDataBinder binder;
@PreAuthorize("hasRole('NOTIFICATION_READ')")
- public NotificationTO read(final Long notificationId) {
- Notification notification = notificationDAO.find(notificationId);
+ public NotificationTO read(final Long notificationKey) {
+ Notification notification = notificationDAO.find(notificationKey);
if (notification == null) {
- LOG.error("Could not find notification '" + notificationId + "'");
+ LOG.error("Could not find notification '" + notificationKey + "'");
- throw new NotFoundException(String.valueOf(notificationId));
+ throw new NotFoundException(String.valueOf(notificationKey));
}
return binder.getNotificationTO(notification);
@@ -84,17 +84,17 @@ public class NotificationLogic extends AbstractTransactionalLogic<NotificationTO
return binder.getNotificationTO(notification);
}
- @PreAuthorize("hasRole('CONNECTOR_DELETE')")
- public NotificationTO delete(final Long notificationId) {
- Notification notification = notificationDAO.find(notificationId);
+ @PreAuthorize("hasRole('NOTIFICATION_DELETE')")
+ public NotificationTO delete(final Long notificationKey) {
+ Notification notification = notificationDAO.find(notificationKey);
if (notification == null) {
- LOG.error("Could not find notification '" + notificationId + "'");
+ LOG.error("Could not find notification '" + notificationKey + "'");
- throw new NotFoundException(String.valueOf(notificationId));
+ throw new NotFoundException(String.valueOf(notificationKey));
}
NotificationTO deleted = binder.getNotificationTO(notification);
- notificationDAO.delete(notificationId);
+ notificationDAO.delete(notificationKey);
return deleted;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java
new file mode 100644
index 0000000..668d263
--- /dev/null
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java
@@ -0,0 +1,129 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.provisioning.api.data.RoleDataBinder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RoleLogic extends AbstractTransactionalLogic<RoleTO> {
+
+ @Autowired
+ private RoleDataBinder binder;
+
+ @Autowired
+ private RoleDAO roleDAO;
+
+ @PreAuthorize("hasRole('ROLE_READ')")
+ public RoleTO read(final Long roleKey) {
+ Role role = roleDAO.find(roleKey);
+ if (role == null) {
+ LOG.error("Could not find role '" + roleKey + "'");
+
+ throw new NotFoundException(String.valueOf(roleKey));
+ }
+
+ return binder.getRoleTO(role);
+ }
+
+ @PreAuthorize("hasRole('ROLE_LIST')")
+ public List<RoleTO> list() {
+ return CollectionUtils.collect(roleDAO.findAll(), new Transformer<Role, RoleTO>() {
+
+ @Override
+ public RoleTO transform(final Role input) {
+ return binder.getRoleTO(input);
+ }
+ }, new ArrayList<RoleTO>());
+ }
+
+ @PreAuthorize("hasRole('ROLE_CREATE')")
+ public RoleTO create(final RoleTO roleTO) {
+ return binder.getRoleTO(roleDAO.save(binder.create(roleTO)));
+ }
+
+ @PreAuthorize("hasRole('ROLE_UPDATE')")
+ public RoleTO update(final RoleTO roleTO) {
+ Role role = roleDAO.find(roleTO.getKey());
+ if (role == null) {
+ LOG.error("Could not find role '" + roleTO.getKey() + "'");
+ throw new NotFoundException(String.valueOf(roleTO.getKey()));
+ }
+
+ binder.update(role, roleTO);
+ role = roleDAO.save(role);
+
+ return binder.getRoleTO(role);
+ }
+
+ @PreAuthorize("hasRole('ROLE_DELETE')")
+ public RoleTO delete(final Long roleKey) {
+ Role role = roleDAO.find(roleKey);
+ if (role == null) {
+ LOG.error("Could not find role '" + roleKey + "'");
+
+ throw new NotFoundException(String.valueOf(roleKey));
+ }
+
+ RoleTO deleted = binder.getRoleTO(role);
+ roleDAO.delete(roleKey);
+ return deleted;
+ }
+
+ @Override
+ protected RoleTO resolveReference(final Method method, final Object... args)
+ throws UnresolvedReferenceException {
+
+ Long key = null;
+
+ if (ArrayUtils.isNotEmpty(args)) {
+ for (int i = 0; key == null && i < args.length; i++) {
+ if (args[i] instanceof Long) {
+ key = (Long) args[i];
+ } else if (args[i] instanceof RoleTO) {
+ key = ((RoleTO) args[i]).getKey();
+ }
+ }
+ }
+
+ if ((key != null) && !key.equals(0L)) {
+ try {
+ return binder.getRoleTO(roleDAO.find(key));
+ } catch (Throwable ignore) {
+ LOG.debug("Unresolved reference", ignore);
+ throw new UnresolvedReferenceException(ignore);
+ }
+ }
+
+ throw new UnresolvedReferenceException();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
index e6756ad..684592c 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
@@ -24,7 +24,7 @@ import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
/**
- * Converts FIQL expressions to Syncope's <tt>SearchCond</tt>.
+ * Converts FIQL expressions to Syncope's {@link SearchCond}.
*/
public final class SearchCondConverter {
@@ -36,10 +36,10 @@ public final class SearchCondConverter {
* @see FiqlParser
*/
public static SearchCond convert(final String fiqlExpression) {
- FiqlParser<SearchBean> fiqlParser = new FiqlParser<SearchBean>(
+ FiqlParser<SearchBean> fiqlParser = new FiqlParser<>(
SearchBean.class, AbstractFiqlSearchConditionBuilder.CONTEXTUAL_PROPERTIES);
- SearchCondVisitor searchCondVisitor = new SearchCondVisitor();
+ SearchCondVisitor searchCondVisitor = new SearchCondVisitor();
searchCondVisitor.visit(fiqlParser.parse(fiqlExpression));
return searchCondVisitor.getQuery();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..76723b0
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java
@@ -0,0 +1,40 @@
+/*
+ * 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 java.util.List;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.Role;
+
+public interface RoleDAO extends DAO<Role, Long> {
+
+ Role find(Long key);
+
+ Role find(String name);
+
+ List<Role> findByRealm(Realm realm);
+
+ List<Role> findAll();
+
+ Role save(Role role);
+
+ void delete(Role role);
+
+ void delete(Long key);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Role.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..7753ee2
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Role.java
@@ -0,0 +1,43 @@
+/*
+ * 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.Set;
+import org.apache.syncope.common.lib.types.Entitlement;
+
+public interface Role extends Entity<Long> {
+
+ String getName();
+
+ void setName(String name);
+
+ String getCriteria();
+
+ void setCriteria(String criteria);
+
+ Set<Entitlement> getEntitlements();
+
+ boolean addRealm(Realm realm);
+
+ boolean removeReam(Realm realm);
+
+ List<? extends Realm> getRealms();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
index 896277c..0921d8c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
@@ -27,8 +27,11 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.syncope.core.persistence.api.dao.MalformedPathException;
import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.dao.RoleDAO;
import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.Role;
import org.apache.syncope.core.persistence.jpa.entity.JPARealm;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
@@ -36,6 +39,9 @@ public class JPARealmDAO extends AbstractDAO<Realm, Long> implements RealmDAO {
private static final Pattern PATH_PATTERN = Pattern.compile("^(/[A-Za-z0-9]+)+");
+ @Autowired
+ private RoleDAO roleDAO;
+
@Override
public Realm getRoot() {
TypedQuery<Realm> query = entityManager.createQuery(
@@ -128,7 +134,12 @@ public class JPARealmDAO extends AbstractDAO<Realm, Long> implements RealmDAO {
@Override
public void delete(final Realm realm) {
for (Realm toBeDeleted : findDescendants(realm)) {
+ for (Role role : roleDAO.findByRealm(toBeDeleted)) {
+ role.getRealms().remove(toBeDeleted);
+ }
+
toBeDeleted.setParent(null);
+
entityManager.remove(toBeDeleted);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
new file mode 100644
index 0000000..f240850
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
@@ -0,0 +1,89 @@
+/*
+ * 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;
+
+import java.util.List;
+import javax.persistence.NoResultException;
+import javax.persistence.TypedQuery;
+import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.persistence.jpa.entity.JPARole;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class JPARoleDAO extends AbstractDAO<Role, Long> implements RoleDAO {
+
+ @Override
+ public Role find(final Long key) {
+ return entityManager.find(JPARole.class, key);
+ }
+
+ @Override
+ public Role find(final String name) {
+ TypedQuery<Role> query = entityManager.createQuery(
+ "SELECT e FROM " + JPARole.class.getSimpleName() + " e WHERE e.name=:name", Role.class);
+ query.setParameter("name", name);
+
+ Role result = null;
+ try {
+ result = query.getSingleResult();
+ } catch (NoResultException e) {
+ LOG.debug("Found more than one match", e);
+ }
+
+ return result;
+ }
+
+ @Override
+ public List<Role> findByRealm(final Realm realm) {
+ TypedQuery<Role> query = entityManager.createQuery(
+ "SELECT e FROM " + JPARole.class.getSimpleName() + " e WHERE :realm MEMBER OF e.realms", Role.class);
+ query.setParameter("realm", realm);
+ return query.getResultList();
+ }
+
+ @Override
+ public List<Role> findAll() {
+ TypedQuery<Role> query = entityManager.createQuery(
+ "SELECT e FROM " + JPARole.class.getSimpleName() + " e ", Role.class);
+ return query.getResultList();
+ }
+
+ @Override
+ public Role save(final Role role) {
+ return entityManager.merge(role);
+ }
+
+ @Override
+ public void delete(final Role role) {
+ entityManager.remove(role);
+ }
+
+ @Override
+ public void delete(final Long key) {
+ Role role = find(key);
+ if (role == null) {
+ return;
+ }
+
+ delete(role);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
index 6abedd5..746bf48 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
@@ -94,7 +94,7 @@ public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstanc
*/
@ElementCollection(fetch = FetchType.EAGER)
@Enumerated(EnumType.STRING)
- @Column(name = "capabilities")
+ @Column(name = "capability")
@CollectionTable(name = "ConnInstance_capabilities",
joinColumns =
@JoinColumn(name = "ConnInstance_id", referencedColumnName = "id"))
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
index a4cadf4..4d83b7c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -34,6 +34,7 @@ import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.Report;
import org.apache.syncope.core.persistence.api.entity.ReportExec;
import org.apache.syncope.core.persistence.api.entity.ReportletConfInstance;
+import org.apache.syncope.core.persistence.api.entity.Role;
import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrUniqueValue;
@@ -144,6 +145,8 @@ public class JPAEntityFactory implements EntityFactory {
if (reference.equals(Realm.class)) {
result = (T) new JPARealm();
+ } else if (reference.equals(Role.class)) {
+ result = (T) new JPARole();
} else if (reference.equals(User.class)) {
result = (T) new JPAUser();
} else if (reference.equals(Group.class)) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
index 908422b..2f28485 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
@@ -179,7 +179,7 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
* (Optional) classes for PropagationAction.
*/
@ElementCollection(fetch = FetchType.EAGER)
- @Column(name = "action")
+ @Column(name = "actionClassName")
@CollectionTable(name = "ExternalResource_PropActions",
joinColumns =
@JoinColumn(name = "ExternalResource_name", referencedColumnName = "name"))
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
index d2acd58..498032e 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
@@ -53,10 +53,10 @@ public class JPANotification extends AbstractEntity<Long> implements Notificatio
private Long id;
@ElementCollection(fetch = FetchType.EAGER)
+ @Column(name = "event")
@CollectionTable(name = "Notification_events",
joinColumns =
@JoinColumn(name = "Notification_id", referencedColumnName = "id"))
- @Column(name = "events")
private List<String> events;
private String userAbout;
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARole.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..3d7ac29
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARole.java
@@ -0,0 +1,125 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.persistence.Cacheable;
+import javax.persistence.CollectionTable;
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import org.apache.syncope.common.lib.types.Entitlement;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.Role;
+
+@Entity
+@Table(name = JPARole.TABLE)
+@Cacheable
+public class JPARole extends AbstractEntity<Long> implements Role {
+
+ private static final long serialVersionUID = -7657701119422588832L;
+
+ public static final String TABLE = "SyncopeRole";
+
+ @Id
+ private Long id;
+
+ @Column(unique = true)
+ @NotNull
+ private String name;
+
+ @ElementCollection(fetch = FetchType.EAGER)
+ @Enumerated(EnumType.STRING)
+ @Column(name = "entitlement")
+ @CollectionTable(name = "SyncopeRole_entitlements",
+ joinColumns =
+ @JoinColumn(name = "role_id", referencedColumnName = "id"))
+ private Set<Entitlement> entitlements = new HashSet<>();
+
+ @ManyToMany(fetch = FetchType.EAGER)
+ @JoinTable(joinColumns =
+ @JoinColumn(name = "role_id"),
+ inverseJoinColumns =
+ @JoinColumn(name = "realm_id"))
+ @Valid
+ private List<JPARealm> realms = new ArrayList<>();
+
+ private String criteria;
+
+ @Override
+ public Long getKey() {
+ return id;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getCriteria() {
+ return criteria;
+ }
+
+ @Override
+ public void setCriteria(final String criteria) {
+ this.criteria = criteria;
+ }
+
+ @Override
+ public Set<Entitlement> getEntitlements() {
+ return entitlements;
+ }
+
+ @Override
+ public boolean addRealm(final Realm realm) {
+ checkType(realm, JPARealm.class);
+ return realms.add((JPARealm) realm);
+ }
+
+ @Override
+ public boolean removeReam(final Realm realm) {
+ checkType(realm, JPARealm.class);
+ return realms.remove((JPARealm) realm);
+ }
+
+ @Override
+ public List<? extends Realm> getRealms() {
+ return realms;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
index ea3a058..3a61895 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
@@ -48,6 +48,15 @@ under the License.
</attributes>
</entity>
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.JPARole">
+ <attributes>
+ <id name="id">
+ <generated-value generator="SEQ_Role" strategy="TABLE"/>
+ <table-generator name="SEQ_Role" pk-column-value="SEQ_Role" initial-value="100"/>
+ </id>
+ </attributes>
+ </entity>
+
<entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUser">
<attributes>
<id name="id">
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
index ea3a058..97af974 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
@@ -48,6 +48,15 @@ under the License.
</attributes>
</entity>
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.JPARole">
+ <attributes>
+ <id name="id">
+ <generated-value generator="SEQ_Role" strategy="TABLE"/>
+ <table-generator name="SEQ_Role" pk-column-value="SEQ_Role" initial-value="100"/>
+ </id>
+ </attributes>
+ </entity>
+
<entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUser">
<attributes>
<id name="id">
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
index e26f6d0..5921b94 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
@@ -48,6 +48,15 @@ under the License.
</attributes>
</entity>
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.JPARole">
+ <attributes>
+ <id name="id">
+ <generated-value generator="SEQ_Role" strategy="TABLE"/>
+ <table-generator name="SEQ_Role" pk-column-value="SEQ_Role" initial-value="100"/>
+ </id>
+ </attributes>
+ </entity>
+
<entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUser">
<attributes>
<id name="id">
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/main/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/content.xml b/core/persistence-jpa/src/main/resources/content.xml
index e060c62..6b6c287 100644
--- a/core/persistence-jpa/src/main/resources/content.xml
+++ b/core/persistence-jpa/src/main/resources/content.xml
@@ -103,18 +103,23 @@ under the License.
<Notification id="1" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1"
sender="admin@syncope.apache.org" subject="Password Reset request" template="requestPasswordReset"
traceLevel="FAILURES" userAbout="token!=$null"/>
- <Notification_events Notification_id="1" events="[CUSTOM]:[]:[]:[requestPasswordReset]:[SUCCESS]"/>
+ <Notification_events Notification_id="1" event="[CUSTOM]:[]:[]:[requestPasswordReset]:[SUCCESS]"/>
<Notification id="2" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1"
sender="admin@syncope.apache.org" subject="Password Reset successful" template="confirmPasswordReset"
traceLevel="FAILURES" userAbout="token!=$null"/>
- <Notification_events Notification_id="2" events="[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"/>
+ <Notification_events Notification_id="2" event="[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"/>
<!-- Authentication and authorization -->
<Entitlement name="REALM_LIST"/>
<Entitlement name="REALM_CREATE"/>
<Entitlement name="REALM_UPDATE"/>
<Entitlement name="REALM_DELETE"/>
+ <Entitlement name="ROLE_LIST"/>
+ <Entitlement name="ROLE_CREATE"/>
+ <Entitlement name="ROLE_READ"/>
+ <Entitlement name="ROLE_UPDATE"/>
+ <Entitlement name="ROLE_DELETE"/>
<Entitlement name="SCHEMA_LIST"/>
<Entitlement name="SCHEMA_CREATE"/>
<Entitlement name="SCHEMA_READ"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
index ccea7da..82fa875 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
@@ -39,7 +39,7 @@ public class EntitlementTest extends AbstractTest {
@Test
public void findAll() {
List<Entitlement> list = entitlementDAO.findAll();
- assertEquals("did not get expected number of entitlements ", 90, list.size());
+ assertEquals("did not get expected number of entitlements ", 95, list.size());
}
@Test
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java
new file mode 100644
index 0000000..b4830cf
--- /dev/null
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.types.Entitlement;
+import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.core.misc.search.SearchCondConverter;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
+import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
+import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
+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.jpa.AbstractTest;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class RoleTest extends AbstractTest {
+
+ @Autowired
+ private RoleDAO roleDAO;
+
+ @Autowired
+ private EntitlementDAO entitlementDAO;
+
+ @Autowired
+ private SubjectSearchDAO searchDAO;
+
+ @Autowired
+ private RealmDAO realmDAO;
+
+ @Test
+ public void find() {
+ Role role1 = roleDAO.find(2L);
+ assertNotNull(role1);
+ assertNotNull(role1.getName());
+ assertFalse(searchDAO.<User>search(
+ GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ SearchCondConverter.convert(role1.getCriteria()),
+ Collections.<OrderByClause>emptyList(), SubjectType.USER).isEmpty());
+ assertFalse(role1.getRealms().isEmpty());
+ assertFalse(role1.getEntitlements().isEmpty());
+ assertTrue(role1.getEntitlements().contains(Entitlement.USER_LIST));
+
+ Role role2 = roleDAO.find(role1.getName());
+ assertEquals(role1, role2);
+ }
+
+ @Test
+ public void findAll() {
+ List<Role> list = roleDAO.findAll();
+ assertNotNull(list);
+ assertFalse(list.isEmpty());
+ for (Role role : list) {
+ assertNotNull(role);
+ }
+ }
+
+ @Test
+ public void save() {
+ Role role = entityFactory.newEntity(Role.class);
+ role.setName("new");
+ role.setCriteria(new UserFiqlSearchConditionBuilder().inGroups(2L).query());
+ role.addRealm(realmDAO.getRoot());
+ role.addRealm(realmDAO.find("/even/two"));
+ role.getEntitlements().add(Entitlement.LOG_LIST);
+ role.getEntitlements().add(Entitlement.LOG_SET_LEVEL);
+
+ Role actual = roleDAO.save(role);
+ assertNotNull(actual);
+ }
+
+ @Test
+ public void delete() {
+ assertNotNull(roleDAO.find(3L));
+
+ roleDAO.delete(3L);
+ assertNull(roleDAO.find(3L));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/18958ba2/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/RealmTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/RealmTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/RealmTest.java
new file mode 100644
index 0000000..e652e62
--- /dev/null
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/RealmTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.relationship;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.persistence.jpa.AbstractTest;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class RealmTest extends AbstractTest {
+
+ @Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
+ private RoleDAO roleDAO;
+
+ @Test
+ public void test() {
+ Realm realm = realmDAO.find("/odd");
+ assertNotNull(realm);
+
+ Role role = roleDAO.find(1L);
+ assertTrue(role.getRealms().contains(realm));
+
+ int beforeSize = role.getRealms().size();
+
+ realmDAO.delete(realm);
+
+ realmDAO.flush();
+
+ role = roleDAO.find(1L);
+ assertEquals(beforeSize - 1, role.getRealms().size());
+ }
+}
[39/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserSyncResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserSyncResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserSyncResultHandlerImpl.java
index 0f0d785..4a19ed7 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserSyncResultHandlerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserSyncResultHandlerImpl.java
@@ -27,7 +27,7 @@ import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
import org.apache.syncope.core.provisioning.api.sync.UserSyncResultHandler;
import org.identityconnectors.framework.common.objects.SyncDelta;
@@ -35,8 +35,8 @@ import org.identityconnectors.framework.common.objects.SyncDelta;
public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler implements UserSyncResultHandler {
@Override
- protected AttributableUtil getAttributableUtil() {
- return attrUtilFactory.getInstance(AttributableType.USER);
+ protected AttributableUtils getAttributableUtils() {
+ return attrUtilsFactory.getInstance(AttributableType.USER);
}
@Override
@@ -47,7 +47,7 @@ public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler impleme
@Override
protected AbstractSubjectTO getSubjectTO(final long key) {
try {
- return userTransfer.getUserTO(key);
+ return userDataBinder.getUserTO(key);
} catch (Exception e) {
LOG.warn("Error retrieving user {}", key, e);
return null;
@@ -58,12 +58,11 @@ public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler impleme
protected AbstractSubjectMod getSubjectMod(
final AbstractSubjectTO subjectTO, final SyncDelta delta) {
- return connObjectUtil.getAttributableMod(
- subjectTO.getKey(),
+ return connObjectUtils.getAttributableMod(subjectTO.getKey(),
delta.getObject(),
subjectTO,
profile.getTask(),
- getAttributableUtil());
+ getAttributableUtils());
}
@Override
@@ -76,11 +75,9 @@ public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler impleme
Map.Entry<Long, List<PropagationStatus>> created = userProvisioningManager.create(userTO, true, true, enabled,
Collections.singleton(profile.getTask().getResource().getKey()));
- userTO = userTransfer.getUserTO(created.getKey());
-
result.setId(created.getKey());
- return userTO;
+ return userDataBinder.getUserTO(created.getKey());
}
@Override
@@ -98,7 +95,7 @@ public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler impleme
userMod.getResourcesToAdd().add(profile.getTask().getResource().getKey());
}
- return userTransfer.getUserTO(uwfAdapter.update(userMod).getResult().getKey().getKey());
+ return userDataBinder.getUserTO(uwfAdapter.update(userMod).getResult().getKey().getKey());
}
@Override
@@ -114,7 +111,7 @@ public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler impleme
Map.Entry<Long, List<PropagationStatus>> updated = userProvisioningManager.update(userMod, before.getKey(),
result, enabled, Collections.singleton(profile.getTask().getResource().getKey()));
- return userTransfer.getUserTO(updated.getKey());
+ return userDataBinder.getUserTO(updated.getKey());
}
@Override
@@ -123,7 +120,8 @@ public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler impleme
final boolean unlink) {
taskExecutor.execute(
- propagationManager.getUserDeleteTaskIds(key, profile.getTask().getResource().getKey()));
+ propagationManager.getUserDeleteTasks(
+ key, Collections.singleton(profile.getTask().getResource().getKey())));
if (unlink) {
final UserMod userMod = new UserMod();
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/resources/provisioning.properties b/core/provisioning-java/src/main/resources/provisioning.properties
index 4b87d44..9c0abff 100644
--- a/core/provisioning-java/src/main/resources/provisioning.properties
+++ b/core/provisioning-java/src/main/resources/provisioning.properties
@@ -16,3 +16,4 @@
# under the License.
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
+virAttrCache=org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/resources/provisioningContext.xml
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/resources/provisioningContext.xml b/core/provisioning-java/src/main/resources/provisioningContext.xml
index f7d9d4e..9b50b7d 100644
--- a/core/provisioning-java/src/main/resources/provisioningContext.xml
+++ b/core/provisioning-java/src/main/resources/provisioningContext.xml
@@ -84,7 +84,7 @@ under the License.
<context:component-scan base-package="org.apache.syncope.core.misc"/>
<context:component-scan base-package="org.apache.syncope.core.provisioning.java"/>
- <bean id="virAttrCache" class="org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache" scope="singleton">
+ <bean id="virAttrCache" class="${virAttrCache}" scope="singleton">
<constructor-arg value="60"/>
<constructor-arg value="5000"/>
</bean>
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
index f2a41d5..ab71890 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
@@ -42,7 +42,7 @@ import org.apache.syncope.common.lib.to.ErrorTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
+import org.apache.syncope.core.misc.security.UnauthorizedException;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
import org.apache.syncope.core.persistence.api.dao.DuplicateException;
@@ -50,6 +50,7 @@ import org.apache.syncope.core.persistence.api.dao.MalformedPathException;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.workflow.api.WorkflowException;
import org.identityconnectors.framework.common.exceptions.ConfigurationException;
+import org.identityconnectors.framework.common.exceptions.ConnectorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataIntegrityViolationException;
@@ -89,12 +90,14 @@ public class RestServiceExceptionMapper implements ExceptionMapper<Exception>, R
} else if (ex instanceof AccessDeniedException) {
builder = Response.status(Response.Status.UNAUTHORIZED).
header(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM_UNAUTHORIZED);
- } else if (ex instanceof UnauthorizedGroupException) {
- builder = builder(ClientExceptionType.UnauthorizedGroup, getExMessage(ex));
+ } else if (ex instanceof UnauthorizedException) {
+ builder = builder(ClientExceptionType.Unauthorized, getExMessage(ex));
} else if (ex instanceof EntityExistsException || ex instanceof DuplicateException) {
builder = builder(ClientExceptionType.EntityExists, getExMessage(ex));
} else if (ex instanceof DataIntegrityViolationException) {
builder = builder(ClientExceptionType.DataIntegrityViolation, getExMessage(ex));
+ } else if (ex instanceof ConnectorException) {
+ builder = builder(ClientExceptionType.ConnectorException, getExMessage(ex));
} else {
builder = processNotFoundExceptions(ex);
if (builder == null) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
index f6fb69a..dc3a1ec 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
@@ -83,10 +83,8 @@ abstract class AbstractServiceImpl implements JAXRSService {
* @return response to successful <tt>create</tt> request
*/
protected Response createResponse(final Object id, final Object entity) {
- URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(id)).build();
-
Response.ResponseBuilder builder = Response.
- created(location).
+ created(uriInfo.getAbsolutePathBuilder().path(String.valueOf(id)).build()).
header(RESTHeaders.RESOURCE_ID, id);
switch (getPreference()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
index 1ba5674..618b245 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
@@ -22,6 +22,8 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnBundleTO;
@@ -71,14 +73,16 @@ public class ConnectorServiceImpl extends AbstractServiceImpl implements Connect
connInstanceTO.setKey(connInstanceKey);
- List<String> schemaNames = logic.getSchemaNames(connInstanceTO, includeSpecial);
- List<PlainSchemaTO> result = new ArrayList<>(schemaNames.size());
- for (String name : schemaNames) {
- PlainSchemaTO schemaTO = new PlainSchemaTO();
- schemaTO.setKey(name);
- result.add(schemaTO);
- }
- return result;
+ return CollectionUtils.collect(logic.getSchemaNames(connInstanceTO, includeSpecial),
+ new Transformer<String, PlainSchemaTO>() {
+
+ @Override
+ public PlainSchemaTO transform(final String name) {
+ PlainSchemaTO schemaTO = new PlainSchemaTO();
+ schemaTO.setKey(name);
+ return schemaTO;
+ }
+ }, new ArrayList<PlainSchemaTO>());
}
@Override
@@ -128,6 +132,19 @@ public class ConnectorServiceImpl extends AbstractServiceImpl implements Connect
@Override
public BulkActionResult bulk(final BulkAction bulkAction) {
- return logic.bulk(bulkAction);
+ BulkActionResult result = new BulkActionResult();
+
+ if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
+ for (String id : bulkAction.getTargets()) {
+ try {
+ result.add(logic.delete(Long.valueOf(id)).getKey(), BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing delete for connector {}", id, e);
+ result.add(id, BulkActionResult.Status.FAILURE);
+ }
+ }
+ }
+
+ return result;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/EntitlementServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/EntitlementServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/EntitlementServiceImpl.java
deleted file mode 100644
index 8d2b2a4..0000000
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/EntitlementServiceImpl.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.rest.cxf.service;
-
-import java.util.List;
-import org.apache.syncope.common.lib.wrap.EntitlementTO;
-import org.apache.syncope.common.rest.api.CollectionWrapper;
-import org.apache.syncope.common.rest.api.service.EntitlementService;
-import org.apache.syncope.core.logic.EntitlementLogic;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class EntitlementServiceImpl extends AbstractServiceImpl implements EntitlementService {
-
- @Autowired
- private EntitlementLogic logic;
-
- @Override
- public List<EntitlementTO> getAllEntitlements() {
- return CollectionWrapper.wrap(logic.getAll(), EntitlementTO.class);
- }
-
- @Override
- public List<EntitlementTO> getOwnEntitlements() {
- return CollectionWrapper.wrap(logic.getOwn(), EntitlementTO.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
index 5c334a9..5efee1e 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
@@ -20,6 +20,10 @@ package org.apache.syncope.core.rest.cxf.service;
import java.util.List;
import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.mod.GroupMod;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
@@ -44,11 +48,6 @@ public class GroupServiceImpl extends AbstractServiceImpl implements GroupServic
private GroupLogic logic;
@Override
- public List<GroupTO> children(final Long groupKey) {
- return logic.children(groupKey);
- }
-
- @Override
public Response create(final GroupTO groupTO) {
GroupTO created = logic.create(groupTO);
return createResponse(created.getKey(), created);
@@ -65,29 +64,36 @@ public class GroupServiceImpl extends AbstractServiceImpl implements GroupServic
}
@Override
- public PagedResult<GroupTO> list() {
- return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
+ public PagedResult<GroupTO> list(final List<String> realms) {
+ return list(realms, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
}
@Override
- public PagedResult<GroupTO> list(final String orderBy) {
- return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
+ public PagedResult<GroupTO> list(final List<String> realms, final String orderBy) {
+ return list(realms, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
}
@Override
- public PagedResult<GroupTO> list(final Integer page, final Integer size) {
- return list(page, size, null);
+ public PagedResult<GroupTO> list(final List<String> realms, final Integer page, final Integer size) {
+ return list(realms, page, size, null);
}
@Override
- public PagedResult<GroupTO> list(final Integer page, final Integer size, final String orderBy) {
- List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
- return buildPagedResult(logic.list(page, size, orderByClauses), page, size, logic.count());
- }
+ public PagedResult<GroupTO> list(
+ final List<String> realms, final Integer page, final Integer size, final String orderBy) {
- @Override
- public GroupTO parent(final Long groupKey) {
- return logic.parent(groupKey);
+ CollectionUtils.transform(realms, new Transformer<String, String>() {
+
+ @Override
+ public String transform(final String input) {
+ return StringUtils.prependIfMissing(input, SyncopeConstants.ROOT_REALM);
+ }
+ });
+
+ List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
+ return buildPagedResult(
+ logic.list(page, size, orderByClauses, realms), page, size,
+ logic.count(realms));
}
@Override
@@ -96,31 +102,44 @@ public class GroupServiceImpl extends AbstractServiceImpl implements GroupServic
}
@Override
- public PagedResult<GroupTO> search(final String fiql) {
- return search(fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
+ public PagedResult<GroupTO> search(final List<String> realms, final String fiql) {
+ return search(realms, fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
}
@Override
- public PagedResult<GroupTO> search(final String fiql, final String orderBy) {
- return search(fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
+ public PagedResult<GroupTO> search(final List<String> realms, final String fiql, final String orderBy) {
+ return search(realms, fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
}
@Override
- public PagedResult<GroupTO> search(final String fiql, final Integer page, final Integer size) {
- return search(fiql, page, size, null);
+ public PagedResult<GroupTO> search(
+ final List<String> realms, final String fiql, final Integer page, final Integer size) {
+
+ return search(realms, fiql, page, size, null);
}
@Override
- public PagedResult<GroupTO> search(final String fiql, final Integer page, final Integer size, final String orderBy) {
+ public PagedResult<GroupTO> search(final List<String> realms, final String fiql,
+ final Integer page, final Integer size, final String orderBy) {
+
+ CollectionUtils.transform(realms, new Transformer<String, String>() {
+
+ @Override
+ public String transform(final String input) {
+ return StringUtils.prependIfMissing(input, SyncopeConstants.ROOT_REALM);
+ }
+ });
+
SearchCond cond = getSearchCond(fiql);
List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
return buildPagedResult(
- logic.search(cond, page, size, orderByClauses), page, size, logic.searchCount(cond));
+ logic.search(cond, page, size, orderByClauses, realms), page, size,
+ logic.searchCount(cond, realms));
}
@Override
- public GroupTO readSelf(final Long groupKey) {
- return logic.readSelf(groupKey);
+ public List<GroupTO> own() {
+ return logic.own();
}
@Override
@@ -222,6 +241,21 @@ public class GroupServiceImpl extends AbstractServiceImpl implements GroupServic
@Override
public BulkActionResult bulk(final BulkAction bulkAction) {
- return logic.bulk(bulkAction);
+ BulkActionResult result = new BulkActionResult();
+
+ if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
+ for (String groupKey : bulkAction.getTargets()) {
+ try {
+ result.add(logic.delete(Long.valueOf(groupKey)).getKey(), BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing delete for group {}", groupKey, e);
+ result.add(groupKey, BulkActionResult.Status.FAILURE);
+ }
+ }
+ } else {
+ LOG.warn("Unsupported bulk action: {}", bulkAction.getOperation());
+ }
+
+ return result;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
index ac4df8a..1558120 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
@@ -20,7 +20,6 @@ package org.apache.syncope.core.rest.cxf.service;
import java.net.URI;
import java.util.List;
-import javax.ws.rs.BadRequestException;
import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.to.AbstractPolicyTO;
import org.apache.syncope.common.lib.to.AccountPolicyTO;
@@ -41,7 +40,7 @@ public class PolicyServiceImpl extends AbstractServiceImpl implements PolicyServ
@Override
public <T extends AbstractPolicyTO> Response create(final T policyTO) {
- AbstractPolicyTO policy = logic.create(policyTO);
+ T policy = logic.create(policyTO);
URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(policy.getKey())).build();
return Response.created(location).
header(RESTHeaders.RESOURCE_ID, policy.getKey()).
@@ -63,51 +62,20 @@ public class PolicyServiceImpl extends AbstractServiceImpl implements PolicyServ
return logic.read(policyKey);
}
- @SuppressWarnings("unchecked")
- @Override
- public <T extends AbstractPolicyTO> T readGlobal(final PolicyType type) {
- T result = null;
-
- switch (type) {
- case ACCOUNT:
- case GLOBAL_ACCOUNT:
- result = (T) logic.getGlobalAccountPolicy();
- break;
-
- case PASSWORD:
- case GLOBAL_PASSWORD:
- result = (T) logic.getGlobalPasswordPolicy();
- break;
-
- case SYNC:
- case GLOBAL_SYNC:
- result = (T) logic.getGlobalSyncPolicy();
- break;
-
- default:
- throw new BadRequestException();
- }
-
- return result;
- }
-
@Override
public <T extends AbstractPolicyTO> void update(final Long policyKey, final T policyTO) {
policyTO.setKey(policyKey);
switch (policyTO.getType()) {
case ACCOUNT:
- case GLOBAL_ACCOUNT:
logic.update((AccountPolicyTO) policyTO);
break;
case PASSWORD:
- case GLOBAL_PASSWORD:
logic.update((PasswordPolicyTO) policyTO);
break;
case SYNC:
- case GLOBAL_SYNC:
logic.update((SyncPolicyTO) policyTO);
break;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
index 79f506c..aba5295 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
@@ -22,6 +22,7 @@ import java.net.URI;
import java.util.List;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.RealmService;
@@ -42,12 +43,12 @@ public class RealmServiceImpl extends AbstractServiceImpl implements RealmServic
@Override
public List<RealmTO> list(final String fullPath) {
- return logic.list(StringUtils.prependIfMissing(fullPath, "/"));
+ return logic.list(StringUtils.prependIfMissing(fullPath, SyncopeConstants.ROOT_REALM));
}
@Override
public Response create(final String parentPath, final RealmTO realmTO) {
- RealmTO created = logic.create(StringUtils.prependIfMissing(parentPath, "/"), realmTO);
+ RealmTO created = logic.create(StringUtils.prependIfMissing(parentPath, SyncopeConstants.ROOT_REALM), realmTO);
URI location = uriInfo.getAbsolutePathBuilder().path(created.getName()).build();
return Response.created(location).
header(RESTHeaders.RESOURCE_ID, created.getFullPath()).
@@ -56,13 +57,13 @@ public class RealmServiceImpl extends AbstractServiceImpl implements RealmServic
@Override
public void update(final String fullPath, final RealmTO realmTO) {
- realmTO.setFullPath(StringUtils.prependIfMissing(fullPath, "/"));
+ realmTO.setFullPath(StringUtils.prependIfMissing(fullPath, SyncopeConstants.ROOT_REALM));
logic.update(realmTO);
}
@Override
public void delete(final String fullPath) {
- logic.delete(StringUtils.prependIfMissing(fullPath, "/"));
+ logic.delete(StringUtils.prependIfMissing(fullPath, SyncopeConstants.ROOT_REALM));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
index 63bb632..dfc4391 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
@@ -93,11 +93,6 @@ public class ResourceServiceImpl extends AbstractServiceImpl implements Resource
}
@Override
- public BulkActionResult bulk(final BulkAction bulkAction) {
- return logic.bulk(bulkAction);
- }
-
- @Override
public BulkActionResult bulkDeassociation(final String resourceKey, final SubjectType subjectType,
final ResourceDeassociationActionType type, final List<SubjectKey> subjectKeys) {
@@ -136,4 +131,21 @@ public class ResourceServiceImpl extends AbstractServiceImpl implements Resource
return res;
}
+ @Override
+ public BulkActionResult bulk(final BulkAction bulkAction) {
+ BulkActionResult result = new BulkActionResult();
+
+ if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
+ for (String name : bulkAction.getTargets()) {
+ try {
+ result.add(logic.delete(name).getKey(), BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing delete for resource {}", name, e);
+ result.add(name, BulkActionResult.Status.FAILURE);
+ }
+ }
+ }
+
+ return result;
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
index 3867a25..ce1a394 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
@@ -134,6 +134,47 @@ public class TaskServiceImpl extends AbstractServiceImpl implements TaskService
@Override
public BulkActionResult bulk(final BulkAction bulkAction) {
- return logic.bulk(bulkAction);
+ BulkActionResult result = new BulkActionResult();
+
+ switch (bulkAction.getOperation()) {
+ case DELETE:
+ for (String taskKey : bulkAction.getTargets()) {
+ try {
+ result.add(logic.delete(Long.valueOf(taskKey)).getKey(), BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing delete for task {}", taskKey, e);
+ result.add(taskKey, BulkActionResult.Status.FAILURE);
+ }
+ }
+ break;
+
+ case DRYRUN:
+ for (String taskKey : bulkAction.getTargets()) {
+ try {
+ logic.execute(Long.valueOf(taskKey), true);
+ result.add(taskKey, BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing dryrun for task {}", taskKey, e);
+ result.add(taskKey, BulkActionResult.Status.FAILURE);
+ }
+ }
+ break;
+
+ case EXECUTE:
+ for (String taskKey : bulkAction.getTargets()) {
+ try {
+ logic.execute(Long.valueOf(taskKey), false);
+ result.add(taskKey, BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing execute for task {}", taskKey, e);
+ result.add(taskKey, BulkActionResult.Status.FAILURE);
+ }
+ }
+ break;
+
+ default:
+ }
+
+ return result;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
index f48ec4c..d15c236 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
@@ -19,10 +19,12 @@
package org.apache.syncope.core.rest.cxf.service;
import javax.ws.rs.core.Response;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.UserSelfService;
import org.apache.syncope.core.logic.SyncopeLogic;
import org.apache.syncope.core.logic.UserLogic;
@@ -51,8 +53,13 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements UserSelf
}
@Override
- public UserTO read() {
- return logic.readSelf();
+ public Response read() {
+ Pair<String, UserTO> self = logic.readSelf();
+ return Response.ok().
+ header(RESTHeaders.RESOURCE_ID, self.getValue().getKey()).
+ header(RESTHeaders.OWNED_ENTITLEMENTS, self.getKey()).
+ entity(self.getValue()).
+ build();
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
index 82cecfc..320a37c 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
@@ -21,6 +21,10 @@ package org.apache.syncope.core.rest.cxf.service;
import java.util.List;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.mod.ResourceAssociationMod;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
@@ -78,24 +82,36 @@ public class UserServiceImpl extends AbstractServiceImpl implements UserService
}
@Override
- public PagedResult<UserTO> list() {
- return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
+ public PagedResult<UserTO> list(final List<String> realms) {
+ return list(realms, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
}
@Override
- public PagedResult<UserTO> list(final String orderBy) {
- return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
+ public PagedResult<UserTO> list(final List<String> realms, final String orderBy) {
+ return list(realms, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
}
@Override
- public PagedResult<UserTO> list(final Integer page, final Integer size) {
- return list(page, size, null);
+ public PagedResult<UserTO> list(final List<String> realms, final Integer page, final Integer size) {
+ return list(realms, page, size, null);
}
@Override
- public PagedResult<UserTO> list(final Integer page, final Integer size, final String orderBy) {
+ public PagedResult<UserTO> list(
+ final List<String> realms, final Integer page, final Integer size, final String orderBy) {
+
+ CollectionUtils.transform(realms, new Transformer<String, String>() {
+
+ @Override
+ public String transform(final String input) {
+ return StringUtils.prependIfMissing(input, SyncopeConstants.ROOT_REALM);
+ }
+ });
+
List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
- return buildPagedResult(logic.list(page, size, orderByClauses), page, size, logic.count());
+ return buildPagedResult(
+ logic.list(page, size, orderByClauses, realms), page, size,
+ logic.count(realms));
}
@Override
@@ -104,26 +120,39 @@ public class UserServiceImpl extends AbstractServiceImpl implements UserService
}
@Override
- public PagedResult<UserTO> search(final String fiql) {
- return search(fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
+ public PagedResult<UserTO> search(final List<String> realms, final String fiql) {
+ return search(realms, fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
}
@Override
- public PagedResult<UserTO> search(final String fiql, final String orderBy) {
- return search(fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
+ public PagedResult<UserTO> search(final List<String> realms, final String fiql, final String orderBy) {
+ return search(realms, fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
}
@Override
- public PagedResult<UserTO> search(final String fiql, final Integer page, final Integer size) {
- return search(fiql, page, size, null);
+ public PagedResult<UserTO> search(
+ final List<String> realms, final String fiql, final Integer page, final Integer size) {
+
+ return search(realms, fiql, page, size, null);
}
@Override
- public PagedResult<UserTO> search(final String fiql, final Integer page, final Integer size, final String orderBy) {
+ public PagedResult<UserTO> search(final List<String> realms, final String fiql,
+ final Integer page, final Integer size, final String orderBy) {
+
+ CollectionUtils.transform(realms, new Transformer<String, String>() {
+
+ @Override
+ public String transform(final String input) {
+ return StringUtils.prependIfMissing(input, SyncopeConstants.ROOT_REALM);
+ }
+ });
+
SearchCond cond = getSearchCond(fiql);
List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
return buildPagedResult(
- logic.search(cond, page, size, orderByClauses), page, size, logic.searchCount(cond));
+ logic.search(cond, page, size, orderByClauses, realms), page, size,
+ logic.searchCount(cond, realms));
}
@Override
@@ -246,6 +275,51 @@ public class UserServiceImpl extends AbstractServiceImpl implements UserService
@Override
public BulkActionResult bulk(final BulkAction bulkAction) {
- return logic.bulk(bulkAction);
+ BulkActionResult result = new BulkActionResult();
+
+ switch (bulkAction.getOperation()) {
+ case DELETE:
+ for (String key : bulkAction.getTargets()) {
+ try {
+ result.add(logic.delete(Long.valueOf(key)).getKey(), BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing delete for user {}", key, e);
+ result.add(key, BulkActionResult.Status.FAILURE);
+ }
+ }
+ break;
+
+ case SUSPEND:
+ for (String key : bulkAction.getTargets()) {
+ StatusMod statusMod = new StatusMod();
+ statusMod.setKey(Long.valueOf(key));
+ statusMod.setType(StatusMod.ModType.SUSPEND);
+ try {
+ result.add(logic.status(statusMod).getKey(), BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing suspend for user {}", key, e);
+ result.add(key, BulkActionResult.Status.FAILURE);
+ }
+ }
+ break;
+
+ case REACTIVATE:
+ for (String key : bulkAction.getTargets()) {
+ StatusMod statusMod = new StatusMod();
+ statusMod.setKey(Long.valueOf(key));
+ statusMod.setType(StatusMod.ModType.REACTIVATE);
+ try {
+ result.add(logic.status(statusMod).getKey(), BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing reactivate for user {}", key, e);
+ result.add(key, BulkActionResult.Status.FAILURE);
+ }
+ }
+ break;
+
+ default:
+ }
+
+ return result;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java
index 3db5052..a9e2276 100644
--- a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java
+++ b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java
@@ -24,7 +24,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -58,6 +57,8 @@ import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
@@ -67,8 +68,8 @@ import org.apache.syncope.common.lib.to.WorkflowFormTO;
import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.common.lib.types.WorkflowFormPropertyType;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
+import org.apache.syncope.core.misc.security.AuthContextUtils;
+import org.apache.syncope.core.misc.security.UnauthorizedException;
import org.apache.syncope.core.misc.spring.BeanUtils;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
@@ -241,25 +242,25 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
}
@Override
- public WorkflowResult<Map.Entry<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
+ public WorkflowResult<Pair<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
final boolean storePassword) throws WorkflowException {
return create(userTO, disablePwdPolicyCheck, null, storePassword);
}
@Override
- public WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO, boolean storePassword) throws
- UnauthorizedGroupException, WorkflowException {
+ public WorkflowResult<Pair<Long, Boolean>> create(UserTO userTO, boolean storePassword) throws
+ UnauthorizedException, WorkflowException {
return create(userTO, false, storePassword);
}
@Override
- public WorkflowResult<Map.Entry<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
+ public WorkflowResult<Pair<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
final Boolean enabled, final boolean storePassword) throws WorkflowException {
final Map<String, Object> variables = new HashMap<>();
- variables.put(WF_EXECUTOR, AuthContextUtil.getAuthenticatedUsername());
+ variables.put(WF_EXECUTOR, AuthContextUtils.getAuthenticatedUsername());
variables.put(USER_TO, userTO);
variables.put(ENABLED, enabled);
variables.put(STORE_PASSWORD, storePassword);
@@ -299,8 +300,8 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
saveForFormSubmit(user, userTO.getPassword(), propByRes);
- return new WorkflowResult<Map.Entry<Long, Boolean>>(
- new SimpleEntry<>(user.getKey(), propagateEnable), propByRes, getPerformedTasks(user));
+ return new WorkflowResult<Pair<Long, Boolean>>(
+ new ImmutablePair<>(user.getKey(), propagateEnable), propByRes, getPerformedTasks(user));
}
private Set<String> doExecuteTask(final User user, final String task,
@@ -309,7 +310,7 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
Set<String> preTasks = getPerformedTasks(user);
final Map<String, Object> variables = new HashMap<>();
- variables.put(WF_EXECUTOR, AuthContextUtil.getAuthenticatedUsername());
+ variables.put(WF_EXECUTOR, AuthContextUtils.getAuthenticatedUsername());
variables.put(TASK, task);
// using BeanUtils to access all user's properties and trigger lazy loading - we are about to
@@ -355,7 +356,7 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
}
@Override
- protected WorkflowResult<Map.Entry<UserMod, Boolean>> doUpdate(final User user, final UserMod userMod)
+ protected WorkflowResult<Pair<UserMod, Boolean>> doUpdate(final User user, final UserMod userMod)
throws WorkflowException {
Set<String> tasks = doExecuteTask(user, "update", Collections.singletonMap(USER_MOD, (Object) userMod));
@@ -370,8 +371,8 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
Boolean propagateEnable = runtimeService.getVariable(user.getWorkflowId(), PROPAGATE_ENABLE, Boolean.class);
- return new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new SimpleEntry<>(userMod, propagateEnable), propByRes, tasks);
+ return new WorkflowResult<Pair<UserMod, Boolean>>(
+ new ImmutablePair<>(userMod, propagateEnable), propByRes, tasks);
}
@Override
@@ -445,7 +446,7 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
@Override
public WorkflowResult<Long> execute(final UserTO userTO, final String taskId)
- throws UnauthorizedGroupException, WorkflowException {
+ throws UnauthorizedException, WorkflowException {
User user = userDAO.authFetch(userTO.getKey());
@@ -694,7 +695,7 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
public List<WorkflowFormTO> getForms() {
List<WorkflowFormTO> forms = new ArrayList<>();
- final String authUser = AuthContextUtil.getAuthenticatedUsername();
+ final String authUser = AuthContextUtils.getAuthenticatedUsername();
if (adminUser.equals(authUser)) {
forms.addAll(getForms(taskService.createTaskQuery().
taskVariableValueEquals(TASK_IS_FORM, Boolean.TRUE)));
@@ -782,7 +783,7 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
return result;
}
- private Map.Entry<Task, TaskFormData> checkTask(final String taskId, final String authUser) {
+ private Pair<Task, TaskFormData> checkTask(final String taskId, final String authUser) {
Task task;
try {
task = taskService.createTaskQuery().taskId(taskId).singleResult();
@@ -804,7 +805,7 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
}
}
- return new SimpleEntry<>(task, formData);
+ return new ImmutablePair<>(task, formData);
}
@Transactional
@@ -812,8 +813,8 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
public WorkflowFormTO claimForm(final String taskId)
throws WorkflowException {
- final String authUser = AuthContextUtil.getAuthenticatedUsername();
- Map.Entry<Task, TaskFormData> checked = checkTask(taskId, authUser);
+ final String authUser = AuthContextUtils.getAuthenticatedUsername();
+ Pair<Task, TaskFormData> checked = checkTask(taskId, authUser);
if (!adminUser.equals(authUser)) {
List<Task> tasksForUser = taskService.createTaskQuery().taskId(taskId).taskCandidateUser(authUser).list();
@@ -839,8 +840,8 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
public WorkflowResult<UserMod> submitForm(final WorkflowFormTO form)
throws WorkflowException {
- final String authUser = AuthContextUtil.getAuthenticatedUsername();
- Map.Entry<Task, TaskFormData> checked = checkTask(form.getTaskId(), authUser);
+ final String authUser = AuthContextUtils.getAuthenticatedUsername();
+ Pair<Task, TaskFormData> checked = checkTask(form.getTaskId(), authUser);
if (!checked.getKey().getOwner().equals(authUser)) {
throw new WorkflowException(new IllegalArgumentException("Task " + form.getTaskId() + " assigned to "
@@ -886,8 +887,8 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
userMod = new UserMod();
userMod.setKey(updated.getKey());
userMod.setPassword(clearPassword);
-
- if (propByRes != null) {
+
+ if (propByRes != null) {
final StatusMod st = new StatusMod();
userMod.setPwdPropRequest(st);
st.setOnSyncope(true);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupQueryImpl.java
----------------------------------------------------------------------
diff --git a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupQueryImpl.java b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupQueryImpl.java
index 1ec4b54..b78575c 100644
--- a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupQueryImpl.java
+++ b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeGroupQueryImpl.java
@@ -26,6 +26,9 @@ import org.activiti.engine.ActivitiException;
import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.GroupQuery;
import org.activiti.engine.impl.persistence.entity.GroupEntity;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
public class SyncopeGroupQueryImpl implements GroupQuery {
@@ -99,7 +102,7 @@ public class SyncopeGroupQueryImpl implements GroupQuery {
return new GroupEntity(group.getKey().toString());
}
- private void execute() {
+ private void execute(final int page, final int itemsPerPage) {
if (groupId != null) {
org.apache.syncope.core.persistence.api.entity.group.Group syncopeGroup = groupDAO.find(groupId);
if (syncopeGroup == null) {
@@ -109,17 +112,24 @@ public class SyncopeGroupQueryImpl implements GroupQuery {
}
}
if (result == null) {
- result = new ArrayList<>();
- for ( org.apache.syncope.core.persistence.api.entity.group.Group syncopeGroup : groupDAO.findAll()) {
- result.add(fromSyncopeGroup(syncopeGroup));
- }
+ result = CollectionUtils.collect(
+ groupDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, page, itemsPerPage),
+ new Transformer<org.apache.syncope.core.persistence.api.entity.group.Group, Group>() {
+
+ @Override
+ public Group transform(final org.apache.syncope.core.persistence.api.entity.group.Group user) {
+ return fromSyncopeGroup(user);
+ }
+
+ },
+ new ArrayList<Group>());
}
}
@Override
public long count() {
if (result == null) {
- execute();
+ execute(-1, -1);
}
return result.size();
}
@@ -127,7 +137,7 @@ public class SyncopeGroupQueryImpl implements GroupQuery {
@Override
public Group singleResult() {
if (result == null) {
- execute();
+ execute(-1, -1);
}
if (result.isEmpty()) {
throw new ActivitiException("Empty result");
@@ -139,7 +149,7 @@ public class SyncopeGroupQueryImpl implements GroupQuery {
@Override
public List<Group> list() {
if (result == null) {
- execute();
+ execute(-1, -1);
}
return result;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserManager.java
----------------------------------------------------------------------
diff --git a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserManager.java b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserManager.java
index 7112967..72be4e3 100644
--- a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserManager.java
+++ b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserManager.java
@@ -32,7 +32,6 @@ import org.activiti.engine.impl.persistence.entity.GroupEntity;
import org.activiti.engine.impl.persistence.entity.IdentityInfoEntity;
import org.activiti.engine.impl.persistence.entity.UserEntity;
import org.activiti.engine.impl.persistence.entity.UserIdentityManager;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,9 +44,6 @@ public class SyncopeUserManager implements UserIdentityManager, SyncopeSession {
@Autowired
private GroupDAO groupDAO;
- @Autowired
- private EntitlementDAO entitlementDAO;
-
@Override
public Class<?> getType() {
return UserIdentityManager.class;
@@ -65,7 +61,7 @@ public class SyncopeUserManager implements UserIdentityManager, SyncopeSession {
@Override
public UserQuery createNewUserQuery() {
- return new SyncopeUserQueryImpl(userDAO, groupDAO, entitlementDAO);
+ return new SyncopeUserQueryImpl(userDAO, groupDAO);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java
----------------------------------------------------------------------
diff --git a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java
index 43b0306..2f46cbd 100644
--- a/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java
+++ b/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java
@@ -25,8 +25,9 @@ import org.activiti.engine.ActivitiException;
import org.activiti.engine.identity.User;
import org.activiti.engine.identity.UserQuery;
import org.activiti.engine.impl.persistence.entity.UserEntity;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.syncope.common.lib.SyncopeConstants;
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.membership.Membership;
@@ -38,18 +39,15 @@ public class SyncopeUserQueryImpl implements UserQuery {
private GroupDAO groupDAO;
- private EntitlementDAO entitlementDAO;
-
private String username;
private Long memberOf;
private List<User> result;
- public SyncopeUserQueryImpl(final UserDAO userDAO, final GroupDAO groupDAO, final EntitlementDAO entitlementDAO) {
+ public SyncopeUserQueryImpl(final UserDAO userDAO, final GroupDAO groupDAO) {
this.userDAO = userDAO;
this.groupDAO = groupDAO;
- this.entitlementDAO = entitlementDAO;
}
@Override
@@ -165,13 +163,17 @@ public class SyncopeUserQueryImpl implements UserQuery {
}
// THIS CAN BE *VERY* DANGEROUS
if (result == null) {
- result = new ArrayList<>();
+ result = CollectionUtils.collect(
+ userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, page, itemsPerPage),
+ new Transformer<org.apache.syncope.core.persistence.api.entity.user.User, User>() {
- List<org.apache.syncope.core.persistence.api.entity.user.User> users =
- userDAO.findAll(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), page, itemsPerPage);
- for (org.apache.syncope.core.persistence.api.entity.user.User user : users) {
- result.add(fromSyncopeUser(user));
- }
+ @Override
+ public User transform(final org.apache.syncope.core.persistence.api.entity.user.User user) {
+ return fromSyncopeUser(user);
+ }
+
+ },
+ new ArrayList<User>());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java b/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java
index f91b83f..0d7c86a 100644
--- a/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java
+++ b/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java
@@ -18,8 +18,8 @@
*/
package org.apache.syncope.core.workflow.api;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import java.util.Map;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.core.persistence.api.entity.user.User;
@@ -36,7 +36,7 @@ public interface UserWorkflowAdapter extends WorkflowAdapter {
* @param storePassword whether password shall be stored into the internal storage
* @return user just created
*/
- WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO, boolean storePassword);
+ WorkflowResult<Pair<Long, Boolean>> create(UserTO userTO, boolean storePassword);
/**
* Create an user, optionally disabling password policy check.
@@ -46,7 +46,7 @@ public interface UserWorkflowAdapter extends WorkflowAdapter {
* @param storePassword whether password shall be stored into the internal storage
* @return user just created
*/
- WorkflowResult<Map.Entry<Long, Boolean>> create(
+ WorkflowResult<Pair<Long, Boolean>> create(
UserTO userTO, boolean disablePwdPolicyCheck, boolean storePassword);
/**
@@ -58,7 +58,7 @@ public interface UserWorkflowAdapter extends WorkflowAdapter {
* @param storePassword whether password shall be stored into the internal storage
* @return user just created
*/
- WorkflowResult<Map.Entry<Long, Boolean>> create(
+ WorkflowResult<Pair<Long, Boolean>> create(
UserTO userTO, boolean disablePwdPolicyCheck, final Boolean enabled, boolean storePassword);
/**
@@ -85,7 +85,7 @@ public interface UserWorkflowAdapter extends WorkflowAdapter {
* @param userMod modification set to be performed
* @return user just updated and propagations to be performed
*/
- WorkflowResult<Map.Entry<UserMod, Boolean>> update(UserMod userMod);
+ WorkflowResult<Pair<UserMod, Boolean>> update(UserMod userMod);
/**
* Suspend an user.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractUserWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractUserWorkflowAdapter.java b/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractUserWorkflowAdapter.java
index c37d8b2..cc27a4b 100644
--- a/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractUserWorkflowAdapter.java
+++ b/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/AbstractUserWorkflowAdapter.java
@@ -18,7 +18,7 @@
*/
package org.apache.syncope.core.workflow.java;
-import java.util.Map;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
@@ -68,11 +68,11 @@ public abstract class AbstractUserWorkflowAdapter implements UserWorkflowAdapter
return doActivate(userDAO.authFetch(userKey), token);
}
- protected abstract WorkflowResult<Map.Entry<UserMod, Boolean>> doUpdate(User user, UserMod userMod)
+ protected abstract WorkflowResult<Pair<UserMod, Boolean>> doUpdate(User user, UserMod userMod)
throws WorkflowException;
@Override
- public WorkflowResult<Map.Entry<UserMod, Boolean>> update(final UserMod userMod)
+ public WorkflowResult<Pair<UserMod, Boolean>> update(final UserMod userMod)
throws WorkflowException {
return doUpdate(userDAO.authFetch(userMod.getKey()), userMod);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultUserWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultUserWorkflowAdapter.java b/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultUserWorkflowAdapter.java
index 1db511b..7b92490 100644
--- a/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultUserWorkflowAdapter.java
+++ b/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultUserWorkflowAdapter.java
@@ -19,12 +19,11 @@
package org.apache.syncope.core.workflow.java;
import java.io.OutputStream;
-import java.util.AbstractMap;
-import java.util.AbstractMap.SimpleEntry;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.to.WorkflowFormTO;
@@ -49,21 +48,21 @@ public class DefaultUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
private ConfDAO confDAO;
@Override
- public WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO, boolean storePassword)
+ public WorkflowResult<Pair<Long, Boolean>> create(UserTO userTO, boolean storePassword)
throws WorkflowException {
return create(userTO, false, true);
}
@Override
- public WorkflowResult<Map.Entry<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
+ public WorkflowResult<Pair<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
final boolean storePassword) throws WorkflowException {
return create(userTO, disablePwdPolicyCheck, null, storePassword);
}
@Override
- public WorkflowResult<Map.Entry<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
+ public WorkflowResult<Pair<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
final Boolean enabled, final boolean storePassword) throws WorkflowException {
User user = entityFactory.newEntity(User.class);
@@ -93,8 +92,8 @@ public class DefaultUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
final PropagationByResource propByRes = new PropagationByResource();
propByRes.set(ResourceOperation.CREATE, user.getResourceNames());
- return new WorkflowResult<Map.Entry<Long, Boolean>>(
- new SimpleEntry<>(user.getKey(), propagateEnable), propByRes, "create");
+ return new WorkflowResult<Pair<Long, Boolean>>(
+ new ImmutablePair<>(user.getKey(), propagateEnable), propByRes, "create");
}
@Override
@@ -113,7 +112,7 @@ public class DefaultUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
}
@Override
- protected WorkflowResult<Map.Entry<UserMod, Boolean>> doUpdate(final User user, final UserMod userMod)
+ protected WorkflowResult<Pair<UserMod, Boolean>> doUpdate(final User user, final UserMod userMod)
throws WorkflowException {
// update password internally only if required
@@ -127,8 +126,8 @@ public class DefaultUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
User updated = userDAO.save(user);
userMod.setKey(updated.getKey());
- return new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new AbstractMap.SimpleEntry<>(userMod, !user.isSuspended()), propByRes, "update");
+ return new WorkflowResult<Pair<UserMod, Boolean>>(
+ new ImmutablePair<>(userMod, !user.isSuspended()), propByRes, "update");
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/logic/src/main/java/org/apache/syncope/core/logic/init/CamelRouteLoader.java
----------------------------------------------------------------------
diff --git a/ext/camel/logic/src/main/java/org/apache/syncope/core/logic/init/CamelRouteLoader.java b/ext/camel/logic/src/main/java/org/apache/syncope/core/logic/init/CamelRouteLoader.java
index 3fe8592..8134eb0 100644
--- a/ext/camel/logic/src/main/java/org/apache/syncope/core/logic/init/CamelRouteLoader.java
+++ b/ext/camel/logic/src/main/java/org/apache/syncope/core/logic/init/CamelRouteLoader.java
@@ -75,7 +75,6 @@ public class CamelRouteLoader implements SyncopeLoader {
if (!loaded) {
loadRoutes(userRoutesLoader.getResource(), SubjectType.USER);
loadRoutes(groupRoutesLoader.getResource(), SubjectType.GROUP);
- loadEntitlements();
loaded = true;
}
}
@@ -137,31 +136,4 @@ public class CamelRouteLoader implements SyncopeLoader {
}
}
}
-
- private void loadEntitlements() {
- final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
-
- boolean existingData;
- try {
- existingData = jdbcTemplate.queryForObject(
- "SELECT COUNT(0) FROM Entitlement WHERE NAME LIKE 'ROUTE_%'", Integer.class) > 0;
- } catch (DataAccessException e) {
- LOG.error("Could not access to Entitlement table", e);
- existingData = true;
- }
-
- if (existingData) {
- LOG.info("Camel route entitlements found in the database, leaving untouched");
- } else {
- LOG.info("No Camel route entitlements found in the database, loading");
-
- try {
- jdbcTemplate.update("INSERT INTO Entitlement(NAME) VALUES('ROUTE_READ')");
- jdbcTemplate.update("INSERT INTO Entitlement(NAME) VALUES('ROUTE_LIST')");
- jdbcTemplate.update("INSERT INTO Entitlement(NAME) VALUES('ROUTE_UPDATE')");
- } catch (Exception e) {
- LOG.error("While adding additional entitlements", e);
- }
- }
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
index 8ab600a..13a69a1 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.PollingConsumer;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.GroupMod;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.GroupTO;
@@ -36,13 +37,13 @@ public class CamelGroupProvisioningManager
extends AbstractCamelProvisioningManager implements GroupProvisioningManager {
@Override
- public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO subject) {
+ public Pair<Long, List<PropagationStatus>> create(final GroupTO subject) {
return create(subject, Collections.<String>emptySet());
}
@Override
@SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO groupTO, final Set<String> excludedResources) {
+ public Pair<Long, List<PropagationStatus>> create(final GroupTO groupTO, final Set<String> excludedResources) {
PollingConsumer pollingConsumer = getConsumer("direct:createGroupPort");
Map<String, Object> props = new HashMap<>();
@@ -56,12 +57,12 @@ public class CamelGroupProvisioningManager
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
- return exchange.getIn().getBody(Map.Entry.class);
+ return exchange.getIn().getBody(Pair.class);
}
@Override
@SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO groupTO, final Map<Long, String> groupOwnerMap,
+ public Pair<Long, List<PropagationStatus>> create(final GroupTO groupTO, final Map<Long, String> groupOwnerMap,
final Set<String> excludedResources) throws PropagationException {
PollingConsumer pollingConsumer = getConsumer("direct:createGroupInSyncPort");
@@ -78,17 +79,17 @@ public class CamelGroupProvisioningManager
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
- return exchange.getIn().getBody(Map.Entry.class);
+ return exchange.getIn().getBody(Pair.class);
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> update(final GroupMod subjectMod) {
+ public Pair<Long, List<PropagationStatus>> update(final GroupMod subjectMod) {
return update(subjectMod, Collections.<String>emptySet());
}
@Override
@SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> update(
+ public Pair<Long, List<PropagationStatus>> update(
final GroupMod subjectMod, final Set<String> excludedResources) {
PollingConsumer pollingConsumer = getConsumer("direct:updateGroupPort");
@@ -104,7 +105,7 @@ public class CamelGroupProvisioningManager
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
- return exchange.getIn().getBody(Map.Entry.class);
+ return exchange.getIn().getBody(Pair.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
index c182c57..f8b076a 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
@@ -18,7 +18,6 @@
*/
package org.apache.syncope.core.provisioning.camel;
-import java.util.AbstractMap;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -28,6 +27,8 @@ import java.util.Map;
import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.PollingConsumer;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.PropagationStatus;
@@ -45,18 +46,18 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
private static final Logger LOG = LoggerFactory.getLogger(CamelUserProvisioningManager.class);
@Override
- public Map.Entry<Long, List<PropagationStatus>> create(final UserTO userTO) {
+ public Pair<Long, List<PropagationStatus>> create(final UserTO userTO) {
return create(userTO, true, false, null, Collections.<String>emptySet());
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> create(final UserTO userTO, boolean storePassword) {
+ public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, boolean storePassword) {
return create(userTO, storePassword, false, null, Collections.<String>emptySet());
}
@Override
@SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword,
+ public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword,
boolean disablePwdPolicyCheck, Boolean enabled, Set<String> excludedResources) {
PollingConsumer pollingConsumer = getConsumer("direct:createPort");
@@ -75,17 +76,17 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
- return exchange.getIn().getBody(Map.Entry.class);
+ return exchange.getIn().getBody(Pair.class);
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> update(final UserMod userMod) {
+ public Pair<Long, List<PropagationStatus>> update(final UserMod userMod) {
return update(userMod, false);
}
@Override
@SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> update(UserMod userMod, boolean removeMemberships) {
+ public Pair<Long, List<PropagationStatus>> update(UserMod userMod, boolean removeMemberships) {
PollingConsumer pollingConsumer = getConsumer("direct:updatePort");
Map<String, Object> props = new HashMap<>();
@@ -99,7 +100,7 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
- return exchange.getIn().getBody(Map.Entry.class);
+ return exchange.getIn().getBody(Pair.class);
}
@Override
@@ -144,7 +145,7 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
@Override
@SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> activate(final User user, final StatusMod statusMod) {
+ public Pair<Long, List<PropagationStatus>> activate(final User user, final StatusMod statusMod) {
PollingConsumer pollingConsumer = getConsumer("direct:statusPort");
Map<String, Object> props = new HashMap<>();
@@ -166,12 +167,12 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
- return exchange.getIn().getBody(Map.Entry.class);
+ return exchange.getIn().getBody(Pair.class);
}
@Override
@SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> reactivate(final User user, final StatusMod statusMod) {
+ public Pair<Long, List<PropagationStatus>> reactivate(final User user, final StatusMod statusMod) {
PollingConsumer pollingConsumer = getConsumer("direct:statusPort");
Map<String, Object> props = new HashMap<>();
@@ -192,12 +193,12 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
- return exchange.getIn().getBody(Map.Entry.class);
+ return exchange.getIn().getBody(Pair.class);
}
@Override
@SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> suspend(final User user, final StatusMod statusMod) {
+ public Pair<Long, List<PropagationStatus>> suspend(final User user, final StatusMod statusMod) {
PollingConsumer pollingConsumer = getConsumer("direct:statusPort");
Map<String, Object> props = new HashMap<>();
@@ -218,7 +219,7 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
- return exchange.getIn().getBody(Map.Entry.class);
+ return exchange.getIn().getBody(Pair.class);
}
@Override
@@ -258,7 +259,7 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
@Override
@SuppressWarnings("unchecked")
- public Map.Entry<Long, List<PropagationStatus>> update(
+ public Pair<Long, List<PropagationStatus>> update(
final UserMod userMod, final Long key, final ProvisioningResult result,
final Boolean enabled, final Set<String> excludedResources) {
@@ -281,14 +282,14 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
result.setStatus(ProvisioningResult.Status.FAILURE);
result.setMessage("Update failed, trying to sync status anyway (if configured)\n" + e.getMessage());
- WorkflowResult<Map.Entry<UserMod, Boolean>> updated = new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new AbstractMap.SimpleEntry<>(userMod, false), new PropagationByResource(),
+ WorkflowResult<Pair<UserMod, Boolean>> updated = new WorkflowResult<Pair<UserMod, Boolean>>(
+ new ImmutablePair<>(userMod, false), new PropagationByResource(),
new HashSet<String>());
sendMessage("direct:userInSync", updated, props);
exchange = pollingConsumer.receive();
}
- return exchange.getIn().getBody(Map.Entry.class);
+ return exchange.getIn().getBody(Pair.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
index 97a2783..a22f2eb 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
@@ -18,7 +18,6 @@ package org.apache.syncope.core.provisioning.camel.processor;
* specific language governing permissions and limitations
* under the License.
*/
-import java.util.AbstractMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -26,10 +25,9 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
@@ -52,21 +50,18 @@ public class GroupCreateInSyncProcessor implements Processor {
GroupTO actual = exchange.getProperty("subject", GroupTO.class);
Map<Long, String> groupOwnerMap = exchange.getProperty("groupOwnerMap", Map.class);
- Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
+ Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
AttrTO groupOwner = actual.getPlainAttrMap().get(StringUtils.EMPTY);
if (groupOwner != null) {
groupOwnerMap.put(created.getResult(), groupOwner.getValues().iterator().next());
}
- AuthContextUtil.extendAuthContext(
- created.getResult(), GroupEntitlementUtil.getEntitlementNameFromGroupKey(created.getResult()));
-
- List<PropagationTask> tasks = propagationManager.getGroupCreateTaskIds(
- created, actual.getVirAttrs(), excludedResource);
+ List<PropagationTask> tasks = propagationManager.getGroupCreateTasks(
+ created, actual.getVirAttrs(), excludedResources);
taskExecutor.execute(tasks);
- exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(created.getResult(), null));
+ exchange.getOut().setBody(new ImmutablePair<>(created.getResult(), null));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
index 239e209..6805a5e 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
@@ -18,15 +18,13 @@
*/
package org.apache.syncope.core.provisioning.camel.processor;
-import java.util.AbstractMap;
import java.util.List;
import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
@@ -56,10 +54,8 @@ public class GroupCreateProcessor implements Processor {
GroupTO subject = exchange.getProperty("subject", GroupTO.class);
Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
- AuthContextUtil.extendAuthContext(created.getResult(), GroupEntitlementUtil.getEntitlementNameFromGroupKey(created.getResult()));
-
List<PropagationTask> tasks =
- propagationManager.getGroupCreateTaskIds(created, subject.getVirAttrs(), excludedResource);
+ propagationManager.getGroupCreateTasks(created, subject.getVirAttrs(), excludedResource);
PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
@@ -69,7 +65,7 @@ public class GroupCreateProcessor implements Processor {
propagationReporter.onPrimaryResourceFailure(tasks);
}
- exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(
+ exchange.getOut().setBody(new ImmutablePair<>(
created.getResult(), propagationReporter.getStatuses()));
}
[06/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
index c65df96..cb1890b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
@@ -18,12 +18,12 @@
*/
package org.apache.syncope.core.provisioning.java.sync;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.AttributableUtilFactory;
import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
-import org.apache.syncope.core.provisioning.api.RoleProvisioningManager;
-import org.apache.syncope.core.provisioning.api.data.RoleDataBinder;
+import org.apache.syncope.core.provisioning.api.GroupProvisioningManager;
+import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
import org.apache.syncope.core.provisioning.api.UserProvisioningManager;
import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
@@ -34,7 +34,7 @@ import org.apache.syncope.core.provisioning.api.sync.SyncopeResultHandler;
import org.apache.syncope.core.misc.AuditManager;
import org.apache.syncope.core.misc.ConnObjectUtil;
import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
-import org.apache.syncope.core.workflow.api.RoleWorkflowAdapter;
+import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,7 +52,7 @@ public abstract class AbstractSyncopeResultHandler<T extends ProvisioningTask, A
protected UserDAO userDAO;
@Autowired
- protected RoleDAO roleDAO;
+ protected GroupDAO groupDAO;
/**
* ConnectorObject util.
@@ -91,22 +91,22 @@ public abstract class AbstractSyncopeResultHandler<T extends ProvisioningTask, A
protected UserWorkflowAdapter uwfAdapter;
/**
- * Role workflow adapter.
+ * Group workflow adapter.
*/
@Autowired
- protected RoleWorkflowAdapter rwfAdapter;
+ protected GroupWorkflowAdapter gwfAdapter;
@Autowired
protected UserDataBinder userTransfer;
@Autowired
- protected RoleDataBinder roleTransfer;
+ protected GroupDataBinder groupTransfer;
@Autowired
protected UserProvisioningManager userProvisioningManager;
@Autowired
- protected RoleProvisioningManager roleProvisioningManager;
+ protected GroupProvisioningManager groupProvisioningManager;
@Autowired
protected AttributableUtilFactory attrUtilFactory;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupPushResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupPushResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupPushResultHandlerImpl.java
new file mode 100644
index 0000000..66d8efa
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupPushResultHandlerImpl.java
@@ -0,0 +1,162 @@
+/*
+ * 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.provisioning.java.sync;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.PropagationByResource;
+import org.apache.syncope.common.lib.types.ResourceOperation;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.Mapping;
+import org.apache.syncope.core.persistence.api.entity.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.Subject;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.provisioning.api.TimeoutException;
+import org.apache.syncope.core.provisioning.api.sync.GroupPushResultHandler;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.Uid;
+
+public class GroupPushResultHandlerImpl extends AbstractPushResultHandler implements GroupPushResultHandler {
+
+ @Override
+ protected AttributableUtil getAttributableUtil() {
+ return attrUtilFactory.getInstance(AttributableType.GROUP);
+ }
+
+ @Override
+ protected Subject<?, ?, ?> deprovision(final Subject<?, ?, ?> sbj) {
+ final GroupTO before = groupTransfer.getGroupTO(Group.class.cast(sbj));
+
+ final List<String> noPropResources = new ArrayList<>(before.getResources());
+ noPropResources.remove(profile.getTask().getResource().getKey());
+
+ taskExecutor.execute(propagationManager.getGroupDeleteTaskIds(before.getKey(), noPropResources));
+
+ return groupDAO.authFetch(before.getKey());
+ }
+
+ @Override
+ protected Subject<?, ?, ?> provision(final Subject<?, ?, ?> sbj, final Boolean enabled) {
+ final GroupTO before = groupTransfer.getGroupTO(Group.class.cast(sbj));
+
+ final List<String> noPropResources = new ArrayList<>(before.getResources());
+ noPropResources.remove(profile.getTask().getResource().getKey());
+
+ final PropagationByResource propByRes = new PropagationByResource();
+ propByRes.add(ResourceOperation.CREATE, profile.getTask().getResource().getKey());
+
+ taskExecutor.execute(propagationManager.getGroupCreateTaskIds(
+ before.getKey(),
+ Collections.unmodifiableCollection(before.getVirAttrs()),
+ propByRes,
+ noPropResources));
+
+ return groupDAO.authFetch(before.getKey());
+ }
+
+ @Override
+ protected Subject<?, ?, ?> link(final Subject<?, ?, ?> sbj, final Boolean unlink) {
+ final GroupMod groupMod = new GroupMod();
+ groupMod.setKey(sbj.getKey());
+
+ if (unlink) {
+ groupMod.getResourcesToRemove().add(profile.getTask().getResource().getKey());
+ } else {
+ groupMod.getResourcesToAdd().add(profile.getTask().getResource().getKey());
+ }
+
+ gwfAdapter.update(groupMod);
+
+ return groupDAO.authFetch(sbj.getKey());
+ }
+
+ @Override
+ protected Subject<?, ?, ?> unassign(final Subject<?, ?, ?> sbj) {
+ final GroupMod groupMod = new GroupMod();
+ groupMod.setKey(sbj.getKey());
+ groupMod.getResourcesToRemove().add(profile.getTask().getResource().getKey());
+ gwfAdapter.update(groupMod);
+ return deprovision(sbj);
+ }
+
+ @Override
+ protected Subject<?, ?, ?> assign(final Subject<?, ?, ?> sbj, final Boolean enabled) {
+ final GroupMod groupMod = new GroupMod();
+ groupMod.setKey(sbj.getKey());
+ groupMod.getResourcesToAdd().add(profile.getTask().getResource().getKey());
+ gwfAdapter.update(groupMod);
+ return provision(sbj, enabled);
+ }
+
+ @Override
+ protected String getName(final Subject<?, ?, ?> subject) {
+ return Group.class.cast(subject).getName();
+ }
+
+ @Override
+ protected AbstractSubjectTO getSubjectTO(final long key) {
+ try {
+ return groupTransfer.getGroupTO(key);
+ } catch (Exception e) {
+ LOG.warn("Error retrieving user {}", key, e);
+ return null;
+ }
+ }
+
+ @Override
+ protected Subject<?, ?, ?> getSubject(final long key) {
+ try {
+ return groupDAO.authFetch(key);
+ } catch (Exception e) {
+ LOG.warn("Error retrieving group {}", key, e);
+ return null;
+ }
+ }
+
+ @Override
+ protected ConnectorObject getRemoteObject(final String accountId) {
+ ConnectorObject obj = null;
+
+ try {
+ final Uid uid = new Uid(accountId);
+
+ obj = profile.getConnector().getObject(
+ ObjectClass.GROUP,
+ uid,
+ profile.getConnector().getOperationOptions(Collections.<MappingItem>emptySet()));
+ } catch (TimeoutException toe) {
+ LOG.debug("Request timeout", toe);
+ throw toe;
+ } catch (RuntimeException ignore) {
+ LOG.debug("While resolving {}", accountId, ignore);
+ }
+ return obj;
+ }
+
+ @Override
+ protected Mapping<?> getMapping() {
+ return profile.getTask().getResource().getGmapping();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
new file mode 100644
index 0000000..b52cc0c
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
@@ -0,0 +1,168 @@
+/*
+ * 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.provisioning.java.sync;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.syncope.common.lib.mod.AbstractSubjectMod;
+import org.apache.syncope.common.lib.mod.AttrMod;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.mod.UserMod;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.GroupSyncResultHandler;
+import org.identityconnectors.framework.common.objects.SyncDelta;
+
+public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implements GroupSyncResultHandler {
+
+ protected Map<Long, String> groupOwnerMap = new HashMap<>();
+
+ @Override
+ public Map<Long, String> getGroupOwnerMap() {
+ return this.groupOwnerMap;
+ }
+
+ @Override
+ protected AttributableUtil getAttributableUtil() {
+ return attrUtilFactory.getInstance(AttributableType.GROUP);
+ }
+
+ @Override
+ protected String getName(final AbstractSubjectTO subjectTO) {
+ return GroupTO.class.cast(subjectTO).getName();
+ }
+
+ @Override
+ protected AbstractSubjectTO getSubjectTO(final long key) {
+ try {
+ return groupTransfer.getGroupTO(key);
+ } catch (Exception e) {
+ LOG.warn("Error retrieving group {}", key, e);
+ return null;
+ }
+ }
+
+ @Override
+ protected AbstractSubjectMod getSubjectMod(
+ final AbstractSubjectTO subjectTO, final SyncDelta delta) {
+
+ return connObjectUtil.getAttributableMod(
+ subjectTO.getKey(),
+ delta.getObject(),
+ subjectTO,
+ profile.getTask(),
+ attrUtilFactory.getInstance(AttributableType.GROUP));
+ }
+
+ @Override
+ protected AbstractSubjectTO create(
+ final AbstractSubjectTO subjectTO, final SyncDelta _delta, final ProvisioningResult result) {
+
+ GroupTO groupTO = GroupTO.class.cast(subjectTO);
+
+ Map.Entry<Long, List<PropagationStatus>> created = groupProvisioningManager.create(groupTO, groupOwnerMap,
+ Collections.singleton(profile.getTask().getResource().getKey()));
+
+ groupTO = groupTransfer.getGroupTO(created.getKey());
+
+ result.setId(created.getKey());
+ result.setName(getName(subjectTO));
+
+ return groupTO;
+ }
+
+ @Override
+ protected AbstractSubjectTO link(
+ final AbstractSubjectTO before,
+ final ProvisioningResult result,
+ final boolean unlink) {
+
+ final GroupMod groupMod = new GroupMod();
+ groupMod.setKey(before.getKey());
+
+ if (unlink) {
+ groupMod.getResourcesToRemove().add(profile.getTask().getResource().getKey());
+ } else {
+ groupMod.getResourcesToAdd().add(profile.getTask().getResource().getKey());
+ }
+
+ return groupTransfer.getGroupTO(gwfAdapter.update(groupMod).getResult());
+ }
+
+ @Override
+ protected AbstractSubjectTO update(
+ final AbstractSubjectTO before,
+ final AbstractSubjectMod subjectMod,
+ final SyncDelta delta,
+ final ProvisioningResult result) {
+
+ GroupMod groupMod = GroupMod.class.cast(subjectMod);
+
+ Map.Entry<Long, List<PropagationStatus>> updated = groupProvisioningManager.update(groupMod);
+
+ // moved after group provisioning manager
+ String groupOwner = null;
+ for (AttrMod attrMod : groupMod.getPlainAttrsToUpdate()) {
+ if (attrMod.getSchema().isEmpty()) {
+ groupOwner = attrMod.getValuesToBeAdded().iterator().next();
+ }
+ }
+ if (groupOwner != null) {
+ groupOwnerMap.put(updated.getKey(), groupOwner);
+ }
+
+ final GroupTO after = groupTransfer.getGroupTO(updated.getKey());
+
+ result.setName(getName(after));
+
+ return after;
+ }
+
+ @Override
+ protected void deprovision(final Long id, final boolean unlink) {
+ taskExecutor.execute(
+ propagationManager.getGroupDeleteTaskIds(id, profile.getTask().getResource().getKey()));
+
+ if (unlink) {
+ final UserMod userMod = new UserMod();
+ userMod.setKey(id);
+ userMod.getResourcesToRemove().add(profile.getTask().getResource().getKey());
+ }
+ }
+
+ @Override
+ protected void delete(final Long id) {
+ try {
+ taskExecutor.execute(
+ propagationManager.getGroupDeleteTaskIds(id, profile.getTask().getResource().getKey()));
+ } catch (Exception e) {
+ // A propagation failure doesn't imply a synchronization failure.
+ // The propagation exception status will be reported into the propagation task execution.
+ LOG.error("Could not propagate user " + id, e);
+ }
+
+ groupProvisioningManager.delete(id);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
index adc04ad..736cb3f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
@@ -27,15 +27,15 @@ import org.apache.syncope.common.lib.mod.AbstractSubjectMod;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.AbstractSubjectTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.AuditElements.Result;
import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
@@ -59,8 +59,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
- * Simple action for synchronizing LDAP groups memberships to Syncope role memberships, when the same resource is
- * configured for both users and roles.
+ * Simple action for synchronizing LDAP groups memberships to Syncope group memberships, when the same resource is
+ * configured for both users and groups.
*
* @see org.apache.syncope.core.propagation.impl.LDAPMembershipPropagationActions
*/
@@ -69,7 +69,7 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
protected static final Logger LOG = LoggerFactory.getLogger(LDAPMembershipSyncActions.class);
@Autowired
- protected RoleDAO roleDAO;
+ protected GroupDAO groupDAO;
@Autowired
protected UserWorkflowAdapter uwfAdapter;
@@ -89,7 +89,7 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
@Autowired
private SyncUtilities syncUtilities;
- protected Map<Long, Long> membersBeforeRoleUpdate = Collections.<Long, Long>emptyMap();
+ protected Map<Long, Long> membersBeforeGroupUpdate = Collections.<Long, Long>emptyMap();
/**
* Allows easy subclassing for the ConnId AD connector bundle.
@@ -115,10 +115,9 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
}
/**
- * Keep track of members of the role being updated <b>before</b> actual update takes place. This is not needed on
- * <ul> <li>beforeProvision() - because the synchronizing role does not exist yet on Syncope</li> <li>beforeDelete()
- * -
- * because role delete cascades as membership removal for all users involved</li> </ul>
+ * Keep track of members of the group being updated <b>before</b> actual update takes place. This is not needed on
+ * <ul> <li>beforeProvision() - because the synchronizing group does not exist yet on Syncope</li>
+ * <li>beforeDelete() - because group delete cascades as membership removal for all users involved</li> </ul>
*
* {@inheritDoc}
*/
@@ -127,15 +126,15 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
final ProvisioningProfile<?, ?> profile,
final SyncDelta delta, final T subject, final K subjectMod) throws JobExecutionException {
- if (subject instanceof RoleTO) {
- // search for all users assigned to given role
- Role role = roleDAO.find(subject.getKey());
- if (role != null) {
- List<Membership> membs = roleDAO.findMemberships(role);
- // save memberships before role update takes place
- membersBeforeRoleUpdate = new HashMap<>(membs.size());
+ if (subject instanceof GroupTO) {
+ // search for all users assigned to given group
+ Group group = groupDAO.find(subject.getKey());
+ if (group != null) {
+ List<Membership> membs = groupDAO.findMemberships(group);
+ // save memberships before group update takes place
+ membersBeforeGroupUpdate = new HashMap<>(membs.size());
for (Membership memb : membs) {
- membersBeforeRoleUpdate.put(memb.getUser().getKey(), memb.getKey());
+ membersBeforeGroupUpdate.put(memb.getUser().getKey(), memb.getKey());
}
}
}
@@ -144,22 +143,22 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
}
/**
- * Build UserMod for adding membership to given user, for given role.
+ * Build UserMod for adding membership to given user, for given group.
*
- * @param userKey user to be assigned membership to given role
- * @param roleTO role for adding membership
+ * @param userKey user to be assigned membership to given group
+ * @param groupTO group for adding membership
* @return UserMod for user update
*/
- protected UserMod getUserMod(final Long userKey, final RoleTO roleTO) {
+ protected UserMod getUserMod(final Long userKey, final GroupTO groupTO) {
UserMod userMod = new UserMod();
- // no actual modification takes place when user has already the role assigned
- if (membersBeforeRoleUpdate.containsKey(userKey)) {
- membersBeforeRoleUpdate.remove(userKey);
+ // no actual modification takes place when user has already the group assigned
+ if (membersBeforeGroupUpdate.containsKey(userKey)) {
+ membersBeforeGroupUpdate.remove(userKey);
} else {
userMod.setKey(userKey);
MembershipMod membershipMod = new MembershipMod();
- membershipMod.setRole(roleTO.getKey());
+ membershipMod.setGroup(groupTO.getKey());
userMod.getMembershipsToAdd().add(membershipMod);
}
@@ -170,7 +169,7 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
* Read values of attribute returned by getGroupMembershipAttrName(); if not present in the given delta, perform an
* additional read on the underlying connector.
*
- * @param delta representing the synchronizing role
+ * @param delta representing the synchronizing group
* @param connector associated to the current resource
* @return value of attribute returned by
* {@link #getGroupMembershipAttrName(org.apache.syncope.core.propagation.Connector) }
@@ -195,7 +194,7 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
}
/**
- * Perform actual modifications (i.e. membership add / remove) for the given role on the given resource.
+ * Perform actual modifications (i.e. membership add / remove) for the given group on the given resource.
*
* @param userMod modifications to perform on the user
* @param resourceName resource to be propagated for changes
@@ -252,12 +251,12 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
* Synchronize Syncope memberships with the situation read on the external resource's group.
*
* @param profile sync profile
- * @param delta representing the synchronizing role
- * @param roleTO role after modification performed by the handler
+ * @param delta representing the synchronizing group
+ * @param groupTO group after modification performed by the handler
* @throws JobExecutionException if anything goes wrong
*/
protected void synchronizeMemberships(
- final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final RoleTO roleTO) throws
+ final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final GroupTO groupTO) throws
JobExecutionException {
final ProvisioningTask task = profile.getTask();
@@ -271,13 +270,13 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
profile.getTask().getResource(),
profile.getConnector());
if (userKey != null) {
- UserMod userMod = getUserMod(userKey, roleTO);
+ UserMod userMod = getUserMod(userKey, groupTO);
userUpdate(userMod, resource.getKey());
}
}
- // finally remove any residual membership that was present before role update but not any more
- for (Map.Entry<Long, Long> member : membersBeforeRoleUpdate.entrySet()) {
+ // finally remove any residual membership that was present before group update but not any more
+ for (Map.Entry<Long, Long> member : membersBeforeGroupUpdate.entrySet()) {
UserMod userMod = new UserMod();
userMod.setKey(member.getKey());
userMod.getMembershipsToRemove().add(member.getValue());
@@ -286,7 +285,7 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
}
/**
- * Synchronize membership at role synchronization time (because SyncJob first synchronize users then roles).
+ * Synchronize membership at group synchronization time (because SyncJob first synchronize users then groups).
* {@inheritDoc}
*/
@Override
@@ -300,10 +299,10 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
return;
}
- if (!(subject instanceof RoleTO) || profile.getTask().getResource().getUmapping() == null) {
+ if (!(subject instanceof GroupTO) || profile.getTask().getResource().getUmapping() == null) {
super.after(profile, delta, subject, result);
} else {
- synchronizeMemberships(profile, delta, (RoleTO) subject);
+ synchronizeMemberships(profile, delta, (GroupTO) subject);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PushJobImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PushJobImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PushJobImpl.java
index 90c2ffd..5716eb7 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PushJobImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PushJobImpl.java
@@ -23,13 +23,13 @@ import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.entity.role.RMapping;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.GMapping;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.PushTask;
import org.apache.syncope.core.persistence.api.entity.user.UMapping;
import org.apache.syncope.core.persistence.api.entity.user.User;
@@ -39,7 +39,7 @@ import org.apache.syncope.core.provisioning.api.sync.PushActions;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.misc.search.SearchCondConverter;
import org.apache.syncope.core.provisioning.api.job.PushJob;
-import org.apache.syncope.core.provisioning.api.sync.RolePushResultHandler;
+import org.apache.syncope.core.provisioning.api.sync.GroupPushResultHandler;
import org.apache.syncope.core.provisioning.api.sync.UserPushResultHandler;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
@@ -67,10 +67,10 @@ public class PushJobImpl extends AbstractProvisioningJob<PushTask, PushActions>
private SubjectSearchDAO searchDAO;
/**
- * Role DAO.
+ * Group DAO.
*/
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
private final int PAGE_SIZE = 1000;
@@ -79,11 +79,11 @@ public class PushJobImpl extends AbstractProvisioningJob<PushTask, PushActions>
final PushTask pushTask,
final Connector connector,
final UMapping uMapping,
- final RMapping rMapping,
+ final GMapping rMapping,
final boolean dryRun) throws JobExecutionException {
LOG.debug("Execute synchronization (push) with resource {}", pushTask.getResource());
- final Set<Long> authorizations = RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll());
+ final Set<Long> authorizations = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
final ProvisioningProfile<PushTask, PushActions> profile = new ProvisioningProfile<>(connector, pushTask);
if (actions != null) {
@@ -97,9 +97,9 @@ public class PushJobImpl extends AbstractProvisioningJob<PushTask, PushActions>
createBean(UserPushResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
uhandler.setProfile(profile);
- final RolePushResultHandler rhandler =
- (RolePushResultHandler) ApplicationContextProvider.getApplicationContext().getBeanFactory().
- createBean(RolePushResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
+ final GroupPushResultHandler rhandler =
+ (GroupPushResultHandler) ApplicationContextProvider.getApplicationContext().getBeanFactory().
+ createBean(GroupPushResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
rhandler.setProfile(profile);
if (actions != null && !profile.isDryRun()) {
@@ -126,15 +126,15 @@ public class PushJobImpl extends AbstractProvisioningJob<PushTask, PushActions>
}
if (rMapping != null) {
- final List<Role> localRoles = getRoles(authorizations, pushTask);
+ final List<Group> localGroups = geGroups(authorizations, pushTask);
- for (Role localRole : localRoles) {
+ for (Group localGroup : localGroups) {
try {
- // role propagation
- rhandler.handle(localRole.getKey());
+ // group propagation
+ rhandler.handle(localGroup.getKey());
} catch (Exception e) {
- LOG.warn("Failure pushing role '{}' on '{}'", localRole, pushTask.getResource(), e);
- throw new JobExecutionException("While pushing roles on connector", e);
+ LOG.warn("Failure pushing group '{}' on '{}'", localGroup, pushTask.getResource(), e);
+ throw new JobExecutionException("While pushing groups on connector", e);
}
}
}
@@ -163,14 +163,13 @@ public class PushJobImpl extends AbstractProvisioningJob<PushTask, PushActions>
}
}
- private List<Role> getRoles(final Set<Long> authorizations, final PushTask pushTask) {
- final String filter = pushTask.getRoleFilter();
+ private List<Group> geGroups(final Set<Long> authorizations, final PushTask pushTask) {
+ final String filter = pushTask.getGroupFilter();
if (StringUtils.isBlank(filter)) {
- return roleDAO.findAll();
+ return groupDAO.findAll();
} else {
- return searchDAO.<Role>search(
- authorizations, SearchCondConverter.convert(filter),
- Collections.<OrderByClause>emptyList(), SubjectType.ROLE);
+ return searchDAO.<Group>search(authorizations, SearchCondConverter.convert(filter),
+ Collections.<OrderByClause>emptyList(), SubjectType.GROUP);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/RolePushResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/RolePushResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/RolePushResultHandlerImpl.java
deleted file mode 100644
index c160556..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/RolePushResultHandlerImpl.java
+++ /dev/null
@@ -1,162 +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.provisioning.java.sync;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.AbstractSubjectTO;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.Mapping;
-import org.apache.syncope.core.persistence.api.entity.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.Subject;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.provisioning.api.TimeoutException;
-import org.apache.syncope.core.provisioning.api.sync.RolePushResultHandler;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.Uid;
-
-public class RolePushResultHandlerImpl extends AbstractPushResultHandler implements RolePushResultHandler {
-
- @Override
- protected AttributableUtil getAttributableUtil() {
- return attrUtilFactory.getInstance(AttributableType.ROLE);
- }
-
- @Override
- protected Subject<?, ?, ?> deprovision(final Subject<?, ?, ?> sbj) {
- final RoleTO before = roleTransfer.getRoleTO(Role.class.cast(sbj));
-
- final List<String> noPropResources = new ArrayList<>(before.getResources());
- noPropResources.remove(profile.getTask().getResource().getKey());
-
- taskExecutor.execute(propagationManager.getRoleDeleteTaskIds(before.getKey(), noPropResources));
-
- return roleDAO.authFetch(before.getKey());
- }
-
- @Override
- protected Subject<?, ?, ?> provision(final Subject<?, ?, ?> sbj, final Boolean enabled) {
- final RoleTO before = roleTransfer.getRoleTO(Role.class.cast(sbj));
-
- final List<String> noPropResources = new ArrayList<>(before.getResources());
- noPropResources.remove(profile.getTask().getResource().getKey());
-
- final PropagationByResource propByRes = new PropagationByResource();
- propByRes.add(ResourceOperation.CREATE, profile.getTask().getResource().getKey());
-
- taskExecutor.execute(propagationManager.getRoleCreateTaskIds(
- before.getKey(),
- Collections.unmodifiableCollection(before.getVirAttrs()),
- propByRes,
- noPropResources));
-
- return roleDAO.authFetch(before.getKey());
- }
-
- @Override
- protected Subject<?, ?, ?> link(final Subject<?, ?, ?> sbj, final Boolean unlink) {
- final RoleMod roleMod = new RoleMod();
- roleMod.setKey(sbj.getKey());
-
- if (unlink) {
- roleMod.getResourcesToRemove().add(profile.getTask().getResource().getKey());
- } else {
- roleMod.getResourcesToAdd().add(profile.getTask().getResource().getKey());
- }
-
- rwfAdapter.update(roleMod);
-
- return roleDAO.authFetch(sbj.getKey());
- }
-
- @Override
- protected Subject<?, ?, ?> unassign(final Subject<?, ?, ?> sbj) {
- final RoleMod roleMod = new RoleMod();
- roleMod.setKey(sbj.getKey());
- roleMod.getResourcesToRemove().add(profile.getTask().getResource().getKey());
- rwfAdapter.update(roleMod);
- return deprovision(sbj);
- }
-
- @Override
- protected Subject<?, ?, ?> assign(final Subject<?, ?, ?> sbj, final Boolean enabled) {
- final RoleMod roleMod = new RoleMod();
- roleMod.setKey(sbj.getKey());
- roleMod.getResourcesToAdd().add(profile.getTask().getResource().getKey());
- rwfAdapter.update(roleMod);
- return provision(sbj, enabled);
- }
-
- @Override
- protected String getName(final Subject<?, ?, ?> subject) {
- return Role.class.cast(subject).getName();
- }
-
- @Override
- protected AbstractSubjectTO getSubjectTO(final long key) {
- try {
- return roleTransfer.getRoleTO(key);
- } catch (Exception e) {
- LOG.warn("Error retrieving user {}", key, e);
- return null;
- }
- }
-
- @Override
- protected Subject<?, ?, ?> getSubject(final long key) {
- try {
- return roleDAO.authFetch(key);
- } catch (Exception e) {
- LOG.warn("Error retrieving role {}", key, e);
- return null;
- }
- }
-
- @Override
- protected ConnectorObject getRemoteObject(final String accountId) {
- ConnectorObject obj = null;
-
- try {
- final Uid uid = new Uid(accountId);
-
- obj = profile.getConnector().getObject(
- ObjectClass.GROUP,
- uid,
- profile.getConnector().getOperationOptions(Collections.<MappingItem>emptySet()));
- } catch (TimeoutException toe) {
- LOG.debug("Request timeout", toe);
- throw toe;
- } catch (RuntimeException ignore) {
- LOG.debug("While resolving {}", accountId, ignore);
- }
- return obj;
- }
-
- @Override
- protected Mapping<?> getMapping() {
- return profile.getTask().getResource().getRmapping();
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/RoleSyncResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/RoleSyncResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/RoleSyncResultHandlerImpl.java
deleted file mode 100644
index 4bfbe70..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/RoleSyncResultHandlerImpl.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.provisioning.java.sync;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.common.lib.mod.AbstractSubjectMod;
-import org.apache.syncope.common.lib.mod.AttrMod;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.mod.UserMod;
-import org.apache.syncope.common.lib.to.AbstractSubjectTO;
-import org.apache.syncope.common.lib.to.PropagationStatus;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
-import org.apache.syncope.core.provisioning.api.sync.RoleSyncResultHandler;
-import org.identityconnectors.framework.common.objects.SyncDelta;
-
-public class RoleSyncResultHandlerImpl extends AbstractSyncResultHandler implements RoleSyncResultHandler {
-
- protected Map<Long, String> roleOwnerMap = new HashMap<>();
-
- @Override
- public Map<Long, String> getRoleOwnerMap() {
- return this.roleOwnerMap;
- }
-
- @Override
- protected AttributableUtil getAttributableUtil() {
- return attrUtilFactory.getInstance(AttributableType.ROLE);
- }
-
- @Override
- protected String getName(final AbstractSubjectTO subjectTO) {
- return RoleTO.class.cast(subjectTO).getName();
- }
-
- @Override
- protected AbstractSubjectTO getSubjectTO(final long key) {
- try {
- return roleTransfer.getRoleTO(key);
- } catch (Exception e) {
- LOG.warn("Error retrieving role {}", key, e);
- return null;
- }
- }
-
- @Override
- protected AbstractSubjectMod getSubjectMod(
- final AbstractSubjectTO subjectTO, final SyncDelta delta) {
-
- return connObjectUtil.getAttributableMod(
- subjectTO.getKey(),
- delta.getObject(),
- subjectTO,
- profile.getTask(),
- attrUtilFactory.getInstance(AttributableType.ROLE));
- }
-
- @Override
- protected AbstractSubjectTO create(
- final AbstractSubjectTO subjectTO, final SyncDelta _delta, final ProvisioningResult result) {
-
- RoleTO roleTO = RoleTO.class.cast(subjectTO);
-
- Map.Entry<Long, List<PropagationStatus>> created = roleProvisioningManager.create(roleTO, roleOwnerMap,
- Collections.singleton(profile.getTask().getResource().getKey()));
-
- roleTO = roleTransfer.getRoleTO(created.getKey());
-
- result.setId(created.getKey());
- result.setName(getName(subjectTO));
-
- return roleTO;
- }
-
- @Override
- protected AbstractSubjectTO link(
- final AbstractSubjectTO before,
- final ProvisioningResult result,
- final boolean unlink) {
-
- final RoleMod roleMod = new RoleMod();
- roleMod.setKey(before.getKey());
-
- if (unlink) {
- roleMod.getResourcesToRemove().add(profile.getTask().getResource().getKey());
- } else {
- roleMod.getResourcesToAdd().add(profile.getTask().getResource().getKey());
- }
-
- return roleTransfer.getRoleTO(rwfAdapter.update(roleMod).getResult());
- }
-
- @Override
- protected AbstractSubjectTO update(
- final AbstractSubjectTO before,
- final AbstractSubjectMod subjectMod,
- final SyncDelta delta,
- final ProvisioningResult result) {
-
- RoleMod roleMod = RoleMod.class.cast(subjectMod);
-
- Map.Entry<Long, List<PropagationStatus>> updated = roleProvisioningManager.update(roleMod);
-
- //moved after role provisioning manager
- String roleOwner = null;
- for (AttrMod attrMod : roleMod.getPlainAttrsToUpdate()) {
- if (attrMod.getSchema().isEmpty()) {
- roleOwner = attrMod.getValuesToBeAdded().iterator().next();
- }
- }
- if (roleOwner != null) {
- roleOwnerMap.put(updated.getKey(), roleOwner);
- }
-
- final RoleTO after = roleTransfer.getRoleTO(updated.getKey());
-
- result.setName(getName(after));
-
- return after;
- }
-
- @Override
- protected void deprovision(final Long id, final boolean unlink) {
-
- taskExecutor.execute(
- propagationManager.getRoleDeleteTaskIds(id, profile.getTask().getResource().getKey()));
-
- if (unlink) {
- final UserMod userMod = new UserMod();
- userMod.setKey(id);
- userMod.getResourcesToRemove().add(profile.getTask().getResource().getKey());
- }
- }
-
- @Override
- protected void delete(final Long id) {
- try {
- taskExecutor.execute(
- propagationManager.getRoleDeleteTaskIds(id, profile.getTask().getResource().getKey()));
- } catch (Exception e) {
- // A propagation failure doesn't imply a synchronization failure.
- // The propagation exception status will be reported into the propagation task execution.
- LOG.error("Could not propagate user " + id, e);
- }
-
- roleProvisioningManager.delete(id);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobImpl.java
index a786b94..9b49d6a 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobImpl.java
@@ -21,24 +21,24 @@ package org.apache.syncope.core.provisioning.java.sync;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.mod.ReferenceMod;
-import org.apache.syncope.common.lib.mod.RoleMod;
+import org.apache.syncope.common.lib.mod.GroupMod;
import org.apache.syncope.common.lib.types.SyncPolicySpec;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
-import org.apache.syncope.core.persistence.api.entity.role.RMapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMapping;
import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
import org.apache.syncope.core.persistence.api.entity.user.UMapping;
import org.apache.syncope.core.provisioning.api.Connector;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningProfile;
import org.apache.syncope.core.provisioning.api.sync.SyncActions;
-import org.apache.syncope.core.misc.security.UnauthorizedRoleException;
+import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.provisioning.api.job.SyncJob;
-import org.apache.syncope.core.provisioning.api.sync.RoleSyncResultHandler;
+import org.apache.syncope.core.provisioning.api.sync.GroupSyncResultHandler;
import org.apache.syncope.core.provisioning.api.sync.UserSyncResultHandler;
-import org.apache.syncope.core.workflow.api.RoleWorkflowAdapter;
+import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
import org.identityconnectors.framework.common.objects.ObjectClass;
import org.identityconnectors.framework.common.objects.SyncToken;
import org.quartz.JobExecutionException;
@@ -54,24 +54,24 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
public class SyncJobImpl extends AbstractProvisioningJob<SyncTask, SyncActions> implements SyncJob {
/**
- * Role workflow adapter.
+ * Group workflow adapter.
*/
@Autowired
- private RoleWorkflowAdapter rwfAdapter;
+ private GroupWorkflowAdapter gwfAdapter;
@Autowired
protected SyncUtilities syncUtilities;
- protected void setRoleOwners(final RoleSyncResultHandler rhandler)
- throws UnauthorizedRoleException, NotFoundException {
+ protected void setGroupOwners(final GroupSyncResultHandler rhandler)
+ throws UnauthorizedGroupException, NotFoundException {
- for (Map.Entry<Long, String> entry : rhandler.getRoleOwnerMap().entrySet()) {
- RoleMod roleMod = new RoleMod();
- roleMod.setKey(entry.getKey());
+ for (Map.Entry<Long, String> entry : rhandler.getGroupOwnerMap().entrySet()) {
+ GroupMod groupMod = new GroupMod();
+ groupMod.setKey(entry.getKey());
if (StringUtils.isBlank(entry.getValue())) {
- roleMod.setRoleOwner(null);
- roleMod.setUserOwner(null);
+ groupMod.setGroupOwner(null);
+ groupMod.setUserOwner(null);
} else {
Long userId = syncUtilities.findMatchingAttributableKey(
ObjectClass.ACCOUNT,
@@ -80,21 +80,21 @@ public class SyncJobImpl extends AbstractProvisioningJob<SyncTask, SyncActions>
rhandler.getProfile().getConnector());
if (userId == null) {
- Long roleId = syncUtilities.findMatchingAttributableKey(
+ Long groupId = syncUtilities.findMatchingAttributableKey(
ObjectClass.GROUP,
entry.getValue(),
rhandler.getProfile().getTask().getResource(),
rhandler.getProfile().getConnector());
- if (roleId != null) {
- roleMod.setRoleOwner(new ReferenceMod(roleId));
+ if (groupId != null) {
+ groupMod.setGroupOwner(new ReferenceMod(groupId));
}
} else {
- roleMod.setUserOwner(new ReferenceMod(userId));
+ groupMod.setUserOwner(new ReferenceMod(userId));
}
}
- rwfAdapter.update(roleMod);
+ gwfAdapter.update(groupMod);
}
}
@@ -103,7 +103,7 @@ public class SyncJobImpl extends AbstractProvisioningJob<SyncTask, SyncActions>
final SyncTask syncTask,
final Connector connector,
final UMapping uMapping,
- final RMapping rMapping,
+ final GMapping rMapping,
final boolean dryRun) throws JobExecutionException {
LOG.debug("Execute synchronization with token {}", syncTask.getResource().getUsyncToken());
@@ -121,10 +121,10 @@ public class SyncJobImpl extends AbstractProvisioningJob<SyncTask, SyncActions>
createBean(UserSyncResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
uhandler.setProfile(profile);
- // Prepare handler for SyncDelta objects (roles/groups)
- final RoleSyncResultHandler rhandler =
- (RoleSyncResultHandler) ApplicationContextProvider.getApplicationContext().getBeanFactory().
- createBean(RoleSyncResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
+ // Prepare handler for SyncDelta objects (groups)
+ final GroupSyncResultHandler rhandler =
+ (GroupSyncResultHandler) ApplicationContextProvider.getApplicationContext().getBeanFactory().
+ createBean(GroupSyncResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
rhandler.setProfile(profile);
if (actions != null && !profile.isDryRun()) {
@@ -182,9 +182,9 @@ public class SyncJobImpl extends AbstractProvisioningJob<SyncTask, SyncActions>
}
try {
- setRoleOwners(rhandler);
+ setGroupOwners(rhandler);
} catch (Exception e) {
- LOG.error("While setting role owners", e);
+ LOG.error("While setting group owners", e);
}
if (actions != null && !profile.isDryRun()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtilities.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtilities.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtilities.java
index 1a3bf13..7f89474 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtilities.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtilities.java
@@ -28,12 +28,12 @@ import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.SubjectType;
import org.apache.syncope.common.lib.types.SyncPolicySpec;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
@@ -49,7 +49,7 @@ import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.Subject;
import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
@@ -102,10 +102,10 @@ public class SyncUtilities {
protected UserDAO userDAO;
/**
- * Role DAO.
+ * Group DAO.
*/
@Autowired
- protected RoleDAO roleDAO;
+ protected GroupDAO groupDAO;
/**
* Search DAO.
@@ -158,7 +158,7 @@ public class SyncUtilities {
}
private SubjectDAO<?, ?, ?> getSubjectDAO(final MappingItem accountIdItem) {
- return AttributableType.USER == accountIdItem.getIntMappingType().getAttributableType() ? userDAO : roleDAO;
+ return AttributableType.USER == accountIdItem.getIntMappingType().getAttributableType() ? userDAO : groupDAO;
}
private List<Long> findByAccountIdItem(
@@ -168,7 +168,7 @@ public class SyncUtilities {
final MappingItem accountIdItem = attrUtil.getAccountIdItem(resource);
switch (accountIdItem.getIntMappingType()) {
case UserPlainSchema:
- case RolePlainSchema:
+ case GroupPlainSchema:
final PlainAttrValue value = attrUtil.newPlainAttrValue();
PlainSchema schema = plainSchemaDAO.find(accountIdItem.getIntAttrName(), attrUtil.plainSchemaClass());
@@ -191,7 +191,7 @@ public class SyncUtilities {
break;
case UserDerivedSchema:
- case RoleDerivedSchema:
+ case GroupDerivedSchema:
subjects = getSubjectDAO(accountIdItem).
findByDerAttrValue(accountIdItem.getIntAttrName(), uid, attrUtil);
for (Subject<?, ?, ?> subject : subjects) {
@@ -213,17 +213,17 @@ public class SyncUtilities {
}
break;
- case RoleName:
- List<Role> roles = roleDAO.find(uid);
- for (Role role : roles) {
- result.add(role.getKey());
+ case GroupName:
+ List<Group> groups = groupDAO.find(uid);
+ for (Group group : groups) {
+ result.add(group.getKey());
}
break;
- case RoleId:
- Role role = roleDAO.find(Long.parseLong(uid));
- if (role != null) {
- result.add(role.getKey());
+ case GroupId:
+ Group group = groupDAO.find(Long.parseLong(uid));
+ if (group != null) {
+ result.add(group.getKey());
}
break;
@@ -237,8 +237,7 @@ public class SyncUtilities {
private List<Long> search(final SearchCond searchCond, final SubjectType type) {
final List<Long> result = new ArrayList<>();
- List<Subject<?, ?, ?>> subjects = searchDAO.search(
- RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
+ List<Subject<?, ?, ?>> subjects = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
searchCond, Collections.<OrderByClause>emptyList(), type);
for (Subject<?, ?, ?> subject : subjects) {
result.add(subject.getKey());
@@ -266,7 +265,7 @@ public class SyncUtilities {
extValues.put(item.getIntAttrName(), connObj.getAttributeByName(item.getExtAttrName()));
}
- // search for user/role by attribute(s) specified in the policy
+ // search for user/group by attribute(s) specified in the policy
SearchCond searchCond = null;
for (String schema : altSearchSchemas) {
@@ -293,7 +292,7 @@ public class SyncUtilities {
SearchCond nodeCond;
// users: just id or username can be selected to be used
- // roles: just id or name can be selected to be used
+ // groups: just id or name can be selected to be used
if ("key".equalsIgnoreCase(schema)
|| "username".equalsIgnoreCase(schema) || "name".equalsIgnoreCase(schema)) {
@@ -327,8 +326,8 @@ public class SyncUtilities {
case USER:
clazz = policySpec.getUserJavaRule();
break;
- case ROLE:
- clazz = policySpec.getRoleJavaRule();
+ case GROUP:
+ clazz = policySpec.getGroupJavaRule();
break;
case MEMBERSHIP:
case CONFIGURATION:
@@ -356,7 +355,7 @@ public class SyncUtilities {
case USER:
result = policySpec.getuAltSearchSchemas();
break;
- case ROLE:
+ case GROUP:
result = policySpec.getrAltSearchSchemas();
break;
case MEMBERSHIP:
@@ -368,13 +367,13 @@ public class SyncUtilities {
}
/**
- * Find users / roles based on mapped uid value (or previous uid value, if updated).
+ * Find users / groups based on mapped uid value (or previous uid value, if updated).
*
* @param uid for finding by account id
* @param connObj for finding by attribute value
* @param resource external resource
* @param attrUtil attributable util
- * @return list of matching users / roles
+ * @return list of matching users / groups
*/
public List<Long> findExisting(
final String uid,
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/resources/mailTemplates/optin.html.vm
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/resources/mailTemplates/optin.html.vm b/core/provisioning-java/src/main/resources/mailTemplates/optin.html.vm
index 8240c7b..3f36035 100644
--- a/core/provisioning-java/src/main/resources/mailTemplates/optin.html.vm
+++ b/core/provisioning-java/src/main/resources/mailTemplates/optin.html.vm
@@ -43,10 +43,10 @@ because one of the following events occurred:
</p>
#if(!$user.getMemberships().isEmpty())
-You have been provided with the following roles:
+You have been provided with the following groups:
<ul>
#foreach($membership in $user.getMemberships())
- <li>$membership.roleName</i>
+ <li>$membership.groupName</i>
#end
</ul>
#end
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/resources/mailTemplates/optin.txt.vm
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/resources/mailTemplates/optin.txt.vm b/core/provisioning-java/src/main/resources/mailTemplates/optin.txt.vm
index fc8e398..c2b211e 100644
--- a/core/provisioning-java/src/main/resources/mailTemplates/optin.txt.vm
+++ b/core/provisioning-java/src/main/resources/mailTemplates/optin.txt.vm
@@ -31,9 +31,9 @@ because one of the following events occurred:
#end
#if(!$user.getMemberships().isEmpty())
-You have been provided with the following roles:
+You have been provided with the following groups:
#foreach($membership in $user.getMemberships())
- * $membership.roleName
+ * $membership.groupName
#end
#end
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/resources/provisioning.properties b/core/provisioning-java/src/main/resources/provisioning.properties
index af5deee..4b87d44 100644
--- a/core/provisioning-java/src/main/resources/provisioning.properties
+++ b/core/provisioning-java/src/main/resources/provisioning.properties
@@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
-roleProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultRoleProvisioningManager
+groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/resources/provisioningContext.xml
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/resources/provisioningContext.xml b/core/provisioning-java/src/main/resources/provisioningContext.xml
index fa31a73..f7d9d4e 100644
--- a/core/provisioning-java/src/main/resources/provisioningContext.xml
+++ b/core/provisioning-java/src/main/resources/provisioningContext.xml
@@ -32,7 +32,7 @@ under the License.
<task:executor id="connectorExecutor" pool-size="10"/>
<bean class="${userProvisioningManager}"/>
- <bean class="${roleProvisioningManager}"/>
+ <bean class="${groupProvisioningManager}"/>
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
lazy-init="false" depends-on="nonJPAdbInitializer">
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
index dbfb327..3b4369c 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
@@ -42,7 +42,7 @@ import org.apache.syncope.common.lib.to.ErrorTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.core.misc.security.UnauthorizedRoleException;
+import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
import org.apache.syncope.core.persistence.api.dao.DuplicateException;
@@ -88,8 +88,8 @@ public class RestServiceExceptionMapper implements ExceptionMapper<Exception>, R
} else if (ex instanceof AccessDeniedException) {
builder = Response.status(Response.Status.UNAUTHORIZED).
header(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM_UNAUTHORIZED);
- } else if (ex instanceof UnauthorizedRoleException) {
- builder = builder(Response.Status.UNAUTHORIZED, ClientExceptionType.UnauthorizedRole, getExMessage(ex));
+ } else if (ex instanceof UnauthorizedGroupException) {
+ builder = builder(Response.Status.UNAUTHORIZED, ClientExceptionType.UnauthorizedGroup, getExMessage(ex));
} else if (ex instanceof EntityExistsException || ex instanceof DuplicateException) {
builder = builder(Response.Status.CONFLICT, ClientExceptionType.EntityExists, getExMessage(ex));
} else if (ex instanceof DataIntegrityViolationException) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
new file mode 100644
index 0000000..5c334a9
--- /dev/null
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
@@ -0,0 +1,227 @@
+/*
+ * 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 java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.BulkAction;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
+import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
+import org.apache.syncope.common.lib.wrap.ResourceName;
+import org.apache.syncope.common.rest.api.CollectionWrapper;
+import org.apache.syncope.common.rest.api.service.GroupService;
+import org.apache.syncope.core.logic.GroupLogic;
+import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class GroupServiceImpl extends AbstractServiceImpl implements GroupService {
+
+ @Autowired
+ private GroupLogic logic;
+
+ @Override
+ public List<GroupTO> children(final Long groupKey) {
+ return logic.children(groupKey);
+ }
+
+ @Override
+ public Response create(final GroupTO groupTO) {
+ GroupTO created = logic.create(groupTO);
+ return createResponse(created.getKey(), created);
+ }
+
+ @Override
+ public Response delete(final Long groupKey) {
+ GroupTO group = logic.read(groupKey);
+
+ checkETag(group.getETagValue());
+
+ GroupTO deleted = logic.delete(groupKey);
+ return modificationResponse(deleted);
+ }
+
+ @Override
+ public PagedResult<GroupTO> list() {
+ return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
+ }
+
+ @Override
+ public PagedResult<GroupTO> list(final String orderBy) {
+ return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
+ }
+
+ @Override
+ public PagedResult<GroupTO> list(final Integer page, final Integer size) {
+ return list(page, size, null);
+ }
+
+ @Override
+ public PagedResult<GroupTO> list(final Integer page, final Integer size, final String orderBy) {
+ List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
+ return buildPagedResult(logic.list(page, size, orderByClauses), page, size, logic.count());
+ }
+
+ @Override
+ public GroupTO parent(final Long groupKey) {
+ return logic.parent(groupKey);
+ }
+
+ @Override
+ public GroupTO read(final Long groupKey) {
+ return logic.read(groupKey);
+ }
+
+ @Override
+ public PagedResult<GroupTO> search(final String fiql) {
+ return search(fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
+ }
+
+ @Override
+ public PagedResult<GroupTO> search(final String fiql, final String orderBy) {
+ return search(fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
+ }
+
+ @Override
+ public PagedResult<GroupTO> search(final String fiql, final Integer page, final Integer size) {
+ return search(fiql, page, size, null);
+ }
+
+ @Override
+ public PagedResult<GroupTO> search(final String fiql, final Integer page, final Integer size, final String orderBy) {
+ SearchCond cond = getSearchCond(fiql);
+ List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
+ return buildPagedResult(
+ logic.search(cond, page, size, orderByClauses), page, size, logic.searchCount(cond));
+ }
+
+ @Override
+ public GroupTO readSelf(final Long groupKey) {
+ return logic.readSelf(groupKey);
+ }
+
+ @Override
+ public Response update(final Long groupKey, final GroupMod groupMod) {
+ GroupTO group = logic.read(groupKey);
+
+ checkETag(group.getETagValue());
+
+ groupMod.setKey(groupKey);
+ GroupTO updated = logic.update(groupMod);
+ return modificationResponse(updated);
+ }
+
+ @Override
+ public Response bulkDeassociation(
+ final Long groupKey, final ResourceDeassociationActionType type, final List<ResourceName> resourceNames) {
+
+ GroupTO group = logic.read(groupKey);
+
+ checkETag(group.getETagValue());
+
+ GroupTO updated;
+ switch (type) {
+ case UNLINK:
+ updated = logic.unlink(groupKey, CollectionWrapper.unwrap(resourceNames));
+ break;
+
+ case UNASSIGN:
+ updated = logic.unassign(groupKey, CollectionWrapper.unwrap(resourceNames));
+ break;
+
+ case DEPROVISION:
+ updated = logic.deprovision(groupKey, CollectionWrapper.unwrap(resourceNames));
+ break;
+
+ default:
+ updated = logic.read(groupKey);
+ }
+
+ final BulkActionResult res = new BulkActionResult();
+
+ if (type == ResourceDeassociationActionType.UNLINK) {
+ for (ResourceName resourceName : resourceNames) {
+ res.add(resourceName.getElement(), updated.getResources().contains(resourceName.getElement())
+ ? BulkActionResult.Status.FAILURE
+ : BulkActionResult.Status.SUCCESS);
+ }
+ } else {
+ for (PropagationStatus propagationStatusTO : updated.getPropagationStatusTOs()) {
+ res.add(propagationStatusTO.getResource(), propagationStatusTO.getStatus().toString());
+ }
+ }
+
+ return modificationResponse(res);
+ }
+
+ @Override
+ public Response bulkAssociation(
+ final Long groupKey, final ResourceAssociationActionType type, final List<ResourceName> resourceNames) {
+
+ GroupTO group = logic.read(groupKey);
+
+ checkETag(group.getETagValue());
+
+ GroupTO updated;
+ switch (type) {
+ case LINK:
+ updated = logic.link(groupKey, CollectionWrapper.unwrap(resourceNames));
+ break;
+
+ case ASSIGN:
+ updated = logic.assign(groupKey, CollectionWrapper.unwrap(resourceNames), false, null);
+ break;
+
+ case PROVISION:
+ updated = logic.provision(groupKey, CollectionWrapper.unwrap(resourceNames), false, null);
+ break;
+
+ default:
+ updated = logic.read(groupKey);
+ }
+
+ final BulkActionResult res = new BulkActionResult();
+
+ if (type == ResourceAssociationActionType.LINK) {
+ for (ResourceName resourceName : resourceNames) {
+ res.add(resourceName.getElement(), updated.getResources().contains(resourceName.getElement())
+ ? BulkActionResult.Status.FAILURE
+ : BulkActionResult.Status.SUCCESS);
+ }
+ } else {
+ for (PropagationStatus propagationStatusTO : updated.getPropagationStatusTOs()) {
+ res.add(propagationStatusTO.getResource(), propagationStatusTO.getStatus().toString());
+ }
+ }
+
+ return modificationResponse(res);
+ }
+
+ @Override
+ public BulkActionResult bulk(final BulkAction bulkAction) {
+ return logic.bulk(bulkAction);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
index 1feee38..63bb632 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
@@ -35,7 +35,7 @@ import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.ResourceService;
import org.apache.syncope.core.logic.AbstractResourceAssociator;
import org.apache.syncope.core.logic.ResourceLogic;
-import org.apache.syncope.core.logic.RoleLogic;
+import org.apache.syncope.core.logic.GroupLogic;
import org.apache.syncope.core.logic.UserLogic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -50,7 +50,7 @@ public class ResourceServiceImpl extends AbstractServiceImpl implements Resource
private UserLogic userLogic;
@Autowired
- private RoleLogic roleLogic;
+ private GroupLogic groupLogic;
@Override
public Response create(final ResourceTO resourceTO) {
@@ -103,7 +103,7 @@ public class ResourceServiceImpl extends AbstractServiceImpl implements Resource
AbstractResourceAssociator<? extends AbstractAttributableTO> associator = subjectType == SubjectType.USER
? userLogic
- : roleLogic;
+ : groupLogic;
final BulkActionResult res = new BulkActionResult();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RoleServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RoleServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RoleServiceImpl.java
deleted file mode 100644
index b42fc2f..0000000
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RoleServiceImpl.java
+++ /dev/null
@@ -1,227 +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 java.util.List;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
-import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.lib.to.PropagationStatus;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
-import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
-import org.apache.syncope.common.lib.wrap.ResourceName;
-import org.apache.syncope.common.rest.api.CollectionWrapper;
-import org.apache.syncope.common.rest.api.service.RoleService;
-import org.apache.syncope.core.logic.RoleLogic;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class RoleServiceImpl extends AbstractServiceImpl implements RoleService {
-
- @Autowired
- private RoleLogic logic;
-
- @Override
- public List<RoleTO> children(final Long roleKey) {
- return logic.children(roleKey);
- }
-
- @Override
- public Response create(final RoleTO roleTO) {
- RoleTO created = logic.create(roleTO);
- return createResponse(created.getKey(), created);
- }
-
- @Override
- public Response delete(final Long roleKey) {
- RoleTO role = logic.read(roleKey);
-
- checkETag(role.getETagValue());
-
- RoleTO deleted = logic.delete(roleKey);
- return modificationResponse(deleted);
- }
-
- @Override
- public PagedResult<RoleTO> list() {
- return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
- }
-
- @Override
- public PagedResult<RoleTO> list(final String orderBy) {
- return list(DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
- }
-
- @Override
- public PagedResult<RoleTO> list(final Integer page, final Integer size) {
- return list(page, size, null);
- }
-
- @Override
- public PagedResult<RoleTO> list(final Integer page, final Integer size, final String orderBy) {
- List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
- return buildPagedResult(logic.list(page, size, orderByClauses), page, size, logic.count());
- }
-
- @Override
- public RoleTO parent(final Long roleKey) {
- return logic.parent(roleKey);
- }
-
- @Override
- public RoleTO read(final Long roleKey) {
- return logic.read(roleKey);
- }
-
- @Override
- public PagedResult<RoleTO> search(final String fiql) {
- return search(fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, null);
- }
-
- @Override
- public PagedResult<RoleTO> search(final String fiql, final String orderBy) {
- return search(fiql, DEFAULT_PARAM_PAGE_VALUE, DEFAULT_PARAM_SIZE_VALUE, orderBy);
- }
-
- @Override
- public PagedResult<RoleTO> search(final String fiql, final Integer page, final Integer size) {
- return search(fiql, page, size, null);
- }
-
- @Override
- public PagedResult<RoleTO> search(final String fiql, final Integer page, final Integer size, final String orderBy) {
- SearchCond cond = getSearchCond(fiql);
- List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
- return buildPagedResult(
- logic.search(cond, page, size, orderByClauses), page, size, logic.searchCount(cond));
- }
-
- @Override
- public RoleTO readSelf(final Long roleKey) {
- return logic.readSelf(roleKey);
- }
-
- @Override
- public Response update(final Long roleKey, final RoleMod roleMod) {
- RoleTO role = logic.read(roleKey);
-
- checkETag(role.getETagValue());
-
- roleMod.setKey(roleKey);
- RoleTO updated = logic.update(roleMod);
- return modificationResponse(updated);
- }
-
- @Override
- public Response bulkDeassociation(
- final Long roleKey, final ResourceDeassociationActionType type, final List<ResourceName> resourceNames) {
-
- RoleTO role = logic.read(roleKey);
-
- checkETag(role.getETagValue());
-
- RoleTO updated;
- switch (type) {
- case UNLINK:
- updated = logic.unlink(roleKey, CollectionWrapper.unwrap(resourceNames));
- break;
-
- case UNASSIGN:
- updated = logic.unassign(roleKey, CollectionWrapper.unwrap(resourceNames));
- break;
-
- case DEPROVISION:
- updated = logic.deprovision(roleKey, CollectionWrapper.unwrap(resourceNames));
- break;
-
- default:
- updated = logic.read(roleKey);
- }
-
- final BulkActionResult res = new BulkActionResult();
-
- if (type == ResourceDeassociationActionType.UNLINK) {
- for (ResourceName resourceName : resourceNames) {
- res.add(resourceName.getElement(), updated.getResources().contains(resourceName.getElement())
- ? BulkActionResult.Status.FAILURE
- : BulkActionResult.Status.SUCCESS);
- }
- } else {
- for (PropagationStatus propagationStatusTO : updated.getPropagationStatusTOs()) {
- res.add(propagationStatusTO.getResource(), propagationStatusTO.getStatus().toString());
- }
- }
-
- return modificationResponse(res);
- }
-
- @Override
- public Response bulkAssociation(
- final Long roleKey, final ResourceAssociationActionType type, final List<ResourceName> resourceNames) {
-
- RoleTO role = logic.read(roleKey);
-
- checkETag(role.getETagValue());
-
- RoleTO updated;
- switch (type) {
- case LINK:
- updated = logic.link(roleKey, CollectionWrapper.unwrap(resourceNames));
- break;
-
- case ASSIGN:
- updated = logic.assign(roleKey, CollectionWrapper.unwrap(resourceNames), false, null);
- break;
-
- case PROVISION:
- updated = logic.provision(roleKey, CollectionWrapper.unwrap(resourceNames), false, null);
- break;
-
- default:
- updated = logic.read(roleKey);
- }
-
- final BulkActionResult res = new BulkActionResult();
-
- if (type == ResourceAssociationActionType.LINK) {
- for (ResourceName resourceName : resourceNames) {
- res.add(resourceName.getElement(), updated.getResources().contains(resourceName.getElement())
- ? BulkActionResult.Status.FAILURE
- : BulkActionResult.Status.SUCCESS);
- }
- } else {
- for (PropagationStatus propagationStatusTO : updated.getPropagationStatusTOs()) {
- res.add(propagationStatusTO.getResource(), propagationStatusTO.getStatus().toString());
- }
- }
-
- return modificationResponse(res);
- }
-
- @Override
- public BulkActionResult bulk(final BulkAction bulkAction) {
- return logic.bulk(bulkAction);
- }
-}
[32/57] syncope git commit: More replacements thanks to
commons-collections
Posted by il...@apache.org.
More replacements thanks to commons-collections
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/bac03b25
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/bac03b25
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/bac03b25
Branch: refs/heads/master
Commit: bac03b2569644991e26d2879da2eda47bf9debb9
Parents: 091c735
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Apr 8 10:00:38 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Apr 8 10:00:38 2015 +0200
----------------------------------------------------------------------
.../syncope/core/logic/NotificationTest.java | 14 ++---
.../syncope/core/misc/CollectionUtils2.java | 61 ++++++++++++++++++++
.../persistence/api/GroupEntitlementUtil.java | 14 +++--
.../validation/InvalidEntityException.java | 15 ++---
.../jpa/entity/AbstractPlainAttr.java | 2 +-
.../api/cache/VirAttrCacheValue.java | 3 +-
.../api/propagation/PropagationManager.java | 3 +-
.../provisioning/java/AsyncConnectorFacade.java | 4 +-
.../java/DefaultGroupProvisioningManager.java | 9 +--
.../java/DefaultUserProvisioningManager.java | 18 +++---
.../java/cache/DisabledVirAttrCache.java | 2 +-
.../data/AbstractAttributableDataBinder.java | 4 +-
.../notification/NotificationManagerImpl.java | 19 +++---
.../DBPasswordPropagationActions.java | 28 ++++-----
.../LDAPMembershipPropagationActions.java | 4 +-
.../LDAPPasswordPropagationActions.java | 27 +++++----
.../propagation/PropagationManagerImpl.java | 47 +++++++--------
.../java/sync/AbstractProvisioningJob.java | 13 +++--
.../java/sync/AbstractSyncResultHandler.java | 2 +-
.../java/sync/AbstractSyncopeResultHandler.java | 2 +
.../java/sync/DBPasswordSyncActions.java | 28 ++++-----
.../java/sync/LDAPMembershipSyncActions.java | 31 +++++-----
.../java/sync/LDAPPasswordSyncActions.java | 2 +-
23 files changed, 213 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
----------------------------------------------------------------------
diff --git a/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java b/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
index fdf4d11..4555189 100644
--- a/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
+++ b/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
@@ -256,7 +256,7 @@ public class NotificationTest {
public void notifyByMail() throws Exception {
// 1. create suitable notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
+ notification.getEvents().add("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query());
notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
@@ -314,7 +314,7 @@ public class NotificationTest {
public void issueSYNCOPE192() throws Exception {
// 1. create suitable notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
+ notification.getEvents().add("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query());
notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
@@ -366,7 +366,7 @@ public class NotificationTest {
public void notifyByMailEmptyAbout() throws Exception {
// 1. create suitable notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
+ notification.getEvents().add("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
notification.setUserAbout(null);
notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
@@ -416,7 +416,7 @@ public class NotificationTest {
public void notifyByMailWithRetry() throws Exception {
// 1. create suitable notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
+ notification.getEvents().add("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
notification.setUserAbout(null);
notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
@@ -485,7 +485,7 @@ public class NotificationTest {
public void issueSYNCOPE445() throws Exception {
// 1. create suitable notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
+ notification.getEvents().add("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query());
notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
@@ -544,7 +544,7 @@ public class NotificationTest {
public void issueSYNCOPE492() throws Exception {
// 1. create suitable disabled notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
+ notification.getEvents().add("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query());
notification.setSelfAsRecipient(true);
@@ -588,7 +588,7 @@ public class NotificationTest {
// 1. create suitable notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("[REST]:[GroupLogic]:[]:[create]:[SUCCESS]");
+ notification.getEvents().add("[REST]:[GroupLogic]:[]:[create]:[SUCCESS]");
notification.setGroupAbout(new GroupFiqlSearchConditionBuilder().is("name").equalTo("group446").query());
notification.setSelfAsRecipient(false);
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/misc/src/main/java/org/apache/syncope/core/misc/CollectionUtils2.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/CollectionUtils2.java b/core/misc/src/main/java/org/apache/syncope/core/misc/CollectionUtils2.java
new file mode 100644
index 0000000..44ddc5c
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/CollectionUtils2.java
@@ -0,0 +1,61 @@
+/*
+ * 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.misc;
+
+import java.util.Iterator;
+
+public final class CollectionUtils2 {
+
+ /**
+ * Returns the next element in <tt>iterator</tt> or <tt>defaultValue</tt> if the iterator is empty.
+ *
+ * @param defaultValue the default value to return if the iterator is empty
+ * @return the next element of <tt>iterator</tt> or the default value
+ */
+ public static <T> T getNext(final Iterator<? extends T> iterator, final T defaultValue) {
+ return iterator.hasNext() ? iterator.next() : defaultValue;
+ }
+
+ /**
+ * Returns the first element in <tt>iterable</tt> or <tt>defaultValue</tt> if the iterable is empty.
+ *
+ * <p/>
+ * If no default value is desired (and the caller instead wants a {@link java.util.NoSuchElementException} to be
+ * thrown), it is recommended that <tt>iterable.iterator().next()}</tt> is used instead.
+ *
+ * @param defaultValue the default value to return if the iterable is empty
+ * @return the first element of <tt>iterable</tt> or the default value
+ */
+ public static <T> T getFirst(final Iterable<? extends T> iterable, final T defaultValue) {
+ return getNext(iterable.iterator(), defaultValue);
+ }
+
+ /**
+ * Returns the first element in <tt>iterable</tt> or <tt>null</tt> if the iterable is empty.
+ *
+ * @return the first element of <tt>iterable</tt> or <tt>null</tt>
+ */
+ public static <T> T getFirstOrNull(final Iterable<? extends T> iterable) {
+ return getNext(iterable.iterator(), null);
+ }
+
+ private CollectionUtils2() {
+ // private constructor for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java
index b0f104a..723dfe1 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java
@@ -22,6 +22,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.core.persistence.api.entity.Entitlement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,11 +75,13 @@ public final class GroupEntitlementUtil {
}
public static Set<Long> getGroupKeys(final List<Entitlement> entitlements) {
- Set<String> names = new HashSet<>(entitlements.size());
- for (Entitlement entitlement : entitlements) {
- names.add(entitlement.getKey());
- }
- return GroupEntitlementUtil.getGroupKeys(names);
+ return getGroupKeys(CollectionUtils.collect(entitlements, new Transformer<Entitlement, String>() {
+
+ @Override
+ public String transform(final Entitlement entitlement) {
+ return entitlement.getKey();
+ }
+ }, new HashSet<String>()));
}
/**
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java
index 818fb61..97f1a58 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java
@@ -24,6 +24,8 @@ import java.util.Map;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.ValidationException;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.types.EntityViolationType;
/**
@@ -97,14 +99,13 @@ public class InvalidEntityException extends ValidationException {
}
public final boolean hasViolation(final EntityViolationType type) {
- boolean found = false;
- for (Class<?> entity : violations.keySet()) {
- if (violations.get(entity).contains(type)) {
- found = true;
- }
- }
+ return CollectionUtils.exists(violations.keySet(), new Predicate<Class<?>>() {
- return found;
+ @Override
+ public boolean evaluate(final Class<?> entity) {
+ return violations.get(entity).contains(type);
+ }
+ });
}
public String getEntityClassSimpleName() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
index 2db17f0..aa7af95 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
@@ -80,7 +80,7 @@ public abstract class AbstractPlainAttr extends AbstractEntity<Long> implements
result = Collections.singletonList(getUniqueValue().getValueAsString());
}
- return result;
+ return Collections.unmodifiableList(result);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheValue.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheValue.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheValue.java
index 0db95ac..3288432 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheValue.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheValue.java
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.core.provisioning.api.cache;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -73,7 +74,7 @@ public class VirAttrCacheValue {
res.addAll(value);
}
- return res;
+ return Collections.unmodifiableSet(res);
}
public Date getLastAccessDate() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
index 277dfc9..895e0dc 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
@@ -207,6 +207,7 @@ public interface PropagationManager {
* the creation fails onto a mandatory resource.
*
* @param userKey to be deleted
+ * @param resourceNames resources
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
*/
@@ -231,7 +232,7 @@ public interface PropagationManager {
* @param noPropResourceNames external resource names not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getUserUpdateTaskIds(User user, Boolean enable, Set<String> noPropResourceNames);
+ List<PropagationTask> getUserUpdateTaskIds(User user, Boolean enable, Collection<String> noPropResourceNames);
/**
* Performs update on each resource associated to the user.
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java
index 416c8c0..ae2d297 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java
@@ -154,7 +154,7 @@ public class AsyncConnectorFacade {
@Async
public Future<Set<String>> getSchemaNames(final ConnectorFacade connector, final boolean includeSpecial) {
- final Set<String> schemaNames = new HashSet<String>();
+ final Set<String> schemaNames = new HashSet<>();
try {
final Schema schema = connector.schema();
@@ -175,7 +175,7 @@ public class AsyncConnectorFacade {
@Async
public Future<Set<ObjectClass>> getSupportedObjectClasses(final ConnectorFacade connector) {
- final Set<ObjectClass> objectClasses = new HashSet<ObjectClass>();
+ final Set<ObjectClass> objectClasses = new HashSet<>();
try {
final Schema schema = connector.schema();
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
index 7dc3366..2adbdd0 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
@@ -26,6 +26,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -74,7 +75,8 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO subject, final Set<String> excludedResources) {
WorkflowResult<Long> created = gwfAdapter.create(subject);
- AuthContextUtil.extendAuthContext(created.getResult(), GroupEntitlementUtil.getEntitlementNameFromGroupKey(created.getResult()));
+ AuthContextUtil.extendAuthContext(created.getResult(), GroupEntitlementUtil.getEntitlementNameFromGroupKey(
+ created.getResult()));
List<PropagationTask> tasks =
propagationManager.getGroupCreateTaskIds(created, subject.getVirAttrs(), excludedResources);
@@ -100,7 +102,7 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
groupOwnerMap.put(created.getResult(), groupOwner.getValues().iterator().next());
}
- AuthContextUtil.extendAuthContext(created.getResult(),
+ AuthContextUtil.extendAuthContext(created.getResult(),
GroupEntitlementUtil.getEntitlementNameFromGroupKey(created.getResult()));
List<PropagationTask> tasks = propagationManager.getGroupCreateTaskIds(
@@ -198,8 +200,7 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
public List<PropagationStatus> deprovision(final Long groupKey, final Collection<String> resources) {
Group group = groupDAO.authFetch(groupKey);
- Set<String> noPropResourceName = group.getResourceNames();
- noPropResourceName.removeAll(resources);
+ Collection<String> noPropResourceName = CollectionUtils.removeAll(group.getResourceNames(), resources);
List<PropagationTask> tasks = propagationManager.getGroupDeleteTaskIds(
groupKey, new HashSet<>(resources), noPropResourceName);
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
index c9fbe0f..4eb425f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
@@ -25,6 +25,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
@@ -234,11 +235,11 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
}
protected List<PropagationStatus> propagateStatus(final User user, final StatusMod statusMod) {
- Set<String> resourcesToBeExcluded = new HashSet<>(user.getResourceNames());
- resourcesToBeExcluded.removeAll(statusMod.getResourceNames());
+ Collection<String> noPropResourceNames =
+ CollectionUtils.removeAll(user.getResourceNames(), statusMod.getResourceNames());
List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
- user, statusMod.getType() != StatusMod.ModType.SUSPEND, resourcesToBeExcluded);
+ user, statusMod.getType() != StatusMod.ModType.SUSPEND, noPropResourceNames);
PropagationReporter propReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
@@ -274,11 +275,10 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
public List<PropagationStatus> deprovision(final Long userKey, final Collection<String> resources) {
final User user = userDAO.authFetch(userKey);
- final Set<String> noPropResourceName = user.getResourceNames();
- noPropResourceName.removeAll(resources);
+ Collection<String> noPropResourceNames = CollectionUtils.removeAll(user.getResourceNames(), resources);
final List<PropagationTask> tasks =
- propagationManager.getUserDeleteTaskIds(userKey, new HashSet<>(resources), noPropResourceName);
+ propagationManager.getUserDeleteTaskIds(userKey, new HashSet<>(resources), noPropResourceNames);
final PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
@@ -330,12 +330,10 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
}
}
- PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
- getBean(PropagationReporter.class);
-
List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
updated, updated.getResult().getKey().getPassword() != null, excludedResources);
-
+ PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
+ getBean(PropagationReporter.class);
try {
taskExecutor.execute(tasks, propagationReporter);
} catch (PropagationException e) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/DisabledVirAttrCache.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/DisabledVirAttrCache.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/DisabledVirAttrCache.java
index d1e0dda..3c3dcca 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/DisabledVirAttrCache.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/DisabledVirAttrCache.java
@@ -38,7 +38,7 @@ public class DisabledVirAttrCache implements VirAttrCache {
}
@Override
- public boolean isValidEntry(VirAttrCacheValue value) {
+ public boolean isValidEntry(final VirAttrCacheValue value) {
return false;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
index a33e062..2c94b8b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
@@ -166,7 +166,6 @@ abstract class AbstractAttributableDataBinder {
schema = plainSchemaDAO.find(schemaName, reference);
// safely ignore invalid schemas from AttrTO
- // see http://code.google.com/p/syncope/issues/detail?id=17
if (schema == null) {
LOG.debug("Ignoring invalid schema {}", schemaName);
} else if (schema.isReadonly()) {
@@ -753,8 +752,7 @@ abstract class AbstractAttributableDataBinder {
if ((type == AttributableType.USER && resource.getUmapping() != null)
|| (type == AttributableType.GROUP && resource.getGmapping() != null)) {
- MappingItem accountIdItem =
- attrUtilFactory.getInstance(type).getAccountIdItem(resource);
+ MappingItem accountIdItem = attrUtilFactory.getInstance(type).getAccountIdItem(resource);
if (accountIdItem == null) {
throw new NotFoundException(
"AccountId mapping for " + type + " " + subject.getKey()
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
index 169ac88..dac783b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
@@ -36,6 +36,7 @@ import org.apache.syncope.common.lib.types.AuditElements.Result;
import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.core.misc.CollectionUtils2;
import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.ConfDAO;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
@@ -347,15 +348,8 @@ public class NotificationManagerImpl implements NotificationManager {
case UserPlainSchema:
UPlainAttr attr = user.getPlainAttr(recipientAttrName);
- if (attr != null && !attr.getValuesAsStrings().isEmpty()) {
- email = attr.getValuesAsStrings().get(0);
- }
- break;
-
- case UserVirtualSchema:
- UVirAttr virAttr = user.getVirAttr(recipientAttrName);
- if (virAttr != null && !virAttr.getValues().isEmpty()) {
- email = virAttr.getValues().get(0);
+ if (attr != null) {
+ email = CollectionUtils2.getFirstOrNull(attr.getValuesAsStrings());
}
break;
@@ -366,6 +360,13 @@ public class NotificationManagerImpl implements NotificationManager {
}
break;
+ case UserVirtualSchema:
+ UVirAttr virAttr = user.getVirAttr(recipientAttrName);
+ if (virAttr != null) {
+ email = CollectionUtils2.getFirstOrNull(virAttr.getValues());
+ }
+ break;
+
default:
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DBPasswordPropagationActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DBPasswordPropagationActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DBPasswordPropagationActions.java
index fd4b3dc..1e75acb 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DBPasswordPropagationActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DBPasswordPropagationActions.java
@@ -19,8 +19,9 @@
package org.apache.syncope.core.provisioning.java.propagation;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.common.lib.types.ConnConfProperty;
@@ -85,22 +86,23 @@ public class DBPasswordPropagationActions extends DefaultPropagationActions {
}
}
- private String getCipherAlgorithm(ConnInstance connInstance) {
- String cipherAlgorithm = CLEARTEXT;
- for (Iterator<ConnConfProperty> propertyIterator = connInstance.getConfiguration().iterator();
- propertyIterator.hasNext();) {
+ private String getCipherAlgorithm(final ConnInstance connInstance) {
+ ConnConfProperty cipherAlgorithm =
+ CollectionUtils.find(connInstance.getConfiguration(), new Predicate<ConnConfProperty>() {
- ConnConfProperty property = propertyIterator.next();
- if ("cipherAlgorithm".equals(property.getSchema().getName())
- && property.getValues() != null && !property.getValues().isEmpty()) {
+ @Override
+ public boolean evaluate(final ConnConfProperty property) {
+ return "cipherAlgorithm".equals(property.getSchema().getName())
+ && property.getValues() != null && !property.getValues().isEmpty();
+ }
+ });
- return (String) property.getValues().get(0);
- }
- }
- return cipherAlgorithm;
+ return cipherAlgorithm == null
+ ? CLEARTEXT
+ : (String) cipherAlgorithm.getValues().get(0);
}
- private boolean cipherAlgorithmMatches(String connectorAlgorithm, CipherAlgorithm userAlgorithm) {
+ private boolean cipherAlgorithmMatches(final String connectorAlgorithm, final CipherAlgorithm userAlgorithm) {
if (userAlgorithm == null) {
return false;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
index 0bd204f..f62aca0 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
@@ -92,9 +92,9 @@ public class LDAPMembershipPropagationActions extends DefaultPropagationActions
}
LOG.debug("Group accountLinks to propagate for membership: {}", groupAccountLinks);
- Set<Attribute> attributes = new HashSet<Attribute>(task.getAttributes());
+ Set<Attribute> attributes = new HashSet<>(task.getAttributes());
- Set<String> groups = new HashSet<String>(groupAccountLinks);
+ Set<String> groups = new HashSet<>(groupAccountLinks);
Attribute ldapGroups = AttributeUtil.find(getGroupMembershipAttrName(), attributes);
if (ldapGroups != null) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPPasswordPropagationActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPPasswordPropagationActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPPasswordPropagationActions.java
index fc1b00c..37ce2fa 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPPasswordPropagationActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPPasswordPropagationActions.java
@@ -19,8 +19,9 @@
package org.apache.syncope.core.provisioning.java.propagation;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.common.lib.types.ConnConfProperty;
@@ -91,18 +92,20 @@ public class LDAPPasswordPropagationActions extends DefaultPropagationActions {
}
}
- private String getCipherAlgorithm(ConnInstance connInstance) {
- String cipherAlgorithm = CLEARTEXT;
- for (Iterator<ConnConfProperty> propertyIterator = connInstance.getConfiguration().iterator();
- propertyIterator.hasNext();) {
+ private String getCipherAlgorithm(final ConnInstance connInstance) {
+ ConnConfProperty cipherAlgorithm =
+ CollectionUtils.find(connInstance.getConfiguration(), new Predicate<ConnConfProperty>() {
- ConnConfProperty property = propertyIterator.next();
- if ("passwordHashAlgorithm".equals(property.getSchema().getName())
- && property.getValues() != null && !property.getValues().isEmpty()) {
- return (String) property.getValues().get(0);
- }
- }
- return cipherAlgorithm;
+ @Override
+ public boolean evaluate(final ConnConfProperty property) {
+ return "passwordHashAlgorithm".equals(property.getSchema().getName())
+ && property.getValues() != null && !property.getValues().isEmpty();
+ }
+ });
+
+ return cipherAlgorithm == null
+ ? CLEARTEXT
+ : (String) cipherAlgorithm.getValues().get(0);
}
private boolean cipherAlgorithmMatches(String connectorAlgorithm, CipherAlgorithm userAlgorithm) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
index 3108368..122261f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
@@ -26,6 +26,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.mod.AttrMod;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.UserMod;
@@ -173,10 +175,15 @@ public class PropagationManagerImpl implements PropagationManager {
virAttrHandler.fillVirtual(user, vAttrs, attrUtilFactory.getInstance(AttributableType.USER));
}
- for (Membership membership : user.getMemberships()) {
- MembershipTO membershipTO;
+ for (final Membership membership : user.getMemberships()) {
if (membership.getVirAttrs() != null && !membership.getVirAttrs().isEmpty()) {
- membershipTO = findMembershipTO(membership, membershipTOs);
+ MembershipTO membershipTO = CollectionUtils.find(membershipTOs, new Predicate<MembershipTO>() {
+
+ @Override
+ public boolean evaluate(final MembershipTO membershipTO) {
+ return membershipTO.getGroupId() == membership.getGroup().getKey();
+ }
+ });
if (membershipTO != null) {
virAttrHandler.fillVirtual(membership,
membershipTO.getVirAttrs(), attrUtilFactory.getInstance(AttributableType.MEMBERSHIP));
@@ -276,7 +283,7 @@ public class PropagationManagerImpl implements PropagationManager {
*/
@Override
public List<PropagationTask> getUserUpdateTaskIds(final User user, final Boolean enable,
- final Set<String> noPropResourceNames) throws NotFoundException {
+ final Collection<String> noPropResourceNames) throws NotFoundException {
return getUpdateTaskIds(
user, // user to be updated on external resources
@@ -385,6 +392,7 @@ public class PropagationManagerImpl implements PropagationManager {
* @throws NotFoundException if group is not found
* @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
*/
+ @Override
public List<PropagationTask> getGroupUpdateTaskIds(final WorkflowResult<Long> wfResult,
final Set<String> vAttrsToBeRemoved, final Set<AttrMod> vAttrsToBeUpdated,
final Set<String> noPropResourceNames)
@@ -413,9 +421,16 @@ public class PropagationManagerImpl implements PropagationManager {
// SYNCOPE-458 fill membership virtual attributes
if (subject instanceof User) {
final User user = (User) subject;
- for (Membership membership : user.getMemberships()) {
+ for (final Membership membership : user.getMemberships()) {
if (membership.getVirAttrs() != null && !membership.getVirAttrs().isEmpty()) {
- final MembershipMod membershipMod = findMembershipMod(membership, membershipsToAdd);
+ final MembershipMod membershipMod = CollectionUtils.find(membershipsToAdd,
+ new Predicate<MembershipMod>() {
+
+ @Override
+ public boolean evaluate(final MembershipMod membershipMod) {
+ return membershipMod.getGroup() == membership.getGroup().getKey();
+ }
+ });
if (membershipMod != null) {
virAttrHandler.fillVirtual(membership, membershipMod.getVirAttrsToRemove() == null
? Collections.<String>emptySet()
@@ -750,24 +765,4 @@ public class PropagationManagerImpl implements PropagationManager {
return tasks;
}
-
- protected MembershipTO findMembershipTO(final Membership membership, final Collection<MembershipTO> memberships) {
- for (MembershipTO membershipTO : memberships) {
- if (membershipTO.getGroupId() == membership.getGroup().getKey()) {
- return membershipTO;
- }
- }
- LOG.error("No MembershipTO found for membership {}", membership);
- return null;
- }
-
- protected MembershipMod findMembershipMod(final Membership membership, final Set<MembershipMod> membershipMods) {
- for (MembershipMod membershipMod : membershipMods) {
- if (membershipMod.getGroup() == membership.getGroup().getKey()) {
- return membershipMod;
- }
- }
- LOG.error("No MembershipMod found for membership {}", membership);
- return null;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
index 197d4d5..0920146 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
@@ -22,6 +22,8 @@ import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.types.TraceLevel;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
@@ -315,11 +317,14 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
@Override
protected String doExecute(final boolean dryRun) throws JobExecutionException {
// PRE: grant all authorities (i.e. setup the SecurityContextHolder)
- final List<GrantedAuthority> authorities = new ArrayList<>();
+ List<GrantedAuthority> authorities = new ArrayList<>();
+ CollectionUtils.collect(entitlementDAO.findAll(), new Transformer<Entitlement, GrantedAuthority>() {
- for (Entitlement entitlement : entitlementDAO.findAll()) {
- authorities.add(new SimpleGrantedAuthority(entitlement.getKey()));
- }
+ @Override
+ public GrantedAuthority transform(final Entitlement entitlement) {
+ return new SimpleGrantedAuthority(entitlement.getKey());
+ }
+ }, authorities);
final UserDetails userDetails = new User("admin", "FAKE_PASSWORD", true, true, true, true, authorities);
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
index 5b9b3a7..3067ca5 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
@@ -513,7 +513,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
LOG.debug("Subject to ignore {}", delta.getObject().getUid().getUidValue());
- final List<ProvisioningResult> ignoreResults = new ArrayList<ProvisioningResult>();
+ final List<ProvisioningResult> ignoreResults = new ArrayList<>();
final ProvisioningResult result = new ProvisioningResult();
result.setId(null);
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
index cb1890b..ec33571 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
@@ -116,10 +116,12 @@ public abstract class AbstractSyncopeResultHandler<T extends ProvisioningTask, A
*/
protected ProvisioningProfile<T, A> profile;
+ @Override
public void setProfile(final ProvisioningProfile<T, A> profile) {
this.profile = profile;
}
+ @Override
public ProvisioningProfile<T, A> getProfile() {
return profile;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
index 75f2078..2b3ca02 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
@@ -18,7 +18,8 @@
*/
package org.apache.syncope.core.provisioning.java.sync;
-import java.util.Iterator;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.mod.AbstractSubjectMod;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.AbstractSubjectTO;
@@ -105,18 +106,19 @@ public class DBPasswordSyncActions extends DefaultSyncActions {
}
private String getCipherAlgorithm(final ConnInstance connInstance) {
- String cipherAlgorithm = CLEARTEXT;
- for (Iterator<ConnConfProperty> propertyIterator = connInstance.getConfiguration().iterator();
- propertyIterator.hasNext();) {
-
- ConnConfProperty property = propertyIterator.next();
- if ("cipherAlgorithm".equals(property.getSchema().getName())
- && property.getValues() != null && !property.getValues().isEmpty()) {
-
- return (String) property.getValues().get(0);
- }
- }
- return cipherAlgorithm;
+ ConnConfProperty cipherAlgorithm =
+ CollectionUtils.find(connInstance.getConfiguration(), new Predicate<ConnConfProperty>() {
+
+ @Override
+ public boolean evaluate(final ConnConfProperty property) {
+ return "cipherAlgorithm".equals(property.getSchema().getName())
+ && property.getValues() != null && !property.getValues().isEmpty();
+ }
+ });
+
+ return cipherAlgorithm == null
+ ? CLEARTEXT
+ : (String) cipherAlgorithm.getValues().get(0);
}
@Transactional(readOnly = true)
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
index 736cb3f..526b494 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
@@ -20,9 +20,10 @@ package org.apache.syncope.core.provisioning.java.sync;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.mod.AbstractSubjectMod;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.UserMod;
@@ -32,7 +33,6 @@ import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.AuditElements.Result;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
import org.apache.syncope.core.persistence.api.entity.group.Group;
@@ -98,20 +98,19 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
* @return the name of the attribute used to keep track of group memberships
*/
protected String getGroupMembershipAttrName(final Connector connector) {
- ConnInstance connInstance = connector.getActiveConnInstance();
- Iterator<ConnConfProperty> propertyIterator = connInstance.getConfiguration().iterator();
- String groupMembershipName = "uniquemember";
- while (propertyIterator.hasNext()) {
- ConnConfProperty property = propertyIterator.next();
- if ("groupMemberAttribute".equals(property.getSchema().getName())
- && property.getValues() != null && !property.getValues().isEmpty()) {
-
- groupMembershipName = (String) property.getValues().get(0);
- break;
- }
- }
-
- return groupMembershipName;
+ ConnConfProperty groupMembership = CollectionUtils.find(connector.getActiveConnInstance().getConfiguration(),
+ new Predicate<ConnConfProperty>() {
+
+ @Override
+ public boolean evaluate(final ConnConfProperty property) {
+ return "groupMemberAttribute".equals(property.getSchema().getName())
+ && property.getValues() != null && !property.getValues().isEmpty();
+ }
+ });
+
+ return groupMembership == null
+ ? "uniquemember"
+ : (String) groupMembership.getValues().get(0);
}
/**
http://git-wip-us.apache.org/repos/asf/syncope/blob/bac03b25/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPPasswordSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPPasswordSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPPasswordSyncActions.java
index 16cd796..fe1a8aa 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPPasswordSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPPasswordSyncActions.java
@@ -82,7 +82,7 @@ public class LDAPPasswordSyncActions extends DefaultSyncActions {
return delta;
}
- private void parseEncodedPassword(String password) {
+ private void parseEncodedPassword(final String password) {
if (password != null && password.startsWith("{")) {
int closingBracketIndex = password.indexOf('}');
String digest = password.substring(1, password.indexOf('}'));
[24/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDetailsPanel.java
deleted file mode 100644
index 03d2e75..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDetailsPanel.java
+++ /dev/null
@@ -1,435 +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 org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.JexlHelpUtil;
-import org.apache.syncope.client.console.pages.RoleSelectModalPage;
-import org.apache.syncope.client.console.pages.UserOwnerSelectModalPage;
-import org.apache.syncope.client.console.panels.AttrTemplatesPanel.RoleAttrTemplatesChange;
-import org.apache.syncope.client.console.panels.AttrTemplatesPanel.Type;
-import org.apache.syncope.client.console.rest.RoleRestClient;
-import org.apache.syncope.client.console.rest.UserRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.wicket.Page;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RoleDetailsPanel extends Panel {
-
- private static final long serialVersionUID = 855618618337931784L;
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(RoleDetailsPanel.class);
-
- @SpringBean
- private UserRestClient userRestClient;
-
- @SpringBean
- private RoleRestClient roleRestClient;
-
- private final Fragment parentFragment;
-
- private final WebMarkupContainer ownerContainer;
-
- private final OwnerModel userOwnerModel;
-
- private final OwnerModel roleOwnerModel;
-
- private ParentModel parentModel;
-
- public RoleDetailsPanel(final String id, final RoleTO roleTO, final boolean templateMode) {
- super(id);
-
- ownerContainer = new WebMarkupContainer("ownerContainer");
- ownerContainer.setOutputMarkupId(true);
- this.add(ownerContainer);
-
- final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin");
- userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal");
- this.add(userOwnerSelectWin);
- final ModalWindow roleOwnerSelectWin = new ModalWindow("roleOwnerSelectWin");
- roleOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- roleOwnerSelectWin.setCookieName("create-roleOwnerSelect-modal");
- this.add(roleOwnerSelectWin);
- final ModalWindow parentSelectWin = new ModalWindow("parentSelectWin");
- parentSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- parentSelectWin.setCookieName("create-parentSelect-modal");
- this.add(parentSelectWin);
-
- if (templateMode) {
- parentFragment = new Fragment("parent", "parentFragment", this);
-
- parentModel = new ParentModel(roleTO);
- @SuppressWarnings("unchecked")
- final AjaxTextFieldPanel parent = new AjaxTextFieldPanel("parent", "parent", parentModel);
- parent.setReadOnly(true);
- parent.setOutputMarkupId(true);
- parentFragment.add(parent);
- final AjaxLink<Void> parentSelect = new IndicatingAjaxLink<Void>("parentSelect") {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- parentSelectWin.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin,
- ParentSelectPayload.class);
- }
- });
- parentSelectWin.show(target);
- }
- };
- parentFragment.add(parentSelect);
- final IndicatingAjaxLink<Void> parentReset = new IndicatingAjaxLink<Void>("parentReset") {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- parentModel.setObject(null);
- target.add(parent);
- }
- };
- parentFragment.add(parentReset);
- } else {
- parentFragment = new Fragment("parent", "emptyFragment", this);
- }
- parentFragment.setOutputMarkupId(true);
- this.add(parentFragment);
-
- final AjaxTextFieldPanel name =
- new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(roleTO, "key"));
-
- final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
-
- final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
- this.add(questionMarkJexlHelp);
- questionMarkJexlHelp.add(jexlHelp);
-
- if (!templateMode) {
- name.addRequiredLabel();
- questionMarkJexlHelp.setVisible(false);
- }
- this.add(name);
-
- userOwnerModel = new OwnerModel(roleTO, AttributableType.USER);
- @SuppressWarnings("unchecked")
- final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel);
- userOwner.setReadOnly(true);
- userOwner.setOutputMarkupId(true);
- ownerContainer.add(userOwner);
- final AjaxLink<Void> userOwnerSelect = new IndicatingAjaxLink<Void>("userOwnerSelect") {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- userOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin);
- }
- });
- userOwnerSelectWin.show(target);
- }
- };
- ownerContainer.add(userOwnerSelect);
- final IndicatingAjaxLink<Void> userOwnerReset = new IndicatingAjaxLink<Void>("userOwnerReset") {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- userOwnerModel.setObject(null);
- target.add(userOwner);
- }
- };
- ownerContainer.add(userOwnerReset);
-
- roleOwnerModel = new OwnerModel(roleTO, AttributableType.ROLE);
- @SuppressWarnings("unchecked")
- final AjaxTextFieldPanel roleOwner = new AjaxTextFieldPanel("roleOwner", "roleOwner", roleOwnerModel);
- roleOwner.setReadOnly(true);
- roleOwner.setOutputMarkupId(true);
- ownerContainer.add(roleOwner);
- final AjaxLink<Void> roleOwnerSelect = new IndicatingAjaxLink<Void>("roleOwnerSelect") {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- parentSelectWin.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin,
- RoleOwnerSelectPayload.class);
- }
- });
- parentSelectWin.show(target);
- }
- };
- ownerContainer.add(roleOwnerSelect);
- final IndicatingAjaxLink<Void> roleOwnerReset = new IndicatingAjaxLink<Void>("roleOwnerReset") {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- roleOwnerModel.setObject(null);
- target.add(roleOwner);
- }
- };
- ownerContainer.add(roleOwnerReset);
-
- final AjaxCheckBoxPanel inhOwner = new AjaxCheckBoxPanel("inheritOwner", "inheritOwner",
- new PropertyModel<Boolean>(roleTO, "inheritOwner"));
- this.add(inhOwner);
-
- final AjaxCheckBoxPanel inhTemplates = new AjaxCheckBoxPanel("inheritTemplates", "inheritTemplates",
- new PropertyModel<Boolean>(roleTO, "inheritTemplates"));
- inhTemplates.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
-
- private static final long serialVersionUID = -1107858522700306810L;
-
- @Override
- protected void onUpdate(final AjaxRequestTarget target) {
- send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rPlainAttrTemplates, target));
- send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rDerAttrTemplates, target));
- send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rVirAttrTemplates, target));
- }
- });
- this.add(inhTemplates);
- }
-
- /**
- * This is waiting for events from opened modal windows: first to get the selected user / role, then to update the
- * respective text panel.
- *
- * {@inheritDoc }
- */
- @Override
- public void onEvent(final IEvent<?> event) {
- super.onEvent(event);
-
- if (event.getPayload() instanceof ParentSelectPayload) {
- parentModel.setObject(((ParentSelectPayload) event.getPayload()).getRoleId());
- }
- if (event.getPayload() instanceof UserOwnerSelectPayload) {
- userOwnerModel.setObject(((UserOwnerSelectPayload) event.getPayload()).getUserId());
- }
- if (event.getPayload() instanceof RoleOwnerSelectPayload) {
- roleOwnerModel.setObject(((RoleOwnerSelectPayload) event.getPayload()).getRoleId());
- }
-
- if (event.getPayload() instanceof AjaxRequestTarget) {
- ((AjaxRequestTarget) event.getPayload()).add(parentFragment);
- ((AjaxRequestTarget) event.getPayload()).add(ownerContainer);
- }
- }
-
- private class OwnerModel implements IModel {
-
- private static final long serialVersionUID = -3865621970810102714L;
-
- private final RoleTO roleTO;
-
- private final AttributableType type;
-
- public OwnerModel(final RoleTO roleTO, final AttributableType type) {
- this.roleTO = roleTO;
- this.type = type;
- }
-
- @Override
- public Object getObject() {
- String object = null;
-
- switch (type) {
- case USER:
- if (roleTO.getUserOwner() != null) {
- UserTO user = null;
- try {
- user = userRestClient.read(roleTO.getUserOwner());
- } catch (Exception e) {
- LOG.warn("Could not find user with id {}, ignoring", roleTO.getUserOwner(), e);
- }
- if (user == null) {
- roleTO.setUserOwner(null);
- } else {
- object = user.getKey() + " " + user.getUsername();
- }
- }
- break;
-
- case ROLE:
- RoleTO role = null;
- if (roleTO.getRoleOwner() != null) {
- try {
- role = roleRestClient.read(roleTO.getRoleOwner());
- } catch (Exception e) {
- LOG.warn("Could not find role with id {}, ignoring", roleTO.getRoleOwner(), e);
- }
- if (role == null) {
- roleTO.setRoleOwner(null);
- } else {
- object = role.getDisplayName();
- }
- }
- break;
-
- case MEMBERSHIP:
- default:
- }
-
- return object;
- }
-
- @Override
- public void setObject(final Object object) {
- switch (type) {
- case USER:
- roleTO.setUserOwner((Long) object);
- break;
-
- case ROLE:
- roleTO.setRoleOwner((Long) object);
- break;
-
- case MEMBERSHIP:
- default:
- }
- }
-
- @Override
- public void detach() {
- // ignore
- }
- }
-
- private class ParentModel implements IModel {
-
- private static final long serialVersionUID = 1006546156848990721L;
-
- private final RoleTO roleTO;
-
- public ParentModel(final RoleTO roleTO) {
- this.roleTO = roleTO;
- }
-
- @Override
- public Object getObject() {
- Object object = null;
- if (roleTO.getParent() != 0) {
- RoleTO parent = null;
- try {
- parent = roleRestClient.read(roleTO.getParent());
- } catch (Exception e) {
- LOG.warn("Could not find role with id {}, ignoring", roleTO.getParent(), e);
- }
- if (parent == null) {
- roleTO.setParent(0);
- } else {
- object = parent.getDisplayName();
- }
- }
- return object;
- }
-
- @Override
- public void setObject(final Object object) {
- roleTO.setParent((object instanceof Long) ? ((Long) object) : 0);
- }
-
- @Override
- public void detach() {
- // ignore
- }
- }
-
- public static class UserOwnerSelectPayload {
-
- private final Long userId;
-
- public UserOwnerSelectPayload(final Long userId) {
- this.userId = userId;
- }
-
- public Long getUserId() {
- return userId;
- }
- }
-
- public static class RoleOwnerSelectPayload {
-
- private final Long roleId;
-
- public RoleOwnerSelectPayload(final Long roleId) {
- this.roleId = roleId;
- }
-
- public Long getRoleId() {
- return roleId;
- }
- }
-
- public static class ParentSelectPayload {
-
- private final Long roleId;
-
- public ParentSelectPayload(final Long roleId) {
- this.roleId = roleId;
- }
-
- public Long getRoleId() {
- return roleId;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RolePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RolePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RolePanel.java
deleted file mode 100644
index da04397..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RolePanel.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.panels;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.apache.syncope.client.console.commons.Mode;
-import org.apache.syncope.client.console.commons.XMLRolesReader;
-import org.apache.syncope.client.console.commons.status.StatusBean;
-import org.apache.syncope.client.console.rest.AuthRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.util.ListModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-public class RolePanel extends Panel {
-
- private static final long serialVersionUID = 4216376097320768369L;
-
- @SpringBean
- private AuthRestClient authRestClient;
-
- @SpringBean
- private XMLRolesReader xmlRolesReader;
-
- private final AjaxPalettePanel<String> entitlements;
-
- public static class Builder implements Serializable {
-
- private static final long serialVersionUID = 8150440254654306070L;
-
- private String id;
-
- private Form form;
-
- private RoleTO roleTO;
-
- private Mode mode;
-
- private PageReference pageReference;
-
- public Builder(final String id) {
- this.id = id;
- }
-
- public Builder form(final Form form) {
- this.form = form;
- return this;
- }
-
- public Builder roleTO(final RoleTO roleTO) {
- this.roleTO = roleTO;
- return this;
- }
-
- public Builder roleModalPageMode(final Mode mode) {
- this.mode = mode;
- return this;
- }
-
- public Builder pageRef(final PageReference pageReference) {
- this.pageReference = pageReference;
- return this;
- }
-
- public RolePanel build() {
- return new RolePanel(this);
- }
- }
-
- private RolePanel(final Builder builder) {
- super(builder.id);
-
- this.add(new RoleDetailsPanel("details", builder.roleTO, builder.mode == Mode.TEMPLATE));
-
- if (builder.pageReference == null || builder.roleTO.getKey() == 0) {
- this.add(new Label("statuspanel", ""));
- } else {
- StatusPanel statusPanel = new StatusPanel(
- "statuspanel", builder.roleTO, new ArrayList<StatusBean>(), builder.pageReference);
- statusPanel.setOutputMarkupId(true);
- MetaDataRoleAuthorizationStrategy.authorize(
- statusPanel, RENDER, xmlRolesReader.getEntitlement("Resources", "getConnectorObject"));
- this.add(statusPanel);
- }
-
- this.add(new AnnotatedBeanPanel("systeminformation", builder.roleTO));
-
- //--------------------------------
- // Attribute templates panel
- //--------------------------------
- AttrTemplatesPanel attrTemplates = new AttrTemplatesPanel("templates", builder.roleTO);
- this.add(attrTemplates);
-
- //--------------------------------
- // Attributes panel
- //--------------------------------
- this.add(new PlainAttrsPanel(
- "plainAttrs", builder.roleTO, builder.form, builder.mode, attrTemplates));
-
- final AjaxCheckBoxPanel inhAttributes = new AjaxCheckBoxPanel("inheritPlainAttrs", "inheritPlainAttrs",
- new PropertyModel<Boolean>(builder.roleTO, "inheritPlainAttrs"));
- inhAttributes.setOutputMarkupId(true);
- this.add(inhAttributes);
- //--------------------------------
-
- //--------------------------------
- // Derived attributes panel
- //--------------------------------
- this.add(new DerAttrsPanel("derAttrs", builder.roleTO, attrTemplates));
-
- final AjaxCheckBoxPanel inhDerivedAttributes = new AjaxCheckBoxPanel("inheritDerAttrs",
- "inheritDerAttrs", new PropertyModel<Boolean>(builder.roleTO, "inheritDerAttrs"));
- inhDerivedAttributes.setOutputMarkupId(true);
- this.add(inhDerivedAttributes);
- //--------------------------------
-
- //--------------------------------
- // Virtual attributes panel
- //--------------------------------
- this.add(new VirAttrsPanel(
- "virAttrs", builder.roleTO, builder.mode == Mode.TEMPLATE, attrTemplates));
-
- final AjaxCheckBoxPanel inhVirtualAttributes = new AjaxCheckBoxPanel("inheritVirAttrs",
- "inheritVirAttrs", new PropertyModel<Boolean>(builder.roleTO, "inheritVirAttrs"));
- inhVirtualAttributes.setOutputMarkupId(true);
- this.add(inhVirtualAttributes);
- //--------------------------------
-
- //--------------------------------
- // Resources panel
- //--------------------------------
- this.add(new ResourcesPanel.Builder("resources").attributableTO(builder.roleTO).build().
- setOutputMarkupId(true));
- //--------------------------------
-
- //--------------------------------
- // Entitlements
- //--------------------------------
- ListModel<String> selectedEntitlements = new ListModel<String>(builder.roleTO.getEntitlements());
-
- List<String> allEntitlements = authRestClient.getAllEntitlements();
- if (allEntitlements != null && !allEntitlements.isEmpty()) {
- Collections.sort(allEntitlements);
- }
- ListModel<String> availableEntitlements = new ListModel<String>(allEntitlements);
-
- entitlements = new AjaxPalettePanel<String>("entitlements", selectedEntitlements, availableEntitlements);
- this.add(entitlements);
-
- //--------------------------------
- // Security panel
- //--------------------------------
- this.add(new RoleSecurityPanel("security", builder.roleTO).setOutputMarkupId(true));
- //--------------------------------
- }
-
- public Collection<String> getSelectedEntitlements() {
- return this.entitlements.getModelCollection();
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchPanel.java
deleted file mode 100644
index c8d9727..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchPanel.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.panels;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.search.SyncopeFiqlSearchConditionBuilder;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.wicket.model.LoadableDetachableModel;
-
-public class RoleSearchPanel extends AbstractSearchPanel {
-
- private static final long serialVersionUID = 5757183539269316263L;
-
- public static class Builder implements Serializable {
-
- private static final long serialVersionUID = 6308997285778809579L;
-
- private String id;
-
- private String fiql = null;
-
- private boolean required = true;
-
- public Builder(final String id) {
- this.id = id;
- }
-
- public Builder fiql(final String fiql) {
- this.fiql = fiql;
- return this;
- }
-
- public Builder required(final boolean required) {
- this.required = required;
- return this;
- }
-
- public RoleSearchPanel build() {
- return new RoleSearchPanel(this);
- }
- }
-
- private RoleSearchPanel(final Builder builder) {
- super(builder.id, AttributableType.ROLE, builder.fiql, builder.required);
- }
-
- @Override
- protected void populate() {
- super.populate();
-
- this.types = new LoadableDetachableModel<List<SearchClause.Type>>() {
-
- private static final long serialVersionUID = 5275935387613157437L;
-
- @Override
- protected List<SearchClause.Type> load() {
- final List<SearchClause.Type> result = new ArrayList<SearchClause.Type>();
- result.add(SearchClause.Type.ATTRIBUTE);
- result.add(SearchClause.Type.ENTITLEMENT);
- result.add(SearchClause.Type.RESOURCE);
- return result;
- }
- };
-
- this.roleNames = new LoadableDetachableModel<List<String>>() {
-
- private static final long serialVersionUID = 5275935387613157437L;
-
- @Override
- protected List<String> load() {
- return Collections.<String>emptyList();
- }
- };
- }
-
- @Override
- protected SyncopeFiqlSearchConditionBuilder getSearchConditionBuilder() {
- return SyncopeClient.getRoleSearchConditionBuilder();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchResultPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchResultPanel.java
deleted file mode 100644
index dfd40d5..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchResultPanel.java
+++ /dev/null
@@ -1,172 +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.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.pages.ResultStatusModalPage;
-import org.apache.syncope.client.console.pages.RoleModalPage;
-import org.apache.syncope.client.console.pages.StatusModalPage;
-import org.apache.syncope.client.console.rest.AbstractSubjectRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink.ActionType;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AbstractAttributableTO;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.wicket.Page;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
-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.repeater.Item;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.ResourceModel;
-
-public class RoleSearchResultPanel extends AbstractSearchResultPanel {
-
- private static final long serialVersionUID = -1180593361914008764L;
-
- private final static String PAGEID = "Roles";
-
- public <T extends AbstractAttributableTO> RoleSearchResultPanel(final String id, final boolean filtered,
- final String fiql, final PageReference callerRef, final AbstractSubjectRestClient restClient) {
-
- super(id, filtered, fiql, callerRef, restClient);
- initResultTable();
- }
-
- @Override
- protected List<IColumn<AbstractAttributableTO, String>> getColumns() {
- final List<IColumn<AbstractAttributableTO, String>> columns = new ArrayList<>();
-
- for (String item : new String[] { "key", "name", "entitlements" }) {
- columns.add(new PropertyColumn<AbstractAttributableTO, String>(new ResourceModel(item, item), item, item));
- }
-
- columns.add(new AbstractColumn<AbstractAttributableTO, String>(new ResourceModel("actions", "")) {
-
- private static final long serialVersionUID = -3503023501954863131L;
-
- @Override
- public String getCssClass() {
- return "action";
- }
-
- @Override
- public void populateItem(final Item<ICellPopulator<AbstractAttributableTO>> cellItem,
- final String componentId, final IModel<AbstractAttributableTO> model) {
-
- final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, page.getPageReference());
-
- panel.add(new ActionLink() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- statusmodal.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new StatusModalPage<RoleTO>(
- page.getPageReference(), statusmodal, (RoleTO) model.getObject());
- }
- });
-
- statusmodal.show(target);
- }
- }, ActionLink.ActionType.MANAGE_RESOURCES, PAGEID);
-
- panel.add(new ActionLink() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- editmodal.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new RoleModalPage(
- page.getPageReference(), editmodal, (RoleTO) model.getObject());
- }
- });
-
- editmodal.show(target);
- }
- }, ActionLink.ActionType.EDIT, PAGEID);
-
- panel.add(new ActionLink() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- try {
- final RoleTO roleTO = (RoleTO) restClient.
- delete(model.getObject().getETagValue(), model.getObject().getKey());
-
- page.setModalResult(true);
-
- editmodal.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new ResultStatusModalPage.Builder(editmodal, roleTO).build();
- }
- });
-
- editmodal.show(target);
- } catch (SyncopeClientException scce) {
- error(getString(Constants.OPERATION_ERROR) + ": " + scce.getMessage());
- feedbackPanel.refresh(target);
- }
- }
- }, ActionLink.ActionType.DELETE, PAGEID);
-
- cellItem.add(panel);
- }
- });
-
- return columns;
- }
-
- @Override
- protected Collection<ActionType> getBulkActions() {
- return Collections.<ActionLink.ActionType>singletonList(ActionLink.ActionType.DELETE);
- }
-
- @Override
- protected String getPageId() {
- return PAGEID;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSecurityPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSecurityPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSecurityPanel.java
deleted file mode 100644
index b60d1e4..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSecurityPanel.java
+++ /dev/null
@@ -1,198 +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.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.rest.PolicyRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
-import org.apache.syncope.common.lib.to.AbstractAttributableTO;
-import org.apache.syncope.common.lib.to.AbstractPolicyTO;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.ChoiceRenderer;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RoleSecurityPanel extends Panel {
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(RoleSecurityPanel.class);
-
- private static final long serialVersionUID = -7982691107029848579L;
-
- @SpringBean
- private PolicyRestClient policyRestClient;
-
- private IModel<Map<Long, String>> passwordPolicies = null;
-
- private IModel<Map<Long, String>> accountPolicies = null;
-
- public <T extends AbstractAttributableTO> RoleSecurityPanel(final String id, final T entityTO) {
- super(id);
-
- setOutputMarkupId(true);
-
- passwordPolicies = new LoadableDetachableModel<Map<Long, String>>() {
-
- private static final long serialVersionUID = 5275935387613157437L;
-
- @Override
- protected Map<Long, String> load() {
- Map<Long, String> res = new HashMap<>();
- for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD, false)) {
- res.put(policyTO.getKey(), policyTO.getDescription());
- }
- return res;
- }
- };
-
- accountPolicies = new LoadableDetachableModel<Map<Long, String>>() {
-
- private static final long serialVersionUID = -2012833443695917883L;
-
- @Override
- protected Map<Long, String> load() {
- Map<Long, String> res = new HashMap<>();
- for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT, false)) {
- res.put(policyTO.getKey(), policyTO.getDescription());
- }
- return res;
- }
- };
-
- final WebMarkupContainer securityContainer = new WebMarkupContainer("security");
-
- securityContainer.setOutputMarkupId(true);
- add(securityContainer);
-
- // -------------------------------
- // Password policy specification
- // -------------------------------
- final AjaxDropDownChoicePanel<Long> passwordPolicy = new AjaxDropDownChoicePanel<Long>("passwordPolicy",
- "passwordPolicy", new PropertyModel<Long>(entityTO, "passwordPolicy"));
-
- passwordPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.PASSWORD));
-
- passwordPolicy.setChoices(new ArrayList<Long>(passwordPolicies.getObject().keySet()));
-
- ((DropDownChoice<?>) passwordPolicy.getField()).setNullValid(true);
-
- securityContainer.add(passwordPolicy);
-
- final AjaxCheckBoxPanel inhPasswordPolicy = new AjaxCheckBoxPanel("inheritPasswordPolicy",
- "inheritPasswordPolicy", new PropertyModel<Boolean>(entityTO, "inheritPasswordPolicy"));
-
- passwordPolicy.setReadOnly(inhPasswordPolicy.getModelObject());
-
- inhPasswordPolicy.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
-
- private static final long serialVersionUID = -1107858522700306810L;
-
- @Override
- protected void onUpdate(final AjaxRequestTarget target) {
- passwordPolicy.setReadOnly(inhPasswordPolicy.getModelObject());
- target.add(passwordPolicy);
- }
- });
-
- securityContainer.add(inhPasswordPolicy);
- // -------------------------------
-
- // -------------------------------
- // Account policy specification
- // -------------------------------
- final AjaxDropDownChoicePanel<Long> accountPolicy = new AjaxDropDownChoicePanel<Long>("accountPolicy",
- "accountPolicy", new PropertyModel<Long>(entityTO, "accountPolicy"));
-
- accountPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.ACCOUNT));
-
- accountPolicy.setChoices(new ArrayList<Long>(accountPolicies.getObject().keySet()));
-
- ((DropDownChoice<?>) accountPolicy.getField()).setNullValid(true);
-
- securityContainer.add(accountPolicy);
-
- final AjaxCheckBoxPanel inhAccountPolicy = new AjaxCheckBoxPanel("inheritAccountPolicy",
- "inheritAccountPolicy", new PropertyModel<Boolean>(entityTO, "inheritAccountPolicy"));
- accountPolicy.setReadOnly(inhAccountPolicy.getModelObject());
-
- inhAccountPolicy.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
-
- private static final long serialVersionUID = -1107858522700306810L;
-
- @Override
- protected void onUpdate(final AjaxRequestTarget target) {
- accountPolicy.setReadOnly(inhAccountPolicy.getModelObject());
- target.add(accountPolicy);
- }
- });
-
- securityContainer.add(inhAccountPolicy);
- // -------------------------------
- }
-
- private class PolicyRenderer extends ChoiceRenderer<Long> {
-
- private static final long serialVersionUID = 8060500161321947000L;
-
- private PolicyType type;
-
- public PolicyRenderer(final PolicyType type) {
- super();
- this.type = type;
- }
-
- @Override
- public Object getDisplayValue(final Long object) {
- Object displayValue;
- switch (type) {
- case ACCOUNT:
- displayValue = accountPolicies.getObject().get(object);
- break;
- case PASSWORD:
- displayValue = passwordPolicies.getObject().get(object);
- break;
- default:
- displayValue = "";
- }
- return displayValue;
- }
-
- @Override
- public String getIdValue(Long object, int index) {
- return String.valueOf(object != null
- ? object
- : 0L);
- }
- };
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSummaryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSummaryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSummaryPanel.java
deleted file mode 100644
index d7663be..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSummaryPanel.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.panels;
-
-import java.io.Serializable;
-import org.apache.syncope.client.console.commons.XMLRolesReader;
-import org.apache.syncope.client.console.pages.RoleModalPage;
-import org.apache.syncope.client.console.rest.RoleRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.wicket.Page;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RoleSummaryPanel extends Panel {
-
- private static final long serialVersionUID = 643769814985593156L;
-
- /**
- * Logger.
- */
- private static final Logger LOG = LoggerFactory.getLogger(RoleSummaryPanel.class);
-
- @SpringBean
- private XMLRolesReader xmlRolesReader;
-
- @SpringBean
- private RoleRestClient restClient;
-
- private RoleTO selectedNode;
-
- public static class Builder implements Serializable {
-
- private static final long serialVersionUID = 4164563358509351832L;
-
- private String id;
-
- private ModalWindow window;
-
- private PageReference callerPageRef;
-
- private Long selectedNodeId = null;
-
- public Builder(final String id) {
- this.id = id;
- }
-
- public RoleSummaryPanel.Builder window(final ModalWindow window) {
- this.window = window;
- return this;
- }
-
- public RoleSummaryPanel.Builder callerPageRef(final PageReference callerPageRef) {
- this.callerPageRef = callerPageRef;
- return this;
- }
-
- public RoleSummaryPanel.Builder selectedNodeId(final Long selectedNodeId) {
- this.selectedNodeId = selectedNodeId;
- return this;
- }
-
- public RoleSummaryPanel build() {
- return new RoleSummaryPanel(this);
- }
- }
-
- private RoleSummaryPanel(final Builder builder) {
- super(builder.id);
-
- if (builder.selectedNodeId == null || builder.selectedNodeId == 0) {
- selectedNode = null;
- } else {
- try {
- selectedNode = restClient.read(builder.selectedNodeId);
- } catch (SyncopeClientException e) {
- LOG.error("Could not read {}", builder.selectedNodeId, e);
- selectedNode = null;
- builder.selectedNodeId = null;
- }
- }
-
- Fragment fragment = new Fragment("roleSummaryPanel",
- builder.selectedNodeId == null
- ? "fakerootFrag"
- : (builder.selectedNodeId == 0 ? "rootPanel" : "roleViewPanel"),
- this);
-
- if (builder.selectedNodeId != null) {
- if (builder.selectedNodeId == 0) {
- @SuppressWarnings("rawtypes")
- final ActionLinksPanel links = new ActionLinksPanel("actionLinks", new Model(), builder.callerPageRef);
- links.setOutputMarkupId(true);
- fragment.add(links);
-
- links.addWithRoles(new ActionLink() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- builder.window.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new RoleModalPage(builder.callerPageRef, builder.window, new RoleTO());
- }
- });
-
- builder.window.show(target);
- }
- }, ActionLink.ActionType.CREATE, xmlRolesReader.getEntitlement("Roles", "create"));
- } else {
- RoleTabPanel roleTabPanel =
- new RoleTabPanel("nodeViewPanel", selectedNode, builder.window, builder.callerPageRef);
- roleTabPanel.setOutputMarkupId(true);
- fragment.add(roleTabPanel);
- }
- }
- add(fragment);
- }
-
- public RoleTO getSelectedNode() {
- return selectedNode;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleTabPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleTabPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleTabPanel.java
deleted file mode 100644
index 7c483b5..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleTabPanel.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.panels;
-
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.Mode;
-import org.apache.syncope.client.console.commons.XMLRolesReader;
-import org.apache.syncope.client.console.pages.ResultStatusModalPage;
-import org.apache.syncope.client.console.pages.RoleModalPage;
-import org.apache.syncope.client.console.pages.Roles;
-import org.apache.syncope.client.console.pages.StatusModalPage;
-import org.apache.syncope.client.console.rest.RoleRestClient;
-import org.apache.syncope.client.console.rest.UserRestClient;
-import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxButton;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.wicket.Page;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.ResourceModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-public class RoleTabPanel extends Panel {
-
- private static final long serialVersionUID = 859236186975983959L;
-
- @SpringBean
- private XMLRolesReader xmlRolesReader;
-
- @SpringBean
- private RoleRestClient roleRestClient;
-
- @SpringBean
- private UserRestClient userRestClient;
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public RoleTabPanel(final String id, final RoleTO selectedNode, final ModalWindow window,
- final PageReference pageRef) {
-
- super(id);
-
- this.add(new Label("displayName", selectedNode.getDisplayName()));
-
- final ActionLinksPanel links = new ActionLinksPanel("actionLinks", new Model(), pageRef);
- links.setOutputMarkupId(true);
- this.add(links);
- links.addWithRoles(new ActionLink() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- window.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- RoleTO roleTO = new RoleTO();
- roleTO.setParent(selectedNode.getKey());
- return new RoleModalPage(pageRef, window, roleTO);
- }
- });
-
- window.show(target);
- }
- }, ActionLink.ActionType.CREATE, xmlRolesReader.getEntitlement("Roles", "create"));
- links.addWithRoles(new ActionLink() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- window.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new StatusModalPage<RoleTO>(pageRef, window, roleRestClient.read(selectedNode.getKey()));
- }
- });
-
- window.show(target);
- }
- }, ActionLink.ActionType.MANAGE_RESOURCES, xmlRolesReader.getEntitlement("Roles", "update"));
- links.addWithRoles(new ActionLink() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- window.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- RoleTO roleTO = roleRestClient.read(selectedNode.getKey());
- return new RoleModalPage(pageRef, window, roleTO);
- }
- });
-
- window.show(target);
- }
- }, ActionLink.ActionType.EDIT, xmlRolesReader.getEntitlement("Roles", "update"));
- links.addWithRoles(new ActionLink() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- try {
- final RoleTO roleTO = roleRestClient.delete(selectedNode.getETagValue(), selectedNode.getKey());
-
- ((Roles) pageRef.getPage()).setModalResult(true);
-
- window.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new ResultStatusModalPage.Builder(window, roleTO).build();
- }
- });
-
- window.show(target);
- } catch (SyncopeClientException e) {
- error(getString(Constants.OPERATION_ERROR) + ": " + e.getMessage());
- ((Roles) pageRef.getPage()).getFeedbackPanel().refresh(target);
- }
- }
- }, ActionLink.ActionType.DELETE, xmlRolesReader.getEntitlement("Roles", "delete"));
-
- final Form form = new Form("roleForm");
- form.setModel(new CompoundPropertyModel(selectedNode));
- form.setOutputMarkupId(true);
-
- final RolePanel rolePanel = new RolePanel.Builder("rolePanel").form(form).roleTO(selectedNode).
- roleModalPageMode(Mode.ADMIN).build();
- rolePanel.setEnabled(false);
- form.add(rolePanel);
-
- final WebMarkupContainer userListContainer = new WebMarkupContainer("userListContainer");
-
- userListContainer.setOutputMarkupId(true);
- userListContainer.setEnabled(true);
- userListContainer.add(new UserSearchResultPanel("userList", true, null, pageRef, userRestClient));
- userListContainer.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), pageRef) {
-
- private static final long serialVersionUID = -958724007591692537L;
-
- @Override
- protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
- userListContainer.replace(new UserSearchResultPanel("userList",
- true,
- SyncopeClient.getUserSearchConditionBuilder().hasRoles(selectedNode.getKey()).query(),
- pageRef,
- userRestClient));
-
- target.add(userListContainer);
- }
- });
-
- form.add(userListContainer);
- add(form);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/SearchView.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SearchView.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SearchView.java
index b432d82..c081cd3 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SearchView.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SearchView.java
@@ -52,7 +52,7 @@ public class SearchView extends ListView<SearchClause> {
private final IModel<List<String>> dnames;
- private final IModel<List<String>> roleNames;
+ private final IModel<List<String>> groupNames;
private final IModel<List<String>> resourceNames;
@@ -64,7 +64,7 @@ public class SearchView extends ListView<SearchClause> {
final IModel<List<SearchClause.Type>> types,
final IModel<List<String>> anames,
final IModel<List<String>> dnames,
- final IModel<List<String>> roleNames,
+ final IModel<List<String>> groupNames,
final IModel<List<String>> resourceNames,
final IModel<List<String>> entitlements) {
@@ -75,7 +75,7 @@ public class SearchView extends ListView<SearchClause> {
this.types = types;
this.anames = anames;
this.dnames = dnames;
- this.roleNames = roleNames;
+ this.groupNames = groupNames;
this.resourceNames = resourceNames;
this.entitlements = entitlements;
}
@@ -290,7 +290,7 @@ public class SearchView extends ListView<SearchClause> {
break;
case MEMBERSHIP:
- property.setChoices(roleNames);
+ property.setChoices(groupNames);
property.setChoiceRenderer(new IChoiceRenderer<String>() {
private static final long serialVersionUID = -4288397951948436434L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/SelectOnlyUserSearchResultPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SelectOnlyUserSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SelectOnlyUserSearchResultPanel.java
index a55db53..efa5a3d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SelectOnlyUserSearchResultPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SelectOnlyUserSearchResultPanel.java
@@ -79,7 +79,7 @@ public class SelectOnlyUserSearchResultPanel extends UserSearchResultPanel {
@Override
public void onClick(final AjaxRequestTarget target) {
send(pageRef.getPage(), Broadcast.BREADTH,
- new RoleDetailsPanel.UserOwnerSelectPayload(rowModel.getObject().getKey()));
+ new GroupDetailsPanel.UserOwnerSelectPayload(rowModel.getObject().getKey()));
window.close(target);
}
}, ActionLink.ActionType.SELECT, "Users");
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/StatusPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/StatusPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/StatusPanel.java
index 4faea4e..fb74065 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/StatusPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/StatusPanel.java
@@ -29,7 +29,7 @@ import org.apache.syncope.client.console.commons.status.Status;
import org.apache.syncope.client.console.commons.status.StatusBean;
import org.apache.syncope.client.console.commons.status.StatusUtils;
import org.apache.syncope.client.console.pages.ConnObjectModalPage;
-import org.apache.syncope.client.console.rest.RoleRestClient;
+import org.apache.syncope.client.console.rest.GroupRestClient;
import org.apache.syncope.client.console.rest.UserRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
@@ -38,7 +38,7 @@ import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.to.AbstractAttributableTO;
import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.ConnObjectTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.wicket.Page;
import org.apache.wicket.PageReference;
@@ -78,7 +78,7 @@ public class StatusPanel extends Panel implements IHeaderContributor {
private UserRestClient userRestClient;
@SpringBean
- private RoleRestClient roleRestClient;
+ private GroupRestClient groupRestClient;
private final ModalWindow connObjectWin;
@@ -107,7 +107,7 @@ public class StatusPanel extends Panel implements IHeaderContributor {
connObjectWin.setCookieName("connobject-modal");
add(connObjectWin);
- statusUtils = new StatusUtils(subject instanceof RoleTO ? roleRestClient : userRestClient);
+ statusUtils = new StatusUtils(subject instanceof GroupTO ? groupRestClient : userRestClient);
connObjects = statusUtils.getConnectorObjects(subject);
@@ -128,8 +128,8 @@ public class StatusPanel extends Panel implements IHeaderContributor {
}
}
syncope.setStatus(syncopeStatus);
- } else if (subject instanceof RoleTO) {
- syncope.setAccountLink(((RoleTO) subject).getDisplayName());
+ } else if (subject instanceof GroupTO) {
+ syncope.setAccountLink(((GroupTO) subject).getDisplayName());
syncope.setStatus(Status.ACTIVE);
}
@@ -137,11 +137,10 @@ public class StatusPanel extends Panel implements IHeaderContributor {
initialStatusBeanMap.put(syncope.getResourceName(), syncope);
for (ConnObjectWrapper entry : connObjects) {
- final StatusBean statusBean = statusUtils.getStatusBean(
- entry.getAttributable(),
+ final StatusBean statusBean = statusUtils.getStatusBean(entry.getAttributable(),
entry.getResourceName(),
entry.getConnObjectTO(),
- subject instanceof RoleTO);
+ subject instanceof GroupTO);
initialStatusBeanMap.put(entry.getResourceName(), statusBean);
statusBeans.add(statusBean);
@@ -161,7 +160,7 @@ public class StatusPanel extends Panel implements IHeaderContributor {
add(checkGroup);
CheckGroupSelector groupSelector = new CheckGroupSelector("groupselector", checkGroup);
- if (subject instanceof RoleTO) {
+ if (subject instanceof GroupTO) {
groupSelector.setVisible(false);
}
add(groupSelector);
@@ -175,7 +174,7 @@ public class StatusPanel extends Panel implements IHeaderContributor {
item.add(statusUtils.getStatusImage("icon", item.getModelObject().getStatus()));
final Check<StatusBean> check = new Check<StatusBean>("check", item.getModel(), checkGroup);
- if (subject instanceof RoleTO) {
+ if (subject instanceof GroupTO) {
check.setVisible(false);
}
item.add(check);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/SyncTasksPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SyncTasksPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SyncTasksPanel.java
index f520391..5561716 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SyncTasksPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SyncTasksPanel.java
@@ -21,7 +21,7 @@ package org.apache.syncope.client.console.panels;
import java.util.ArrayList;
import java.util.List;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.pages.RoleTemplateModalPage;
+import org.apache.syncope.client.console.pages.GroupTemplateModalPage;
import org.apache.syncope.client.console.pages.SyncTaskModalPage;
import org.apache.syncope.client.console.pages.UserTemplateModalPage;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn;
@@ -70,8 +70,7 @@ public class SyncTasksPanel extends AbstractProvisioningTasksPanel<SyncTaskTO> {
syncTaskscolumns.add(new PropertyColumn<AbstractTaskTO, String>(
new StringResourceModel("latestExecStatus", this, null), "latestExecStatus", "latestExecStatus"));
- syncTaskscolumns.add(
- new ActionColumn<AbstractTaskTO, String>(new StringResourceModel("actions", this, null, "")) {
+ syncTaskscolumns.add(new ActionColumn<AbstractTaskTO, String>(new StringResourceModel("actions", this, null, "")) {
private static final long serialVersionUID = 2054811145491901166L;
@@ -137,13 +136,13 @@ public class SyncTasksPanel extends AbstractProvisioningTasksPanel<SyncTaskTO> {
@Override
public Page createPage() {
- return new RoleTemplateModalPage(pageRef, window, taskTO);
+ return new GroupTemplateModalPage(pageRef, window, taskTO);
}
});
window.show(target);
}
- }, ActionLink.ActionType.ROLE_TEMPLATE, TASKS);
+ }, ActionLink.ActionType.GROUP_TEMPLATE, TASKS);
panel.add(new ActionLink() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchPanel.java
index 2ca1b94..6618728 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchPanel.java
@@ -21,10 +21,10 @@ package org.apache.syncope.client.console.panels;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import org.apache.syncope.client.console.rest.RoleRestClient;
+import org.apache.syncope.client.console.rest.GroupRestClient;
import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.search.SyncopeFiqlSearchConditionBuilder;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
@@ -34,7 +34,7 @@ public class UserSearchPanel extends AbstractSearchPanel {
private static final long serialVersionUID = -1769527800450203738L;
@SpringBean
- private RoleRestClient roleRestClient;
+ private GroupRestClient groupRestClient;
public static class Builder implements Serializable {
@@ -87,17 +87,17 @@ public class UserSearchPanel extends AbstractSearchPanel {
}
};
- this.roleNames = new LoadableDetachableModel<List<String>>() {
+ this.groupNames = new LoadableDetachableModel<List<String>>() {
private static final long serialVersionUID = 5275935387613157437L;
@Override
protected List<String> load() {
- List<RoleTO> roleTOs = roleRestClient.list();
+ List<GroupTO> groupTOs = groupRestClient.list();
- List<String> result = new ArrayList<String>(roleTOs.size());
- for (RoleTO role : roleTOs) {
- result.add(role.getDisplayName());
+ List<String> result = new ArrayList<>(groupTOs.size());
+ for (GroupTO group : groupTOs) {
+ result.add(group.getDisplayName());
}
return result;
@@ -106,7 +106,7 @@ public class UserSearchPanel extends AbstractSearchPanel {
}
@Override
- protected SyncopeFiqlSearchConditionBuilder getSearchConditionBuilder() {
+ protected AbstractFiqlSearchConditionBuilder getSearchConditionBuilder() {
return SyncopeClient.getUserSearchConditionBuilder();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java
index 34d21d5..4a3e103 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java
@@ -26,8 +26,8 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.panels.AttrTemplatesPanel.RoleAttrTemplatesChange;
-import org.apache.syncope.client.console.rest.RoleRestClient;
+import org.apache.syncope.client.console.panels.AttrTemplatesPanel.GroupAttrTemplatesChange;
+import org.apache.syncope.client.console.rest.GroupRestClient;
import org.apache.syncope.client.console.rest.SchemaRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDecoratedCheckbox;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
@@ -35,7 +35,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel
import org.apache.syncope.common.lib.to.AbstractAttributableTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.to.VirSchemaTO;
import org.apache.syncope.common.lib.types.AttributableType;
@@ -69,7 +69,7 @@ public class VirAttrsPanel extends Panel {
private SchemaRestClient schemaRestClient;
@SpringBean
- private RoleRestClient roleRestClient;
+ private GroupRestClient groupRestClient;
private final AttrTemplatesPanel attrTemplates;
@@ -105,18 +105,17 @@ public class VirAttrsPanel extends Panel {
protected List<String> load() {
List<VirSchemaTO> schemaTOs;
- if (entityTO instanceof RoleTO) {
- final RoleTO roleTO = (RoleTO) entityTO;
+ if (entityTO instanceof GroupTO) {
+ final GroupTO groupTO = (GroupTO) entityTO;
- schemaTOs = schemaRestClient.getVirSchemas(AttributableType.ROLE);
+ schemaTOs = schemaRestClient.getVirSchemas(AttributableType.GROUP);
Set<String> allowed;
if (attrTemplates == null) {
- allowed = new HashSet<String>(roleTO.getRVirAttrTemplates());
+ allowed = new HashSet<>(groupTO.getGVirAttrTemplates());
} else {
- allowed = new HashSet<String>(attrTemplates.getSelected(
- AttrTemplatesPanel.Type.rVirAttrTemplates));
- if (roleTO.isInheritTemplates() && roleTO.getParent() != 0) {
- allowed.addAll(roleRestClient.read(roleTO.getParent()).getRVirAttrTemplates());
+ allowed = new HashSet<>(attrTemplates.getSelected(AttrTemplatesPanel.Type.gVirAttrTemplates));
+ if (groupTO.isInheritTemplates() && groupTO.getParent() != 0) {
+ allowed.addAll(groupRestClient.read(groupTO.getParent()).getGVirAttrTemplates());
}
}
filter(schemaTOs, allowed);
@@ -125,7 +124,7 @@ public class VirAttrsPanel extends Panel {
} else {
schemaTOs = schemaRestClient.getVirSchemas(AttributableType.MEMBERSHIP);
Set<String> allowed = new HashSet<String>(
- roleRestClient.read(((MembershipTO) entityTO).getRoleId()).getMVirAttrTemplates());
+ groupRestClient.read(((MembershipTO) entityTO).getGroupId()).getMVirAttrTemplates());
filter(schemaTOs, allowed);
}
@@ -285,9 +284,9 @@ public class VirAttrsPanel extends Panel {
@Override
public void onEvent(final IEvent<?> event) {
- if ((event.getPayload() instanceof RoleAttrTemplatesChange)) {
- final RoleAttrTemplatesChange update = (RoleAttrTemplatesChange) event.getPayload();
- if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.rVirAttrTemplates) {
+ if ((event.getPayload() instanceof GroupAttrTemplatesChange)) {
+ final GroupAttrTemplatesChange update = (GroupAttrTemplatesChange) event.getPayload();
+ if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.gVirAttrTemplates) {
update.getTarget().add(this);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
new file mode 100644
index 0000000..91634f2
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
@@ -0,0 +1,184 @@
+/*
+ * 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 javax.ws.rs.core.Response;
+import org.apache.syncope.client.console.commons.status.StatusBean;
+import org.apache.syncope.client.console.commons.status.StatusUtils;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.BulkAction;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
+import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
+import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.common.lib.wrap.ResourceName;
+import org.apache.syncope.common.rest.api.CollectionWrapper;
+import org.apache.syncope.common.rest.api.service.ResourceService;
+import org.apache.syncope.common.rest.api.service.GroupService;
+import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
+import org.springframework.stereotype.Component;
+
+/**
+ * Console client for invoking Rest Group's services.
+ */
+@Component
+public class GroupRestClient extends AbstractSubjectRestClient {
+
+ private static final long serialVersionUID = -8549081557283519638L;
+
+ @Override
+ public int count() {
+ return getService(GroupService.class).list(1, 1).getTotalCount();
+ }
+
+ public List<GroupTO> list() {
+ return getService(GroupService.class).list(1, 1000).getResult();
+ }
+
+ @Override
+ public List<GroupTO> list(final int page, final int size, final SortParam<String> sort) {
+ return getService(GroupService.class).list(page, size, toOrderBy(sort)).getResult();
+ }
+
+ @Override
+ public int searchCount(final String fiql) {
+ return getService(GroupService.class).search(fiql, 1, 1).getTotalCount();
+ }
+
+ @Override
+ public List<GroupTO> search(final String fiql, final int page, final int size, final SortParam<String> sort) {
+ return getService(GroupService.class).search(fiql, page, size, toOrderBy(sort)).getResult();
+ }
+
+ @Override
+ public ConnObjectTO getConnectorObject(final String resourceName, final Long id) {
+ return getService(ResourceService.class).getConnectorObject(resourceName, SubjectType.GROUP, id);
+ }
+
+ public GroupTO create(final GroupTO groupTO) {
+ Response response = getService(GroupService.class).create(groupTO);
+ return response.readEntity(GroupTO.class);
+ }
+
+ public GroupTO read(final Long id) {
+ return getAnonymousService(GroupService.class).read(id);
+ }
+
+ public GroupTO update(final String etag, final GroupMod groupMod) {
+ GroupTO result;
+ synchronized (this) {
+ GroupService service = getService(etag, GroupService.class);
+ result = service.update(groupMod.getKey(), groupMod).readEntity(GroupTO.class);
+ resetClient(GroupService.class);
+ }
+ return result;
+ }
+
+ @Override
+ public GroupTO delete(final String etag, final Long id) {
+ GroupTO result;
+ synchronized (this) {
+ GroupService service = getService(etag, GroupService.class);
+ result = service.delete(id).readEntity(GroupTO.class);
+ resetClient(GroupService.class);
+ }
+ return result;
+ }
+
+ @Override
+ public BulkActionResult bulkAction(final BulkAction action) {
+ return getService(GroupService.class).bulk(action);
+ }
+
+ public void unlink(final String etag, final long groupId, final List<StatusBean> statuses) {
+ synchronized (this) {
+ GroupService service = getService(etag, GroupService.class);
+ service.bulkDeassociation(groupId, ResourceDeassociationActionType.UNLINK,
+ CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
+ ResourceName.class));
+ resetClient(GroupService.class);
+ }
+ }
+
+ public void link(final String etag, final long groupId, final List<StatusBean> statuses) {
+ synchronized (this) {
+ GroupService service = getService(etag, GroupService.class);
+ service.bulkAssociation(groupId, ResourceAssociationActionType.LINK,
+ CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
+ ResourceName.class));
+ resetClient(GroupService.class);
+ }
+ }
+
+ public BulkActionResult deprovision(final String etag, final long groupId, final List<StatusBean> statuses) {
+ BulkActionResult result;
+ synchronized (this) {
+ GroupService service = getService(etag, GroupService.class);
+ result = service.bulkDeassociation(groupId, ResourceDeassociationActionType.DEPROVISION,
+ CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
+ ResourceName.class)).
+ readEntity(BulkActionResult.class);
+ resetClient(GroupService.class);
+ }
+ return result;
+ }
+
+ public BulkActionResult provision(final String etag, final long groupId, final List<StatusBean> statuses) {
+ BulkActionResult result;
+ synchronized (this) {
+ GroupService service = getService(etag, GroupService.class);
+ result = service.bulkAssociation(groupId, ResourceAssociationActionType.PROVISION,
+ CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
+ ResourceName.class)).
+ readEntity(BulkActionResult.class);
+ resetClient(GroupService.class);
+ }
+ return result;
+ }
+
+ public BulkActionResult unassign(final String etag, final long groupId, final List<StatusBean> statuses) {
+ BulkActionResult result;
+ synchronized (this) {
+ GroupService service = getService(etag, GroupService.class);
+ result = service.bulkDeassociation(groupId, ResourceDeassociationActionType.UNASSIGN,
+ CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
+ ResourceName.class)).
+ readEntity(BulkActionResult.class);
+ resetClient(GroupService.class);
+ }
+ return result;
+ }
+
+ public BulkActionResult assign(final String etag, final long groupId, final List<StatusBean> statuses) {
+ BulkActionResult result;
+ synchronized (this) {
+ GroupService service = getService(etag, GroupService.class);
+ result = service.bulkAssociation(groupId, ResourceAssociationActionType.ASSIGN,
+ CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
+ ResourceName.class)).
+ readEntity(BulkActionResult.class);
+ resetClient(GroupService.class);
+ }
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
index 5ed1f45..2c44211 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
@@ -88,7 +88,7 @@ public class ResourceRestClient extends BaseRestClient {
final ResourceDeassociationActionType type, final List<SubjectKey> subjtectIds) {
return getService(ResourceService.class).bulkDeassociation(resourceName,
- UserTO.class.isAssignableFrom(typeRef) ? SubjectType.USER : SubjectType.ROLE,
+ UserTO.class.isAssignableFrom(typeRef) ? SubjectType.USER : SubjectType.GROUP,
type, subjtectIds);
}
}
[43/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/URIUtil.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/URIUtil.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/URIUtil.java
deleted file mode 100644
index f8d23df..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/URIUtil.java
+++ /dev/null
@@ -1,61 +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.provisioning.api;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-public final class URIUtil {
-
- private URIUtil() {
- // empty constructor for static utility class
- }
-
- /**
- * Build a valid URI out of the given location.
- * Only "file", "connid" and "connids" schemes are allowed.
- * For "file", invalid characters are handled via intermediate transformation into URL.
- *
- * @param location the candidate location for URI
- * @return valid URI for the given location
- * @throws MalformedURLException if the intermediate URL is not valid
- * @throws URISyntaxException if the given location does not correspond to a valid URI
- */
- public static URI buildForConnId(final String location) throws MalformedURLException, URISyntaxException {
- final String candidate = location.trim();
-
- if (!candidate.startsWith("file:")
- && !candidate.startsWith("connid:") && !candidate.startsWith("connids:")) {
-
- throw new IllegalArgumentException(candidate + " is not a valid URI for file or connid(s) schemes");
- }
-
- URI uri;
- if (candidate.startsWith("file:")) {
- uri = new File(new URL(candidate).getFile()).getAbsoluteFile().toURI();
- } else {
- uri = new URI(candidate);
- }
-
- return uri;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/URIUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/URIUtils.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/URIUtils.java
new file mode 100644
index 0000000..91fd0c2
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/URIUtils.java
@@ -0,0 +1,61 @@
+/*
+ * 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.provisioning.api;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+public final class URIUtils {
+
+ private URIUtils() {
+ // empty constructor for static utility class
+ }
+
+ /**
+ * Build a valid URI out of the given location.
+ * Only "file", "connid" and "connids" schemes are allowed.
+ * For "file", invalid characters are handled via intermediate transformation into URL.
+ *
+ * @param location the candidate location for URI
+ * @return valid URI for the given location
+ * @throws MalformedURLException if the intermediate URL is not valid
+ * @throws URISyntaxException if the given location does not correspond to a valid URI
+ */
+ public static URI buildForConnId(final String location) throws MalformedURLException, URISyntaxException {
+ final String candidate = location.trim();
+
+ if (!candidate.startsWith("file:")
+ && !candidate.startsWith("connid:") && !candidate.startsWith("connids:")) {
+
+ throw new IllegalArgumentException(candidate + " is not a valid URI for file or connid(s) schemes");
+ }
+
+ URI uri;
+ if (candidate.startsWith("file:")) {
+ uri = new File(new URL(candidate).getFile()).getAbsoluteFile().toURI();
+ } else {
+ uri = new URI(candidate);
+ }
+
+ return uri;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/UserProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/UserProvisioningManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/UserProvisioningManager.java
index f51e70a..19a1aed 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/UserProvisioningManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/UserProvisioningManager.java
@@ -19,8 +19,8 @@
package org.apache.syncope.core.provisioning.api;
import java.util.List;
-import java.util.Map;
import java.util.Set;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.PropagationStatus;
@@ -30,22 +30,22 @@ import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
public interface UserProvisioningManager extends ProvisioningManager<UserTO, UserMod> {
- Map.Entry<Long, List<PropagationStatus>> activate(User user, StatusMod statusMod);
+ Pair<Long, List<PropagationStatus>> activate(User user, StatusMod statusMod);
- Map.Entry<Long, List<PropagationStatus>> reactivate(User user, StatusMod statusMod);
+ Pair<Long, List<PropagationStatus>> reactivate(User user, StatusMod statusMod);
- Map.Entry<Long, List<PropagationStatus>> suspend(User user, StatusMod statusMod);
+ Pair<Long, List<PropagationStatus>> suspend(User user, StatusMod statusMod);
void innerSuspend(User user, boolean propagate);
- Map.Entry<Long, List<PropagationStatus>> create(UserTO userTO, boolean storePassword);
+ Pair<Long, List<PropagationStatus>> create(UserTO userTO, boolean storePassword);
- Map.Entry<Long, List<PropagationStatus>> create(UserTO userTO, boolean storePassword,
+ Pair<Long, List<PropagationStatus>> create(UserTO userTO, boolean storePassword,
boolean disablePwdPolicyCheck, Boolean enabled, Set<String> excludedResources);
- Map.Entry<Long, List<PropagationStatus>> update(UserMod userMod, boolean removeMemberships);
+ Pair<Long, List<PropagationStatus>> update(UserMod userMod, boolean removeMemberships);
- Map.Entry<Long, List<PropagationStatus>> update(UserMod userMod, Long key,
+ Pair<Long, List<PropagationStatus>> update(UserMod userMod, Long key,
ProvisioningResult result, Boolean enabled, Set<String> excludedResources);
List<PropagationStatus> delete(Long subjectKey, Set<String> excludedResources);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SchemaDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SchemaDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SchemaDataBinder.java
index 49e1138..cb1525e 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SchemaDataBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SchemaDataBinder.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.provisioning.api.data;
import org.apache.syncope.common.lib.to.DerSchemaTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.to.VirSchemaTO;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
@@ -36,11 +36,11 @@ public interface SchemaDataBinder {
<T extends DerSchema> DerSchemaTO getDerSchemaTO(T derSchema);
- <T extends PlainSchema> PlainSchemaTO getPlainSchemaTO(T schema, AttributableUtil attributableUtil);
+ <T extends PlainSchema> PlainSchemaTO getPlainSchemaTO(T schema, AttributableUtils attributableUtil);
<T extends VirSchema> VirSchemaTO getVirSchemaTO(T virSchema);
- <T extends PlainSchema> void update(PlainSchemaTO schemaTO, T schema, AttributableUtil attributableUtil);
+ <T extends PlainSchema> void update(PlainSchemaTO schemaTO, T schema, AttributableUtils attributableUtil);
<T extends DerSchema> T update(DerSchemaTO derSchemaTO, T derSchema);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/TaskDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/TaskDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/TaskDataBinder.java
index d09e054..997e98e 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/TaskDataBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/TaskDataBinder.java
@@ -24,16 +24,16 @@ import org.apache.syncope.common.lib.to.TaskExecTO;
import org.apache.syncope.core.persistence.api.entity.task.SchedTask;
import org.apache.syncope.core.persistence.api.entity.task.Task;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
-import org.apache.syncope.core.persistence.api.entity.task.TaskUtil;
+import org.apache.syncope.core.persistence.api.entity.task.TaskUtils;
public interface TaskDataBinder {
- SchedTask createSchedTask(SchedTaskTO taskTO, TaskUtil taskUtil);
+ SchedTask createSchedTask(SchedTaskTO taskTO, TaskUtils taskUtil);
TaskExecTO getTaskExecTO(TaskExec execution);
- <T extends AbstractTaskTO> T getTaskTO(Task task, TaskUtil taskUtil);
+ <T extends AbstractTaskTO> T getTaskTO(Task task, TaskUtils taskUtil);
- void updateSchedTask(SchedTask task, SchedTaskTO taskTO, TaskUtil taskUtil);
+ void updateSchedTask(SchedTask task, SchedTaskTO taskTO, TaskUtils taskUtil);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
index 895e0dc..db76ca1 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
@@ -20,8 +20,8 @@ package org.apache.syncope.core.provisioning.api.propagation;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import java.util.Set;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.AttrMod;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.UserMod;
@@ -38,21 +38,12 @@ public interface PropagationManager {
/**
* Create the group on every associated resource.
*
- * @param wfResult user to be propagated (and info associated), as per result from workflow
- * @param vAttrs virtual attributes to be set
- * @return list of propagation tasks
- */
- List<PropagationTask> getGroupCreateTaskIds(WorkflowResult<Long> wfResult, List<AttrTO> vAttrs);
-
- /**
- * Create the group on every associated resource.
- *
* @param wfResult group to be propagated (and info associated), as per result from workflow
* @param vAttrs virtual attributes to be set
* @param noPropResourceNames external resources performing not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getGroupCreateTaskIds(
+ List<PropagationTask> getGroupCreateTasks(
WorkflowResult<Long> wfResult, Collection<AttrTO> vAttrs, Collection<String> noPropResourceNames);
/**
@@ -64,131 +55,109 @@ public interface PropagationManager {
* @param noPropResourceNames external resources performing not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getGroupCreateTaskIds(Long key, Collection<AttrTO> vAttrs, PropagationByResource propByRes,
+ List<PropagationTask> getGroupCreateTasks(Long key, Collection<AttrTO> vAttrs, PropagationByResource propByRes,
Collection<String> noPropResourceNames);
/**
+ * Performs update on each resource associated to the group.
+ *
+ * @param wfResult group to be propagated (and info associated), as per result from workflow
+ * @param vAttrsToBeRemoved virtual attributes to be removed
+ * @param vAttrsToBeUpdated virtual attributes to be added
+ * @param noPropResourceNames external resource names not to be considered for propagation
+ * @return list of propagation tasks
+ */
+ List<PropagationTask> getGroupUpdateTasks(WorkflowResult<Long> wfResult, Set<String> vAttrsToBeRemoved,
+ Set<AttrMod> vAttrsToBeUpdated, Set<String> noPropResourceNames);
+
+ /**
* Perform delete on each resource associated to the group. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param groupId to be deleted
+ * @param groupKey to be deleted
* @return list of propagation tasks
*/
- List<PropagationTask> getGroupDeleteTaskIds(Long groupId);
+ List<PropagationTask> getGroupDeleteTasks(Long groupKey);
/**
* Perform delete on each resource associated to the group. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param groupId to be deleted
+ * @param groupKey to be deleted
* @param noPropResourceName name of external resource not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getGroupDeleteTaskIds(Long groupId, String noPropResourceName);
+ List<PropagationTask> getGroupDeleteTasks(Long groupKey, String noPropResourceName);
/**
* Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param groupId to be deleted
+ * @param groupKey to be deleted
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getGroupDeleteTaskIds(Long groupId, Collection<String> noPropResourceNames);
+ List<PropagationTask> getGroupDeleteTasks(Long groupKey, Collection<String> noPropResourceNames);
/**
* Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param groupId to be deleted
+ * @param groupKey to be deleted
+ * @param resourceNames resource from which group is to be deleted
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getGroupDeleteTaskIds(
- Long groupId, Set<String> resourceNames, Collection<String> noPropResourceNames);
-
- /**
- * Performs update on each resource associated to the group.
- *
- * @param wfResult group to be propagated (and info associated), as per result from workflow
- * @param vAttrsToBeRemoved virtual attributes to be removed
- * @param vAttrsToBeUpdated virtual attributes to be added
- * @return list of propagation tasks
- */
- List<PropagationTask> getGroupUpdateTaskIds(WorkflowResult<Long> wfResult, Set<String> vAttrsToBeRemoved,
- Set<AttrMod> vAttrsToBeUpdated);
-
- /**
- * Performs update on each resource associated to the group.
- *
- * @param wfResult group to be propagated (and info associated), as per result from workflow
- * @param vAttrsToBeRemoved virtual attributes to be removed
- * @param vAttrsToBeUpdated virtual attributes to be added
- * @param noPropResourceNames external resource names not to be considered for propagation
- * @return list of propagation tasks
- */
- List<PropagationTask> getGroupUpdateTaskIds(WorkflowResult<Long> wfResult, Set<String> vAttrsToBeRemoved,
- Set<AttrMod> vAttrsToBeUpdated, Set<String> noPropResourceNames);
-
- List<PropagationTask> getUpdateTaskIds(Subject<?, ?, ?> subject, String password, boolean changePwd,
- Boolean enable, Set<String> vAttrsToBeRemoved, Set<AttrMod> vAttrsToBeUpdated,
- PropagationByResource propByRes, Collection<String> noPropResourceNames,
- Set<MembershipMod> membershipsToAdd);
-
- /**
- * Create the user on every associated resource.
- *
- * @param wfResult user to be propagated (and info associated), as per result from workflow
- * @param password to be set
- * @param vAttrs virtual attributes to be set
- * @param membershipTOs user memberships
- * @return list of propagation tasks
- */
- List<PropagationTask> getUserCreateTaskIds(WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
- String password, List<AttrTO> vAttrs, List<MembershipTO> membershipTOs);
+ List<PropagationTask> getGroupDeleteTasks(
+ Long groupKey, Set<String> resourceNames, Collection<String> noPropResourceNames);
/**
* Create the user on every associated resource.
*
- * @param wfResult user to be propagated (and info associated), as per result from workflow
+ * @param key to be propagated
+ * @param enable whether user must be enabled or not
+ * @param propByRes operation to be performed per resource
* @param password to be set
* @param vAttrs virtual attributes to be set
* @param noPropResourceNames external resources not to be considered for propagation
* @param membershipTOs user memberships
* @return list of propagation tasks
*/
- List<PropagationTask> getUserCreateTaskIds(WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
- String password, Collection<AttrTO> vAttrs, Set<String> noPropResourceNames,
- List<MembershipTO> membershipTOs);
-
- List<PropagationTask> getUserCreateTaskIds(Long key, Boolean enabled,
+ List<PropagationTask> getUserCreateTasks(Long key, Boolean enable,
PropagationByResource propByRes, String password, Collection<AttrTO> vAttrs,
Collection<MembershipTO> membershipTOs, Collection<String> noPropResourceNames);
/**
- * Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
+ * Performs update on each resource associated to the user excluding the specified into 'resourceNames' parameter.
*
- * @param userKey to be deleted
+ * @param user to be propagated
+ * @param enable whether user must be enabled or not
+ * @param noPropResourceNames external resource names not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getUserDeleteTaskIds(Long userKey);
+ List<PropagationTask> getUserUpdateTasks(User user, Boolean enable, Collection<String> noPropResourceNames);
/**
- * Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
+ * Performs update on each resource associated to the user.
*
- * @param userKey to be deleted
- * @param noPropResourceName name of external resource not to be considered for propagation
+ * @param wfResult user to be propagated (and info associated), as per result from workflow
+ * @param changePwd whether password should be included for propagation attributes or not
+ * @param noPropResourceNames external resources not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getUserDeleteTaskIds(Long userKey, String noPropResourceName);
+ List<PropagationTask> getUserUpdateTasks(WorkflowResult<Pair<UserMod, Boolean>> wfResult,
+ boolean changePwd, Collection<String> noPropResourceNames);
+
+ List<PropagationTask> getUserUpdateTasks(WorkflowResult<Pair<UserMod, Boolean>> wfResult);
+
+ List<PropagationTask> getUpdateTasks(Subject<?, ?, ?> subject, String password, boolean changePwd,
+ Boolean enable, Set<String> vAttrsToBeRemoved, Set<AttrMod> vAttrsToBeUpdated,
+ PropagationByResource propByRes, Collection<String> noPropResourceNames,
+ Set<MembershipMod> membershipsToAdd);
/**
* Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
@@ -199,7 +168,7 @@ public interface PropagationManager {
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getUserDeleteTaskIds(Long userKey, Collection<String> noPropResourceNames);
+ List<PropagationTask> getUserDeleteTasks(Long userKey, Collection<String> noPropResourceNames);
/**
* Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
@@ -211,7 +180,7 @@ public interface PropagationManager {
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getUserDeleteTaskIds(
+ List<PropagationTask> getUserDeleteTasks(
Long userKey, Set<String> resourceNames, Collection<String> noPropResourceNames);
/**
@@ -222,29 +191,6 @@ public interface PropagationManager {
* @param wfResult user to be propagated (and info associated), as per result from workflow
* @return list of propagation tasks
*/
- List<PropagationTask> getUserDeleteTaskIds(WorkflowResult<Long> wfResult);
-
- /**
- * Performs update on each resource associated to the user excluding the specified into 'resourceNames' parameter.
- *
- * @param user to be propagated
- * @param enable whether user must be enabled or not
- * @param noPropResourceNames external resource names not to be considered for propagation
- * @return list of propagation tasks
- */
- List<PropagationTask> getUserUpdateTaskIds(User user, Boolean enable, Collection<String> noPropResourceNames);
-
- /**
- * Performs update on each resource associated to the user.
- *
- * @param wfResult user to be propagated (and info associated), as per result from workflow
- * @param changePwd whether password should be included for propagation attributes or not
- * @param noPropResourceNames external resources not to be considered for propagation
- * @return list of propagation tasks
- */
- List<PropagationTask> getUserUpdateTaskIds(WorkflowResult<Map.Entry<UserMod, Boolean>> wfResult,
- boolean changePwd, Collection<String> noPropResourceNames);
-
- List<PropagationTask> getUserUpdateTaskIds(WorkflowResult<Map.Entry<UserMod, Boolean>> wfResult);
+ List<PropagationTask> getUserDeleteTasks(WorkflowResult<Long> wfResult);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnIdBundleManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnIdBundleManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnIdBundleManagerImpl.java
index c7ea22a..268453a 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnIdBundleManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnIdBundleManagerImpl.java
@@ -33,8 +33,9 @@ import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
-import org.apache.syncope.core.provisioning.api.URIUtil;
+import org.apache.syncope.core.provisioning.api.URIUtils;
import org.identityconnectors.common.IOUtil;
import org.identityconnectors.common.security.GuardedString;
import org.identityconnectors.framework.api.APIConfiguration;
@@ -81,7 +82,7 @@ public class ConnIdBundleManagerImpl implements ConnIdBundleManager {
locations = new ArrayList<>();
for (String location : StringUtils.isBlank(stringLocations) ? new String[0] : stringLocations.split(",")) {
try {
- locations.add(URIUtil.buildForConnId(location));
+ locations.add(URIUtils.buildForConnId(location));
LOG.info("Valid ConnId location: {}", location.trim());
} catch (Exception e) {
LOG.error("Invalid ConnId location: {}", location.trim(), e);
@@ -223,19 +224,18 @@ public class ConnIdBundleManagerImpl implements ConnIdBundleManager {
}
@Override
- public ConnectorInfo getConnectorInfo(
- final String location, final String bundleName, final String bundleVersion, final String connectorName) {
-
+ public ConnectorInfo getConnectorInfo(final ConnInstance connInstance) {
// check ConnIdLocation
URI uriLocation = null;
try {
- uriLocation = URIUtil.buildForConnId(location);
+ uriLocation = URIUtils.buildForConnId(connInstance.getLocation());
} catch (Exception e) {
- throw new IllegalArgumentException("Invalid ConnId location " + location, e);
+ throw new IllegalArgumentException("Invalid ConnId location " + connInstance.getLocation(), e);
}
// create key for search all properties
- final ConnectorKey key = new ConnectorKey(bundleName, bundleVersion, connectorName);
+ ConnectorKey key = new ConnectorKey(
+ connInstance.getBundleName(), connInstance.getVersion(), connInstance.getConnectorName());
if (LOG.isDebugEnabled()) {
LOG.debug("\nBundle name: " + key.getBundleName()
@@ -249,7 +249,7 @@ public class ConnIdBundleManagerImpl implements ConnIdBundleManager {
info = getConnManagers().get(uriLocation).findConnectorInfo(key);
}
if (info == null) {
- throw new NotFoundException("Connector Info for location " + location + " and key " + key);
+ throw new NotFoundException("ConnectorInfo for location " + connInstance.getLocation() + " and key " + key);
}
return info;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
index 8516804..3c76b82 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
@@ -35,7 +35,7 @@ import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
-import org.apache.syncope.core.provisioning.api.ConnPoolConfUtil;
+import org.apache.syncope.core.provisioning.api.ConnPoolConfUtils;
import org.apache.syncope.core.provisioning.api.Connector;
import org.apache.syncope.core.provisioning.api.TimeoutException;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
@@ -99,8 +99,7 @@ public class ConnectorFacadeProxy implements Connector {
ConnIdBundleManager connIdBundleManager =
ApplicationContextProvider.getApplicationContext().getBean(ConnIdBundleManager.class);
- ConnectorInfo info = connIdBundleManager.getConnectorInfo(connInstance.getLocation(),
- connInstance.getBundleName(), connInstance.getVersion(), connInstance.getConnectorName());
+ ConnectorInfo info = connIdBundleManager.getConnectorInfo(connInstance);
// create default configuration
APIConfiguration apiConfig = info.createDefaultAPIConfiguration();
@@ -117,7 +116,7 @@ public class ConnectorFacadeProxy implements Connector {
// set pooling configuration (if supported) according to conninstance's
if (connInstance.getPoolConf() != null) {
if (apiConfig.isConnectorPoolingSupported()) {
- ConnPoolConfUtil.updateObjectPoolConfiguration(
+ ConnPoolConfUtils.updateObjectPoolConfiguration(
apiConfig.getConnectorPoolConfiguration(), connInstance.getPoolConf());
} else {
LOG.warn("Connector pooling not supported for {}", info);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
index 2adbdd0..bf16b8d 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
@@ -18,7 +18,6 @@
*/
package org.apache.syncope.core.provisioning.java;
-import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -31,12 +30,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.GroupMod;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
@@ -46,7 +46,6 @@ import org.apache.syncope.core.provisioning.api.propagation.PropagationException
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
@@ -67,19 +66,16 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
protected GroupDAO groupDAO;
@Override
- public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO subject) {
+ public Pair<Long, List<PropagationStatus>> create(final GroupTO subject) {
return create(subject, Collections.<String>emptySet());
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO subject, final Set<String> excludedResources) {
+ public Pair<Long, List<PropagationStatus>> create(final GroupTO subject, final Set<String> excludedResources) {
WorkflowResult<Long> created = gwfAdapter.create(subject);
- AuthContextUtil.extendAuthContext(created.getResult(), GroupEntitlementUtil.getEntitlementNameFromGroupKey(
- created.getResult()));
-
List<PropagationTask> tasks =
- propagationManager.getGroupCreateTaskIds(created, subject.getVirAttrs(), excludedResources);
+ propagationManager.getGroupCreateTasks(created, subject.getVirAttrs(), excludedResources);
PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().getBean(
PropagationReporter.class);
try {
@@ -89,11 +85,11 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
propagationReporter.onPrimaryResourceFailure(tasks);
}
- return new AbstractMap.SimpleEntry<>(created.getResult(), propagationReporter.getStatuses());
+ return new ImmutablePair<>(created.getResult(), propagationReporter.getStatuses());
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> create(
+ public Pair<Long, List<PropagationStatus>> create(
final GroupTO groupTO, final Map<Long, String> groupOwnerMap, final Set<String> excludedResources) {
WorkflowResult<Long> created = gwfAdapter.create(groupTO);
@@ -102,30 +98,27 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
groupOwnerMap.put(created.getResult(), groupOwner.getValues().iterator().next());
}
- AuthContextUtil.extendAuthContext(created.getResult(),
- GroupEntitlementUtil.getEntitlementNameFromGroupKey(created.getResult()));
-
- List<PropagationTask> tasks = propagationManager.getGroupCreateTaskIds(
+ List<PropagationTask> tasks = propagationManager.getGroupCreateTasks(
created, groupTO.getVirAttrs(), excludedResources);
taskExecutor.execute(tasks);
- return new AbstractMap.SimpleEntry<>(created.getResult(), null);
+ return new ImmutablePair<>(created.getResult(), null);
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> update(final GroupMod subjectMod) {
+ public Pair<Long, List<PropagationStatus>> update(final GroupMod subjectMod) {
return update(subjectMod, Collections.<String>emptySet());
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> update(
+ public Pair<Long, List<PropagationStatus>> update(
final GroupMod subjectMod, final Set<String> excludedResources) {
WorkflowResult<Long> updated = gwfAdapter.update(subjectMod);
- List<PropagationTask> tasks = propagationManager.getGroupUpdateTaskIds(updated,
- subjectMod.getVirAttrsToRemove(), subjectMod.getVirAttrsToUpdate());
+ List<PropagationTask> tasks = propagationManager.getGroupUpdateTasks(updated,
+ subjectMod.getVirAttrsToRemove(), subjectMod.getVirAttrsToUpdate(), null);
PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
@@ -135,41 +128,29 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
propagationReporter.onPrimaryResourceFailure(tasks);
}
- Map.Entry<Long, List<PropagationStatus>> result = new AbstractMap.SimpleEntry<>(
+ Pair<Long, List<PropagationStatus>> result = new ImmutablePair<>(
updated.getResult(), propagationReporter.getStatuses());
return result;
}
@Override
public List<PropagationStatus> delete(final Long subjectKey) {
- final List<Group> toBeDeprovisioned = new ArrayList<>();
-
- final Group syncopeGroup = groupDAO.find(subjectKey);
-
- if (syncopeGroup != null) {
- toBeDeprovisioned.add(syncopeGroup);
-
- final List<Group> descendants = groupDAO.findDescendants(toBeDeprovisioned.get(0));
- if (descendants != null) {
- toBeDeprovisioned.addAll(descendants);
- }
- }
-
final List<PropagationTask> tasks = new ArrayList<>();
- for (Group group : toBeDeprovisioned) {
+ Group group = groupDAO.authFetch(subjectKey);
+ if (group != null) {
// Generate propagation tasks for deleting users from group resources, if they are on those resources only
// because of the reason being deleted (see SYNCOPE-357)
- for (Map.Entry<Long, PropagationByResource> entry : groupDAO.findUsersWithIndirectResources(group.
- getKey()).entrySet()) {
+ for (Map.Entry<Long, PropagationByResource> entry
+ : groupDAO.findUsersWithIndirectResources(group.getKey()).entrySet()) {
WorkflowResult<Long> wfResult =
new WorkflowResult<>(entry.getKey(), entry.getValue(), Collections.<String>emptySet());
- tasks.addAll(propagationManager.getUserDeleteTaskIds(wfResult));
+ tasks.addAll(propagationManager.getUserDeleteTasks(wfResult));
}
// Generate propagation tasks for deleting this group from resources
- tasks.addAll(propagationManager.getGroupDeleteTaskIds(group.getKey()));
+ tasks.addAll(propagationManager.getGroupDeleteTasks(group.getKey()));
}
PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
@@ -202,7 +183,7 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
Collection<String> noPropResourceName = CollectionUtils.removeAll(group.getResourceNames(), resources);
- List<PropagationTask> tasks = propagationManager.getGroupDeleteTaskIds(
+ List<PropagationTask> tasks = propagationManager.getGroupDeleteTasks(
groupKey, new HashSet<>(resources), noPropResourceName);
PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
index 4eb425f..ce28830 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
@@ -18,14 +18,14 @@
*/
package org.apache.syncope.core.provisioning.java;
-import java.util.AbstractMap;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
@@ -68,28 +68,34 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
protected UserDAO userDAO;
@Override
- public Map.Entry<Long, List<PropagationStatus>> create(final UserTO userTO) {
+ public Pair<Long, List<PropagationStatus>> create(final UserTO userTO) {
return create(userTO, true, false, null, Collections.<String>emptySet());
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword) {
+ public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword) {
return create(userTO, storePassword, false, null, Collections.<String>emptySet());
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword,
+ public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword,
final boolean disablePwdPolicyCheck, final Boolean enabled, final Set<String> excludedResources) {
- WorkflowResult<Map.Entry<Long, Boolean>> created;
+ WorkflowResult<Pair<Long, Boolean>> created;
try {
created = uwfAdapter.create(userTO, disablePwdPolicyCheck, enabled, storePassword);
} catch (PropagationException e) {
throw e;
}
- List<PropagationTask> tasks = propagationManager.getUserCreateTaskIds(
- created, userTO.getPassword(), userTO.getVirAttrs(), excludedResources, userTO.getMemberships());
+ List<PropagationTask> tasks = propagationManager.getUserCreateTasks(
+ created.getResult().getKey(),
+ created.getResult().getValue(),
+ created.getPropByRes(),
+ userTO.getPassword(),
+ userTO.getVirAttrs(),
+ userTO.getMemberships(),
+ excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
@@ -99,19 +105,19 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
propagationReporter.onPrimaryResourceFailure(tasks);
}
- return new AbstractMap.SimpleEntry<>(created.getResult().getKey(), propagationReporter.getStatuses());
+ return new ImmutablePair<>(created.getResult().getKey(), propagationReporter.getStatuses());
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> update(final UserMod userMod) {
+ public Pair<Long, List<PropagationStatus>> update(final UserMod userMod) {
return update(userMod, false);
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> update(final UserMod userMod, final boolean removeMemberships) {
- WorkflowResult<Map.Entry<UserMod, Boolean>> updated = uwfAdapter.update(userMod);
+ public Pair<Long, List<PropagationStatus>> update(final UserMod userMod, final boolean removeMemberships) {
+ WorkflowResult<Pair<UserMod, Boolean>> updated = uwfAdapter.update(userMod);
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(updated);
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(updated);
if (tasks.isEmpty()) {
// SYNCOPE-459: take care of user virtual attributes ...
final PropagationByResource propByResVirAttr = virtAttrHandler.fillVirtual(
@@ -133,7 +139,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
}
}
tasks.addAll(!propByResVirAttr.isEmpty() || addOrUpdateMemberships || removeMemberships
- ? propagationManager.getUserUpdateTaskIds(updated, false, null)
+ ? propagationManager.getUserUpdateTasks(updated, false, null)
: Collections.<PropagationTask>emptyList());
}
PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
@@ -147,7 +153,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
}
}
- Map.Entry<Long, List<PropagationStatus>> result = new AbstractMap.SimpleEntry<>(
+ Pair<Long, List<PropagationStatus>> result = new ImmutablePair<>(
updated.getResult().getKey().getKey(), propagationReporter.getStatuses());
return result;
}
@@ -164,7 +170,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
// information could only be available after uwfAdapter.delete(), which
// will also effectively remove user from db, thus making virtually
// impossible by NotificationManager to fetch required user information
- List<PropagationTask> tasks = propagationManager.getUserDeleteTaskIds(subjectId, excludedResources);
+ List<PropagationTask> tasks = propagationManager.getUserDeleteTasks(subjectId, excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
@@ -186,7 +192,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
@Override
public Long unlink(final UserMod userMod) {
- WorkflowResult<Map.Entry<UserMod, Boolean>> updated = uwfAdapter.update(userMod);
+ WorkflowResult<Pair<UserMod, Boolean>> updated = uwfAdapter.update(userMod);
return updated.getResult().getKey().getKey();
}
@@ -196,49 +202,37 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> activate(final User user, final StatusMod statusMod) {
- WorkflowResult<Long> updated;
- if (statusMod.isOnSyncope()) {
- updated = uwfAdapter.activate(user.getKey(), statusMod.getToken());
- } else {
- updated = new WorkflowResult<>(user.getKey(), null, statusMod.getType().name().toLowerCase());
- }
+ public Pair<Long, List<PropagationStatus>> activate(final User user, final StatusMod statusMod) {
+ WorkflowResult<Long> updated = statusMod.isOnSyncope()
+ ? uwfAdapter.activate(user.getKey(), statusMod.getToken())
+ : new WorkflowResult<>(user.getKey(), null, statusMod.getType().name().toLowerCase());
- List<PropagationStatus> statuses = propagateStatus(user, statusMod);
- return new AbstractMap.SimpleEntry<>(updated.getResult(), statuses);
+ return new ImmutablePair<>(updated.getResult(), propagateStatus(user, statusMod));
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> reactivate(final User user, final StatusMod statusMod) {
- WorkflowResult<Long> updated;
- if (statusMod.isOnSyncope()) {
- updated = uwfAdapter.reactivate(user.getKey());
- } else {
- updated = new WorkflowResult<>(user.getKey(), null, statusMod.getType().name().toLowerCase());
- }
+ public Pair<Long, List<PropagationStatus>> reactivate(final User user, final StatusMod statusMod) {
+ WorkflowResult<Long> updated = statusMod.isOnSyncope()
+ ? uwfAdapter.reactivate(user.getKey())
+ : new WorkflowResult<>(user.getKey(), null, statusMod.getType().name().toLowerCase());
- List<PropagationStatus> statuses = propagateStatus(user, statusMod);
- return new AbstractMap.SimpleEntry<>(updated.getResult(), statuses);
+ return new ImmutablePair<>(updated.getResult(), propagateStatus(user, statusMod));
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> suspend(final User user, final StatusMod statusMod) {
- WorkflowResult<Long> updated;
- if (statusMod.isOnSyncope()) {
- updated = uwfAdapter.suspend(user.getKey());
- } else {
- updated = new WorkflowResult<>(user.getKey(), null, statusMod.getType().name().toLowerCase());
- }
+ public Pair<Long, List<PropagationStatus>> suspend(final User user, final StatusMod statusMod) {
+ WorkflowResult<Long> updated = statusMod.isOnSyncope()
+ ? uwfAdapter.suspend(user.getKey())
+ : new WorkflowResult<>(user.getKey(), null, statusMod.getType().name().toLowerCase());
- List<PropagationStatus> statuses = propagateStatus(user, statusMod);
- return new AbstractMap.SimpleEntry<>(updated.getResult(), statuses);
+ return new ImmutablePair<>(updated.getResult(), propagateStatus(user, statusMod));
}
protected List<PropagationStatus> propagateStatus(final User user, final StatusMod statusMod) {
Collection<String> noPropResourceNames =
CollectionUtils.removeAll(user.getResourceNames(), statusMod.getResourceNames());
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(
user, statusMod.getType() != StatusMod.ModType.SUSPEND, noPropResourceNames);
PropagationReporter propReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
@@ -262,9 +256,9 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
UserMod userMod = new UserMod();
userMod.setKey(updated.getResult());
- final List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
- new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new AbstractMap.SimpleEntry<>(userMod, Boolean.FALSE),
+ final List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(
+ new WorkflowResult<Pair<UserMod, Boolean>>(
+ new ImmutablePair<>(userMod, Boolean.FALSE),
updated.getPropByRes(), updated.getPerformedTasks()));
taskExecutor.execute(tasks);
@@ -278,7 +272,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
Collection<String> noPropResourceNames = CollectionUtils.removeAll(user.getResourceNames(), resources);
final List<PropagationTask> tasks =
- propagationManager.getUserDeleteTaskIds(userKey, new HashSet<>(resources), noPropResourceNames);
+ propagationManager.getUserDeleteTasks(userKey, new HashSet<>(resources), noPropResourceNames);
final PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
@@ -292,10 +286,10 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
}
@Override
- public Map.Entry<Long, List<PropagationStatus>> update(final UserMod userMod, final Long key,
+ public Pair<Long, List<PropagationStatus>> update(final UserMod userMod, final Long key,
final ProvisioningResult result, final Boolean enabled, final Set<String> excludedResources) {
- WorkflowResult<Map.Entry<UserMod, Boolean>> updated;
+ WorkflowResult<Pair<UserMod, Boolean>> updated;
try {
updated = uwfAdapter.update(userMod);
} catch (Exception e) {
@@ -304,8 +298,8 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
result.setStatus(ProvisioningResult.Status.FAILURE);
result.setMessage("Update failed, trying to sync status anyway (if configured)\n" + e.getMessage());
- updated = new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new AbstractMap.SimpleEntry<>(userMod, false), new PropagationByResource(),
+ updated = new WorkflowResult<Pair<UserMod, Boolean>>(
+ new ImmutablePair<>(userMod, false), new PropagationByResource(),
new HashSet<String>());
}
@@ -330,7 +324,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
}
}
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(
updated, updated.getResult().getKey().getPassword() != null, excludedResources);
PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
getBean(PropagationReporter.class);
@@ -341,7 +335,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
propagationReporter.onPrimaryResourceFailure(tasks);
}
- return new AbstractMap.SimpleEntry<>(updated.getResult().getKey().getKey(),
+ return new ImmutablePair<>(updated.getResult().getKey().getKey(),
propagationReporter.getStatuses());
}
@@ -355,7 +349,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
public void confirmPasswordReset(final User user, final String token, final String password) {
uwfAdapter.confirmPasswordReset(user.getKey(), token, password);
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(user, null, null);
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(user, null, null);
PropagationReporter propReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandler.java
index c948de4..6354041 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandler.java
@@ -31,14 +31,13 @@ import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.MembershipDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.VirAttrDAO;
import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
import org.apache.syncope.core.persistence.api.entity.Subject;
@@ -65,9 +64,6 @@ public class VirAttrHandler {
private static final Logger LOG = LoggerFactory.getLogger(VirAttrHandler.class);
@Autowired
- private ExternalResourceDAO resourceDAO;
-
- @Autowired
private VirSchemaDAO virSchemaDAO;
@Autowired
@@ -80,7 +76,7 @@ public class VirAttrHandler {
private MembershipDAO membershipDAO;
@Autowired
- private AttributableUtilFactory attrUtilFactory;
+ private AttributableUtilsFactory attrUtilsFactory;
public <T extends VirSchema> T getVirSchema(final String virSchemaName, final Class<T> reference) {
T virtualSchema = null;
@@ -116,12 +112,12 @@ public class VirAttrHandler {
}
}
- public void updateOnResourcesIfMappingMatches(final AttributableUtil attrUtil, final String schemaKey,
+ public void updateOnResourcesIfMappingMatches(final AttributableUtils attrUtils, final String schemaKey,
final Set<ExternalResource> resources, final IntMappingType mappingType,
final PropagationByResource propByRes) {
for (ExternalResource resource : resources) {
- for (MappingItem mapItem : attrUtil.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
+ for (MappingItem mapItem : attrUtils.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
if (schemaKey.equals(mapItem.getIntAttrName()) && mapItem.getIntMappingType() == mappingType) {
propByRes.add(ResourceOperation.UPDATE, resource.getKey());
}
@@ -132,7 +128,7 @@ public class VirAttrHandler {
@SuppressWarnings({ "unchecked", "rawtypes" })
public PropagationByResource fillVirtual(final Attributable attributable,
final Set<String> vAttrsToBeRemoved, final Set<AttrMod> vAttrsToBeUpdated,
- final AttributableUtil attrUtil) {
+ final AttributableUtils attrUtils) {
PropagationByResource propByRes = new PropagationByResource();
@@ -146,7 +142,7 @@ public class VirAttrHandler {
// 1. virtual attributes to be removed
for (String vAttrToBeRemoved : vAttrsToBeRemoved) {
- VirSchema virSchema = getVirSchema(vAttrToBeRemoved, attrUtil.virSchemaClass());
+ VirSchema virSchema = getVirSchema(vAttrToBeRemoved, attrUtils.virSchemaClass());
if (virSchema != null) {
VirAttr virAttr = attributable.getVirAttr(virSchema.getKey());
if (virAttr == null) {
@@ -157,9 +153,9 @@ public class VirAttrHandler {
}
for (ExternalResource resource : externalResources) {
- for (MappingItem mapItem : attrUtil.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
+ for (MappingItem mapItem : attrUtils.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
if (virSchema.getKey().equals(mapItem.getIntAttrName())
- && mapItem.getIntMappingType() == attrUtil.virIntMappingType()) {
+ && mapItem.getIntMappingType() == attrUtils.virIntMappingType()) {
propByRes.add(ResourceOperation.UPDATE, resource.getKey());
@@ -177,12 +173,12 @@ public class VirAttrHandler {
// 2. virtual attributes to be updated
for (AttrMod vAttrToBeUpdated : vAttrsToBeUpdated) {
- VirSchema virSchema = getVirSchema(vAttrToBeUpdated.getSchema(), attrUtil.virSchemaClass());
+ VirSchema virSchema = getVirSchema(vAttrToBeUpdated.getSchema(), attrUtils.virSchemaClass());
VirAttr virAttr = null;
if (virSchema != null) {
virAttr = attributable.getVirAttr(virSchema.getKey());
if (virAttr == null) {
- virAttr = attrUtil.newVirAttr();
+ virAttr = attrUtils.newVirAttr();
setVirAttrSchema(attributable, virAttr, virSchema);
if (virAttr.getSchema() == null) {
LOG.debug("Ignoring {} because no valid schema or template was found", vAttrToBeUpdated);
@@ -194,10 +190,10 @@ public class VirAttrHandler {
if (virSchema != null && virAttr != null && virAttr.getSchema() != null) {
if (attributable instanceof Subject) {
- updateOnResourcesIfMappingMatches(attrUtil, virSchema.getKey(),
- externalResources, attrUtil.derIntMappingType(), propByRes);
+ updateOnResourcesIfMappingMatches(attrUtils, virSchema.getKey(),
+ externalResources, attrUtils.derIntMappingType(), propByRes);
} else if (attributable instanceof Membership) {
- updateOnResourcesIfMappingMatches(attrUtil, virSchema.getKey(),
+ updateOnResourcesIfMappingMatches(attrUtils, virSchema.getKey(),
externalResources, IntMappingType.MembershipVirtualSchema, propByRes);
}
@@ -223,18 +219,18 @@ public class VirAttrHandler {
*
* @param attributable attributable.
* @param vAttrs virtual attributes to be added.
- * @param attrUtil attributable util.
+ * @param attrUtils attributable util.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void fillVirtual(final Attributable attributable, final Collection<AttrTO> vAttrs,
- final AttributableUtil attrUtil) {
+ final AttributableUtils attrUtils) {
for (AttrTO attributeTO : vAttrs) {
VirAttr virAttr = attributable.getVirAttr(attributeTO.getSchema());
if (virAttr == null) {
- VirSchema virSchema = getVirSchema(attributeTO.getSchema(), attrUtil.virSchemaClass());
+ VirSchema virSchema = getVirSchema(attributeTO.getSchema(), attrUtils.virSchemaClass());
if (virSchema != null) {
- virAttr = attrUtil.newVirAttr();
+ virAttr = attrUtils.newVirAttr();
setVirAttrSchema(attributable, virAttr, virSchema);
if (virAttr.getSchema() == null) {
LOG.debug("Ignoring {} because no valid schema or template was found", attributeTO);
@@ -267,7 +263,7 @@ public class VirAttrHandler {
userDAO.authFetch(key),
vAttrsToBeRemoved,
vAttrsToBeUpdated,
- attrUtilFactory.getInstance(AttributableType.USER));
+ attrUtilsFactory.getInstance(AttributableType.USER));
}
private Set<String> getAttrNames(final List<? extends VirAttr> virAttrs) {
@@ -302,12 +298,12 @@ public class VirAttrHandler {
membership,
getAttrNames(membership.getVirAttrs()),
vAttrsToBeUpdated,
- attrUtilFactory.getInstance(AttributableType.MEMBERSHIP))
+ attrUtilsFactory.getInstance(AttributableType.MEMBERSHIP))
: fillVirtual(
membership,
vAttrsToBeRemoved,
vAttrsToBeUpdated,
- attrUtilFactory.getInstance(AttributableType.MEMBERSHIP));
+ attrUtilsFactory.getInstance(AttributableType.MEMBERSHIP));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/DisabledVirAttrCache.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/DisabledVirAttrCache.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/DisabledVirAttrCache.java
index 3c3dcca..faaa070 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/DisabledVirAttrCache.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/DisabledVirAttrCache.java
@@ -27,6 +27,10 @@ import org.apache.syncope.core.provisioning.api.cache.VirAttrCacheValue;
*/
public class DisabledVirAttrCache implements VirAttrCache {
+ public DisabledVirAttrCache(final int ttl, final int maxCacheSize) {
+ // ignore
+ }
+
@Override
public void expire(final AttributableType type, final Long id, final String schemaName) {
// nothing to do
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/MemoryVirAttrCache.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/MemoryVirAttrCache.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/MemoryVirAttrCache.java
index 8a32e99..885b194 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/MemoryVirAttrCache.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/MemoryVirAttrCache.java
@@ -46,7 +46,7 @@ public class MemoryVirAttrCache implements VirAttrCache {
/**
* Cache entries.
*/
- protected final Map<VirAttrCacheKey, VirAttrCacheValue> cache = new HashMap<VirAttrCacheKey, VirAttrCacheValue>();
+ protected final Map<VirAttrCacheKey, VirAttrCacheValue> cache = new HashMap<>();
public MemoryVirAttrCache(final int ttl, final int maxCacheSize) {
this.ttl = ttl;
@@ -56,8 +56,8 @@ public class MemoryVirAttrCache implements VirAttrCache {
/**
* Cache virtual attribute values.
*
- * @param type user or group
- * @param key user or group id
+ * @param type user, group or membership
+ * @param key attributable key
* @param schemaName virtual attribute name
* @param value virtual attribute values
*/
@@ -81,26 +81,26 @@ public class MemoryVirAttrCache implements VirAttrCache {
/**
* Retrieve cached value. Return null in case of virtual attribute not cached.
*
- * @param type user or group
- * @param id user or group id
+ * @param type user, group or membership
+ * @param key attributable key
* @param schemaName virtual attribute schema name.
* @return cached values or null if virtual attribute is not cached.
*/
@Override
- public VirAttrCacheValue get(final AttributableType type, final Long id, final String schemaName) {
- return cache.get(new VirAttrCacheKey(type, id, schemaName));
+ public VirAttrCacheValue get(final AttributableType type, final Long key, final String schemaName) {
+ return cache.get(new VirAttrCacheKey(type, key, schemaName));
}
/**
* Force entry expiring.
*
- * @param type user or group
- * @param id user or group id
+ * @param type user, group or membership
+ * @param key attributable key
* @param schemaName virtual attribute schema name
*/
@Override
- public void expire(final AttributableType type, final Long id, final String schemaName) {
- final VirAttrCacheValue value = cache.get(new VirAttrCacheKey(type, id, schemaName));
+ public void expire(final AttributableType type, final Long key, final String schemaName) {
+ final VirAttrCacheValue value = cache.get(new VirAttrCacheKey(type, key, schemaName));
if (isValidEntry(value)) {
synchronized (cache) {
value.forceExpiring();
[21/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel_it.properties
deleted file mode 100644
index 7938bae..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel_it.properties
+++ /dev/null
@@ -1,22 +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.
-name=Nome
-userOwner=Proprietario (utente)
-roleOwner=Proprietario (ruolo)
-inheritOwner=Eredita proprietario
-parent=Padre
-inheritTemplates=Eredita modelli
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel_pt_BR.properties
deleted file mode 100644
index eadc335..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel_pt_BR.properties
+++ /dev/null
@@ -1,22 +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.
-name=Nome
-userOwner=Dono (usu\u00e1rio)
-roleOwner=Dono (fun\u00e7\u00e3o)
-inheritOwner=Dono herdado
-parent=Parente
-inheritTemplates=Modelo herdado
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel.html
deleted file mode 100644
index b1729c1..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel.html
+++ /dev/null
@@ -1,88 +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 id="details">
- <span wicket:id="details">[role details]</span>
- <span wicket:id="statuspanel">[Status Panel]</span>
- <span wicket:id="systeminformation">[System Information]</span>
- </div>
-
- <div id="templates">
- <span wicket:id="templates">[templates]</span>
- </div>
-
- <div id="plainAttrs">
- <div id="formtable">
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <wicket:message key="inheritPlainAttrs"/>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="inheritPlainAttrs" />
- </div>
- </div>
-
- <span wicket:id="plainAttrs">[role attributes]</span>
- </div>
- </div>
-
- <div id="derAttrs">
- <div id="formtable">
- <div class="tablerow alt">
- <div class="tablecolumn_label short_dynamicsize">
- <wicket:message key="inheritDerAttrs"/>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="inheritDerAttrs" />
- </div>
- </div>
-
- <span wicket:id="derAttrs">[role derived attributes]</span>
- </div>
- </div>
-
- <div id="virAttrs">
- <div id="formtable">
- <div class="tablerow alt">
- <div class="tablecolumn_label short_dynamicsize">
- <wicket:message key="inheritVirAttrs"/>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="inheritVirAttrs" />
- </div>
- </div>
-
- <span wicket:id="virAttrs">[role virtual attributes]</span>
- </div>
- </div>
-
- <div id="resources">
- <span wicket:id="resources">[resources]</span>
- </div>
- <div id="entitlements">
- <span wicket:id="entitlements">[entitlements]</span>
- </div>
- <div id="security">
- <span wicket:id="security">[security]</span>
- </div>
-
- </wicket:panel>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel.properties
deleted file mode 100644
index 86aace6..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel.properties
+++ /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.
-required_alert=All form fields are required.
-add=+
-drop=-
-error=Generic error occurred during the operation
-name=Name
-firstResourcesList=Role's resources
-secondResourcesList=Available resources
-firstEntitlementsList=Role's entitlements
-secondEntitlementsList=Available entitlements
-
-addAttributeBtn=Add
-required_alert=All form fields are required.
-add=+
-drop=-
-error=Generic error occurred during the operation
-name=Name
-firstResourcesList=Role's resources
-secondResourcesList=Available resources
-firstEntitlementsList=Role's entitlements
-secondEntitlementsList=Available entitlements
-derAttrs=Derived Attributes
-derAttrToRemove=Delete
-derAttrName=Name
-derAttrValue=Derived value
-
-virAttrs=Virtual Attributes
-virAttrToRemove=Delete
-virAttrName=Name
-virAttrValue=Virtual value
-
-addAttributeBtn=Add
-
-inheritPlainAttrs=Inherit plain attributes
-inheritDerAttrs=Inherit derived attributes
-inheritVirAttrs=Inherit virtual attributes
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel_it.properties
deleted file mode 100644
index 068abdc..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel_it.properties
+++ /dev/null
@@ -1,53 +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.
-required_alert=All form fields are required.
-add=+
-drop=-
-name=Nome
-error=Errore generico durante l'operazione
-firstResourcesList=Risorse ruolo
-secondResourcesList=Risorse disponibili
-firstResourcesList=Entitlement ruolo
-secondResourcesList=Entitlement disponibili
-
-addAttributeBtn=Aggiungi
-required_alert=Tutti i valori sono richiesti.
-add=+
-drop=-
-name=Nome
-error=Errore generico durante l'operazione
-firstResourcesList=Risorse ruolo
-secondResourcesList=Risorse disponibili
-firstResourcesList=Risorse ruolo
-secondResourcesList=Risorse disponibili
-derAttrs=Attributi derivati
-derAttrToRemove=Rimuovi
-derAttrName=Nome
-derAttrValue=Valore derivato
-
-virAttrs=Attributi virtuali
-virAttrToRemove=Rimuovi
-virAttrName=Nome
-virAttrValue=Valore virtuale
-
-addAttributeBtn=Aggiungi
-
-inheritPlainAttrs=Eredita attributi normali
-inheritDerAttrs=Eredita attributi derivati
-inheritVirAttrs=Eredita attributi virtuali
-firstEntitlementsList=Entitlement ruolo
-secondEntitlementsList=Entitlement disponibili
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel_pt_BR.properties
deleted file mode 100644
index e480811..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RolePanel_pt_BR.properties
+++ /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.
-required_alert=Todos os campos s\u00e3o obrigat\u00f3rios
-add=+
-drop=-
-error=Um erro gen\u00e9rico ocorreu durante a opera\u00e7\u00e3o
-name=Nome
-firstResourcesList=Recursos de Fun\u00e7\u00f5es
-secondResourcesList=Recursos Dipon\u00edveis
-firstEntitlementsList=Direitos de Fun\u00e7\u00f5es
-secondEntitlementsList=Direitos Dispon\u00edveis
-derAttrs=Atributos Derivados
-derAttrToRemove=Remover
-derAttrName=Nome
-derAttrValue=Valor Derivado
-
-virAttrs=Atributos Virtuais
-virAttrToRemove=Remover
-virAttrName=Nome
-virAttrValue=Valor Virtual
-
-addAttributeBtn=Adicionar
-
-inheritPlainAttrs=Atributos Herdados Normal
-inheritDerAttrs=Atributos Herdados Derivados
-inheritVirAttrs=Atributos Virtuais Herdados
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel.html
deleted file mode 100644
index 61b609e..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel.html
+++ /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.
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
- <wicket:panel>
- <div id="formtable" wicket:id="security">
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <label for="inheritPasswordPolicy"><wicket:message key="inheritPasswordPolicy"/></label>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="inheritPasswordPolicy">
- [panel for dynamic input type markup]
- </span>
- </div>
- </div>
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <label for="passwordPolicy"><wicket:message key="passwordPolicy"/></label>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="passwordPolicy">
- [panel for dynamic input type markup]
- </span>
- </div>
- </div>
-
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <label for="inheritAccountPolicy"><wicket:message key="inheritAccountPolicy"/></label>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="inheritAccountPolicy">
- [panel for dynamic input type markup]
- </span>
- </div>
- </div>
-
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <label for="accountPolicy"><wicket:message key="accountPolicy"/></label>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="accountPolicy">
- [panel for dynamic input type markup]
- </span>
- </div>
- </div>
- </div>
- </wicket:panel>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel.properties
deleted file mode 100644
index 167673d..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel.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.
-inheritPasswordPolicy = Inherit password policy
-inheritAccountPolicy = Inherit account policy
-passwordPolicy = Password Policy
-accountPolicy = Account Policy
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel_it.properties
deleted file mode 100644
index 6e7c6ed..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel_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.
-inheritPasswordPolicy = Eredita password policy
-inheritAccountPolicy = Eredita account policy
-passwordPolicy = Password Policy
-accountPolicy = Account Policy
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel_pt_BR.properties
deleted file mode 100644
index 5c77adc..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSecurityPanel_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.
-inheritPasswordPolicy = Pol\u00EDtica de Senha Herdada
-inheritAccountPolicy = Pol\u00EDtica de Conta Herdada
-passwordPolicy = Pol\u00EDtica de Senha
-accountPolicy = Pol\u00EDtica de Conta
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSummaryPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSummaryPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSummaryPanel.html
deleted file mode 100644
index 3d5e7b9..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleSummaryPanel.html
+++ /dev/null
@@ -1,39 +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>
-
- <span wicket:id="roleSummaryPanel">[Role panel]</span>
-
- <wicket:fragment wicket:id="roleViewPanel">
- <span wicket:id="nodeViewPanel"></span>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="rootPanel">
- <div style="float:left; width:70%;">
- <p style="height:15px; margin-top: 0px;" class="ui-widget ui-corner-all ui-widget-header">
- <span style="float:right;" wicket:id="actionLinks"/>
- </p>
- </div>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="fakerootFrag">
- </wicket:fragment>
- </wicket:panel>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel.html
deleted file mode 100644
index 226c172..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel.html
+++ /dev/null
@@ -1,64 +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 style="float:left; width:70%;">
- <script type="text/javascript">
- $(document).ready(function () {
- $("div form #tabs").tabs();
- });
- $(document).ready(function () {
- $("div form #tabs #templates").tabs();
- });
- </script>
- <p style="height:15px; margin-top: 0px;" class="ui-widget ui-corner-all ui-widget-header">
- <wicket:message key="title"/>
- <span wicket:id="displayName"/>
- <span style="float:right;" wicket:id="actionLinks"/>
- </p>
-
- <form wicket:id="roleForm">
- <div id="tabs" style="margin: 0px;">
- <ul>
- <li><a href="#details"><span><wicket:message key="details"/></span></a></li>
- <li><a href="#templates"><span><wicket:message key="templates"/></span></a></li>
- <li><a href="#plainAttrs"><span><wicket:message key="plainAttrs"/></span></a></li>
- <li><a href="#derAttrs"><span><wicket:message key="derAttrs"/></span></a></li>
- <li><a href="#virAttrs"><span><wicket:message key="virAttrs"/></span></a></li>
- <li><a href="#resources"><span><wicket:message key="resources"/></span></a></li>
- <li><a href="#entitlements"><span><wicket:message key="entitlements"/></span></a></li>
- <li><a href="#security"><span><wicket:message key="security"/></span></a></li>
- <li><a href="#users"><span><wicket:message key="users"/></span></a></li>
- </ul>
- <div wicket:id="rolePanel">
- </div>
- <div id="users">
- <div wicket:id="userListContainer">
- <input type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
- wicket:id="search"/>
- <div id="users-contain" class="ui-widget" style="width:auto">
- <span wicket:id="userList"> [userList] </span>
- </div>
- </div>
- </div>
- </div>
- </form>
- </div>
- </wicket:panel>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel.properties
deleted file mode 100644
index b49cf51..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel.properties
+++ /dev/null
@@ -1,27 +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.
-title=Role
-details=Details
-plainAttrs=Plain attributes
-derAttrs=Derived attributes
-virAttrs=Virtual attributes
-resources=Resources
-entitlements=Entitlements
-security=Security
-users=Users
-search=Get Users
-templates=Templates
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel_it.properties
deleted file mode 100644
index 727fe69..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel_it.properties
+++ /dev/null
@@ -1,27 +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.
-title=Ruolo
-details=Dettagli
-plainAttrs=Attributi normali
-derAttrs=Attributi derivati
-virAttrs=Attributi virtuali
-resources=Risorse
-entitlements=Entitlement
-security=Sicurezza
-users=Utenti
-search=Lista Utenti
-templates=Modelli
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel_pt_BR.properties
deleted file mode 100644
index f01ecac..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleTabPanel_pt_BR.properties
+++ /dev/null
@@ -1,27 +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.
-title=Fun\u00e7\u00e3o
-details=Detalhes
-plainAttrs=Atributos Normal
-derAttrs=Atributos Derivados
-virAttrs=Atributos Virtuais
-resources=Recursos
-entitlements=Direitos
-security=Seguran\u00e7a
-users=Usu\u00e1rios
-search=Obter Usu\u00e1rios
-templates=Modelo
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.html
index 7630854..a09d453 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.html
@@ -29,14 +29,14 @@ under the License.
<span wicket:id="panelClaim">[plus]</span>
<span wicket:id="panelManageResources">[plus]</span>
<span wicket:id="panelManageUsers">[plus]</span>
- <span wicket:id="panelManageRoles">[plus]</span>
+ <span wicket:id="panelManageGroups">[plus]</span>
<span wicket:id="panelDryRun">[plus]</span>
<span wicket:id="panelExecute">[plus]</span>
<span wicket:id="panelEnable">[plus]</span>
<span wicket:id="panelSearch">[plus]</span>
<span wicket:id="panelCreate">[plus]</span>
<span wicket:id="panelUserTemplate">[plus]</span>
- <span wicket:id="panelRoleTemplate">[plus]</span>
+ <span wicket:id="panelGroupTemplate">[plus]</span>
<span wicket:id="panelReset">[plus]</span>
<span wicket:id="panelEdit">[plus]</span>
<span wicket:id="panelExport">[plus]</span>
@@ -65,8 +65,8 @@ under the License.
<a href="#" wicket:id="manageUsersLink"><img id="actionLink" src="img/actions/users-icon.png" alt="manage users icon" title="Manage users"/></a>
</wicket:fragment>
- <wicket:fragment wicket:id="fragmentManageRoles">
- <a href="#" wicket:id="manageRolesLink"><img id="actionLink" src="img/actions/roles-icon.png" alt="manage roles icon" title="Manage roles"/></a>
+ <wicket:fragment wicket:id="fragmentManageGroups">
+ <a href="#" wicket:id="manageGroupsLink"><img id="actionLink" src="img/actions/groups-icon.png" alt="manage groups icon" title="Manage groups"/></a>
</wicket:fragment>
<wicket:fragment wicket:id="fragmentCreate">
@@ -93,8 +93,8 @@ under the License.
<a href="#" wicket:id="userTemplateLink"><img id="actionLink" src="img/actions/user_template.png" alt="user template icon" title="Specify user template"/></a>
</wicket:fragment>
- <wicket:fragment wicket:id="fragmentRoleTemplate">
- <a href="#" wicket:id="roleTemplateLink"><img id="actionLink" src="img/actions/roles-icon.png" alt="role template icon" title="Specify role template"/></a>
+ <wicket:fragment wicket:id="fragmentGroupTemplate">
+ <a href="#" wicket:id="groupTemplateLink"><img id="actionLink" src="img/actions/groups-icon.png" alt="group template icon" title="Specify group template"/></a>
</wicket:fragment>
<wicket:fragment wicket:id="fragmentDelete">
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.html
new file mode 100644
index 0000000..0f202e9
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.html
@@ -0,0 +1,25 @@
+<!--
+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="groupTable" wicket:id="treeContainer">
+ <div wicket:id="treeTable" class="group-tree"/>
+ </div>
+ </wicket:panel>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRolePanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRolePanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRolePanel.html
deleted file mode 100644
index 8294ed0..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRolePanel.html
+++ /dev/null
@@ -1,23 +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.
--->
-<wicket:panel>
- <div class="roleTable" wicket:id="treeContainer">
- <div wicket:id="treeTable" class="role-tree"/>
- </div>
-</wicket:panel>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
----------------------------------------------------------------------
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
index 2034ce6..2a3d146 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
@@ -22,7 +22,7 @@ import javax.ws.rs.core.EntityTag;
import javax.ws.rs.core.MediaType;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.syncope.common.lib.search.OrderByClauseBuilder;
-import org.apache.syncope.common.lib.search.RoleFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder;
import org.apache.syncope.common.rest.api.Preference;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -60,12 +60,12 @@ public class SyncopeClient {
}
/**
- * Returns a new instance of <tt>RoleFiqlSearchConditionBuilder</tt>, for assisted building of FIQL queries.
+ * Returns a new instance of <tt>GroupFiqlSearchConditionBuilder</tt>, for assisted building of FIQL queries.
*
- * @return default instance of <tt>RoleFiqlSearchConditionBuilder</tt>
+ * @return default instance of <tt>GroupFiqlSearchConditionBuilder</tt>
*/
- public static RoleFiqlSearchConditionBuilder getRoleSearchConditionBuilder() {
- return new RoleFiqlSearchConditionBuilder();
+ public static GroupFiqlSearchConditionBuilder getGroupSearchConditionBuilder() {
+ return new GroupFiqlSearchConditionBuilder();
}
/**
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java b/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
index 8a6d9c4..bd8b06e 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
@@ -27,12 +27,12 @@ import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.syncope.common.lib.to.AbstractTaskTO;
import org.apache.syncope.common.lib.to.ReportTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
@XmlType
// Reporting here only classes used via PagedResult
-@XmlSeeAlso({ AbstractTaskTO.class, ReportTO.class, RoleTO.class, UserTO.class })
+@XmlSeeAlso({ AbstractTaskTO.class, ReportTO.class, GroupTO.class, UserTO.class })
public abstract class AbstractBaseBean implements Serializable {
private static final long serialVersionUID = 3119542005279892164L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java b/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java
index 1c53db6..082f47f 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java
@@ -32,13 +32,13 @@ import org.apache.syncope.common.lib.mod.AbstractSubjectMod;
import org.apache.syncope.common.lib.mod.AttrMod;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.ReferenceMod;
-import org.apache.syncope.common.lib.mod.RoleMod;
+import org.apache.syncope.common.lib.mod.GroupMod;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.AbstractAttributableTO;
import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
/**
@@ -67,16 +67,16 @@ public final class AttributableOperations {
AttrMod mod = new AttrMod();
mod.setSchema(entry.getKey());
- Set<String> updatedValues = new HashSet<String>(entry.getValue().getValues());
+ Set<String> updatedValues = new HashSet<>(entry.getValue().getValues());
Set<String> originalValues = originalAttrs.containsKey(entry.getKey())
- ? new HashSet<String>(originalAttrs.get(entry.getKey()).getValues())
+ ? new HashSet<>(originalAttrs.get(entry.getKey()).getValues())
: Collections.<String>emptySet();
if (!originalAttrs.containsKey(entry.getKey())) {
// SYNCOPE-459: take care of user virtual attributes without any value
updatedValues.remove("");
- mod.getValuesToBeAdded().addAll(new ArrayList<String>(updatedValues));
+ mod.getValuesToBeAdded().addAll(new ArrayList<>(updatedValues));
if (virtuals) {
result.getVirAttrsToUpdate().add(mod);
@@ -253,12 +253,12 @@ public final class AttributableOperations {
for (Map.Entry<Long, MembershipTO> entry : updatedMembs.entrySet()) {
MembershipMod membMod = new MembershipMod();
- membMod.setRole(entry.getValue().getRoleId());
+ membMod.setGroup(entry.getValue().getGroupId());
if (originalMembs.containsKey(entry.getKey())) {
// if memberships are actually same, just make the isEmpty() call below succeed
if (entry.getValue().equals(originalMembs.get(entry.getKey()))) {
- membMod.setRole(0);
+ membMod.setGroup(0);
} else {
diff(entry.getValue(), originalMembs.get(entry.getKey()), membMod, false);
}
@@ -294,10 +294,10 @@ public final class AttributableOperations {
}
if (!incremental) {
- Set<Long> originalRoles = new HashSet<>(originalMembs.keySet());
- originalRoles.removeAll(updatedMembs.keySet());
- for (Long roleId : originalRoles) {
- result.getMembershipsToRemove().add(originalMembs.get(roleId).getKey());
+ Set<Long> originalGroups = new HashSet<>(originalMembs.keySet());
+ originalGroups.removeAll(updatedMembs.keySet());
+ for (Long groupId : originalGroups) {
+ result.getMembershipsToRemove().add(originalMembs.get(groupId).getKey());
}
}
@@ -307,24 +307,24 @@ public final class AttributableOperations {
/**
* Calculate modifications needed by first in order to be equal to second.
*
- * @param updated updated RoleTO
- * @param original original RoleTO
- * @return RoleMod containing differences
+ * @param updated updated GroupTO
+ * @param original original GroupTO
+ * @return GroupMod containing differences
*/
- public static RoleMod diff(final RoleTO updated, final RoleTO original) {
+ public static GroupMod diff(final GroupTO updated, final GroupTO original) {
return diff(updated, original, false);
}
/**
* Calculate modifications needed by first in order to be equal to second.
*
- * @param updated updated RoleTO
- * @param original original RoleTO
+ * @param updated updated GroupTO
+ * @param original original GroupTO
* @param incremental perform incremental diff (without removing existing info)
- * @return RoleMod containing differences
+ * @return GroupMod containing differences
*/
- public static RoleMod diff(final RoleTO updated, final RoleTO original, final boolean incremental) {
- RoleMod result = new RoleMod();
+ public static GroupMod diff(final GroupTO updated, final GroupTO original, final boolean incremental) {
+ GroupMod result = new GroupMod();
diff(updated, original, result, incremental);
@@ -358,32 +358,32 @@ public final class AttributableOperations {
}
// 5. templates
- Set<String> updatedTemplates = new HashSet<>(updated.getRPlainAttrTemplates());
- Set<String> originalTemplates = new HashSet<>(original.getRPlainAttrTemplates());
+ Set<String> updatedTemplates = new HashSet<>(updated.getGPlainAttrTemplates());
+ Set<String> originalTemplates = new HashSet<>(original.getGPlainAttrTemplates());
if (updatedTemplates.equals(originalTemplates)) {
result.setModRAttrTemplates(false);
result.getRPlainAttrTemplates().clear();
} else {
result.setModRAttrTemplates(true);
- result.getRPlainAttrTemplates().addAll(updated.getRPlainAttrTemplates());
+ result.getRPlainAttrTemplates().addAll(updated.getGPlainAttrTemplates());
}
- updatedTemplates = new HashSet<>(updated.getRDerAttrTemplates());
- originalTemplates = new HashSet<>(original.getRDerAttrTemplates());
+ updatedTemplates = new HashSet<>(updated.getGDerAttrTemplates());
+ originalTemplates = new HashSet<>(original.getGDerAttrTemplates());
if (updatedTemplates.equals(originalTemplates)) {
result.setModRDerAttrTemplates(false);
result.getRDerAttrTemplates().clear();
} else {
result.setModRDerAttrTemplates(true);
- result.getRDerAttrTemplates().addAll(updated.getRDerAttrTemplates());
+ result.getRDerAttrTemplates().addAll(updated.getGDerAttrTemplates());
}
- updatedTemplates = new HashSet<>(updated.getRVirAttrTemplates());
- originalTemplates = new HashSet<>(original.getRVirAttrTemplates());
+ updatedTemplates = new HashSet<>(updated.getGVirAttrTemplates());
+ originalTemplates = new HashSet<>(original.getGVirAttrTemplates());
if (updatedTemplates.equals(originalTemplates)) {
result.setModRVirAttrTemplates(false);
result.getRVirAttrTemplates().clear();
} else {
result.setModRVirAttrTemplates(true);
- result.getRVirAttrTemplates().addAll(updated.getRVirAttrTemplates());
+ result.getRVirAttrTemplates().addAll(updated.getGVirAttrTemplates());
}
updatedTemplates = new HashSet<>(updated.getMPlainAttrTemplates());
originalTemplates = new HashSet<>(original.getMPlainAttrTemplates());
@@ -415,7 +415,7 @@ public final class AttributableOperations {
// 6. owner
result.setUserOwner(new ReferenceMod(updated.getUserOwner()));
- result.setRoleOwner(new ReferenceMod(updated.getRoleOwner()));
+ result.setGroupOwner(new ReferenceMod(updated.getGroupOwner()));
return result;
}
@@ -498,7 +498,7 @@ public final class AttributableOperations {
}
for (MembershipMod membMod : userMod.getMembershipsToAdd()) {
MembershipTO membTO = new MembershipTO();
- membTO.setRoleId(membMod.getRole());
+ membTO.setGroupId(membMod.getGroup());
apply(membTO, membMod, membTO);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientCompositeException.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientCompositeException.java b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientCompositeException.java
index 7322cc8..d139bda 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientCompositeException.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientCompositeException.java
@@ -73,18 +73,18 @@ public class SyncopeClientCompositeException extends SyncopeClientException {
public String getMessage() {
StringBuilder message = new StringBuilder();
- message.append("{");
+ message.append('{');
Iterator<SyncopeClientException> iter = getExceptions().iterator();
while (iter.hasNext()) {
SyncopeClientException e = iter.next();
- message.append("[");
- message.append(e.getMessage());
- message.append("]");
+ message.append('[').
+ append(e.getMessage()).
+ append(']');
if (iter.hasNext()) {
message.append(", ");
}
}
- message.append("}");
+ message.append('}');
return message.toString();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientException.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientException.java b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientException.java
index 2243835..8d015f2 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientException.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientException.java
@@ -80,13 +80,11 @@ public class SyncopeClientException extends RuntimeException {
@Override
public String getMessage() {
- StringBuilder message = new StringBuilder();
-
- message.append(getType());
- message.append(" ");
- message.append(getElements());
-
- return message.toString();
+ return new StringBuilder().
+ append(getType()).
+ append(' ').
+ append(getElements()).
+ toString();
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeConstants.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeConstants.java b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeConstants.java
index 817b00d..b1ab0d4 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeConstants.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeConstants.java
@@ -18,9 +18,10 @@
*/
package org.apache.syncope.common.lib;
+import java.nio.charset.Charset;
import java.util.regex.Pattern;
-public class SyncopeConstants {
+public final class SyncopeConstants {
public static final String NAMESPACE = "http://syncope.apache.org/2.0";
@@ -42,6 +43,8 @@ public class SyncopeConstants {
public static final String DEFAULT_ENCODING = "UTF-8";
+ public static final Charset DEFAULT_CHARSET = Charset.forName(DEFAULT_ENCODING);
+
public static final String ROOT_LOGGER = "ROOT";
public static final Pattern EMAIL_PATTERN = Pattern.compile(
@@ -49,4 +52,7 @@ public class SyncopeConstants {
+ "@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$",
Pattern.CASE_INSENSITIVE);
+ private SyncopeConstants() {
+ // private constructor for utility class
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/annotation/FormAttributeField.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/annotation/FormAttributeField.java b/common/lib/src/main/java/org/apache/syncope/common/lib/annotation/FormAttributeField.java
index 2c1c980..5d2603f 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/annotation/FormAttributeField.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/annotation/FormAttributeField.java
@@ -30,7 +30,7 @@ public @interface FormAttributeField {
boolean userSearch() default false;
- boolean roleSearch() default false;
+ boolean groupSearch() default false;
IntMappingType schema() default IntMappingType.UserPlainSchema;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AttrMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AttrMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AttrMod.java
index b0cee5b..07fe784 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AttrMod.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AttrMod.java
@@ -36,16 +36,9 @@ public class AttrMod extends AbstractBaseBean {
private String schema;
- private List<String> valuesToBeAdded;
+ private final List<String> valuesToBeAdded = new ArrayList<>();
- private List<String> valuesToBeRemoved;
-
- public AttrMod() {
- super();
-
- valuesToBeAdded = new ArrayList<>();
- valuesToBeRemoved = new ArrayList<>();
- }
+ private final List<String> valuesToBeRemoved = new ArrayList<>();
public String getSchema() {
return schema;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java
new file mode 100644
index 0000000..3dbae2e
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java
@@ -0,0 +1,300 @@
+/*
+ * 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.mod;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "groupMod")
+@XmlType
+public class GroupMod extends AbstractSubjectMod {
+
+ private static final long serialVersionUID = 7455805264680210747L;
+
+ private String name;
+
+ private ReferenceMod userOwner;
+
+ private ReferenceMod groupOwner;
+
+ private Boolean inheritOwner;
+
+ private Boolean inheritTemplates;
+
+ private Boolean inheritPlainAttrs;
+
+ private Boolean inheritDerAttrs;
+
+ private Boolean inheritVirAttrs;
+
+ private Boolean inheritAccountPolicy;
+
+ private Boolean inheritPasswordPolicy;
+
+ private boolean modEntitlements;
+
+ private final List<String> entitlements = new ArrayList<>();
+
+ private boolean modRAttrTemplates;
+
+ private final List<String> rPlainAttrTemplates = new ArrayList<>();
+
+ private boolean modRDerAttrTemplates;
+
+ private final List<String> rDerAttrTemplates = new ArrayList<>();
+
+ private boolean modRVirAttrTemplates;
+
+ private final List<String> rVirAttrTemplates = new ArrayList<>();
+
+ private boolean modMAttrTemplates;
+
+ private final List<String> mPlainAttrTemplates = new ArrayList<>();
+
+ private boolean modMDerAttrTemplates;
+
+ private final List<String> mDerAttrTemplates = new ArrayList<>();
+
+ private boolean modMVirAttrTemplates;
+
+ private final List<String> mVirAttrTemplates = new ArrayList<>();
+
+ private ReferenceMod passwordPolicy;
+
+ private ReferenceMod accountPolicy;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public ReferenceMod getUserOwner() {
+ return userOwner;
+ }
+
+ public void setUserOwner(final ReferenceMod userOwner) {
+ this.userOwner = userOwner;
+ }
+
+ public ReferenceMod getGroupOwner() {
+ return groupOwner;
+ }
+
+ public void setGroupOwner(final ReferenceMod groupOwner) {
+ this.groupOwner = groupOwner;
+ }
+
+ public Boolean getInheritOwner() {
+ return inheritOwner;
+ }
+
+ public void setInheritOwner(final Boolean inheritOwner) {
+ this.inheritOwner = inheritOwner;
+ }
+
+ public Boolean getInheritTemplates() {
+ return inheritTemplates;
+ }
+
+ public void setInheritTemplates(final Boolean inheritTemplates) {
+ this.inheritTemplates = inheritTemplates;
+ }
+
+ public Boolean getInheritPlainAttrs() {
+ return inheritPlainAttrs;
+ }
+
+ public void setInheritPlainAttrs(final Boolean inheritAttrs) {
+ this.inheritPlainAttrs = inheritAttrs;
+ }
+
+ public Boolean getInheritDerAttrs() {
+ return inheritDerAttrs;
+ }
+
+ public void setInheritDerAttrs(final Boolean inheritDerAttrs) {
+ this.inheritDerAttrs = inheritDerAttrs;
+ }
+
+ public Boolean getInheritVirAttrs() {
+ return inheritVirAttrs;
+ }
+
+ public void setInheritVirAttrs(final Boolean inheritVirAttrs) {
+ this.inheritVirAttrs = inheritVirAttrs;
+ }
+
+ public boolean isModEntitlements() {
+ return modEntitlements;
+ }
+
+ public void setModEntitlements(final boolean modEntitlements) {
+ this.modEntitlements = modEntitlements;
+ }
+
+ @XmlElementWrapper(name = "entitlements")
+ @XmlElement(name = "entitlement")
+ @JsonProperty("entitlements")
+ public List<String> getEntitlements() {
+ return entitlements;
+ }
+
+ public boolean isModRAttrTemplates() {
+ return modRAttrTemplates;
+ }
+
+ public void setModRAttrTemplates(final boolean modRAttrTemplates) {
+ this.modRAttrTemplates = modRAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "rPlainAttrTemplates")
+ @XmlElement(name = "rAttrTemplate")
+ @JsonProperty("rPlainAttrTemplates")
+ public List<String> getRPlainAttrTemplates() {
+ return rPlainAttrTemplates;
+ }
+
+ public boolean isModRDerAttrTemplates() {
+ return modRDerAttrTemplates;
+ }
+
+ public void setModRDerAttrTemplates(final boolean modRDerAttrTemplates) {
+ this.modRDerAttrTemplates = modRDerAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "rDerAttrTemplates")
+ @XmlElement(name = "rDerAttrTemplate")
+ @JsonProperty("rDerAttrTemplates")
+ public List<String> getRDerAttrTemplates() {
+ return rDerAttrTemplates;
+ }
+
+ public boolean isModRVirAttrTemplates() {
+ return modRVirAttrTemplates;
+ }
+
+ public void setModRVirAttrTemplates(final boolean modRVirAttrTemplates) {
+ this.modRVirAttrTemplates = modRVirAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "rVirAttrTemplates")
+ @XmlElement(name = "rVirAttrTemplate")
+ @JsonProperty("rVirAttrTemplates")
+ public List<String> getRVirAttrTemplates() {
+ return rVirAttrTemplates;
+ }
+
+ public boolean isModMAttrTemplates() {
+ return modMAttrTemplates;
+ }
+
+ public void setModMAttrTemplates(final boolean modMAttrTemplates) {
+ this.modMAttrTemplates = modMAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "mPlainAttrTemplates")
+ @XmlElement(name = "mAttrTemplate")
+ @JsonProperty("mPlainAttrTemplates")
+ public List<String> getMPlainAttrTemplates() {
+ return mPlainAttrTemplates;
+ }
+
+ public boolean isModMDerAttrTemplates() {
+ return modMDerAttrTemplates;
+ }
+
+ public void setModMDerAttrTemplates(final boolean modMDerAttrTemplates) {
+ this.modMDerAttrTemplates = modMDerAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "mDerAttrTemplates")
+ @XmlElement(name = "mDerAttrTemplate")
+ @JsonProperty("mDerAttrTemplates")
+ public List<String> getMDerAttrTemplates() {
+ return mDerAttrTemplates;
+ }
+
+ public boolean isModMVirAttrTemplates() {
+ return modMVirAttrTemplates;
+ }
+
+ public void setModMVirAttrTemplates(final boolean modMVirAttrTemplates) {
+ this.modMVirAttrTemplates = modMVirAttrTemplates;
+ }
+
+ @XmlElementWrapper(name = "mVirAttrTemplates")
+ @XmlElement(name = "mVirAttrTemplate")
+ @JsonProperty("mVirAttrTemplates")
+ public List<String> getMVirAttrTemplates() {
+ return mVirAttrTemplates;
+ }
+
+ public ReferenceMod getPasswordPolicy() {
+ return passwordPolicy;
+ }
+
+ public void setPasswordPolicy(final ReferenceMod passwordPolicy) {
+ this.passwordPolicy = passwordPolicy;
+ }
+
+ public Boolean getInheritPasswordPolicy() {
+ return inheritPasswordPolicy;
+ }
+
+ public void setInheritPasswordPolicy(final Boolean inheritPasswordPolicy) {
+ this.inheritPasswordPolicy = inheritPasswordPolicy;
+ }
+
+ public ReferenceMod getAccountPolicy() {
+ return accountPolicy;
+ }
+
+ public void setAccountPolicy(final ReferenceMod accountPolicy) {
+ this.accountPolicy = accountPolicy;
+ }
+
+ public Boolean getInheritAccountPolicy() {
+ return inheritAccountPolicy;
+ }
+
+ public void setInheritAccountPolicy(final Boolean inheritAccountPolicy) {
+ this.inheritAccountPolicy = inheritAccountPolicy;
+ }
+
+ @JsonIgnore
+ @Override
+ public boolean isEmpty() {
+ return super.isEmpty() && name == null && userOwner == null && groupOwner == null
+ && inheritTemplates == null && inheritOwner == null
+ && inheritAccountPolicy == null && inheritPasswordPolicy == null
+ && inheritPlainAttrs == null && inheritDerAttrs == null && inheritVirAttrs == null
+ && accountPolicy == null && passwordPolicy == null && entitlements.isEmpty()
+ && rPlainAttrTemplates.isEmpty() && rDerAttrTemplates.isEmpty() && rVirAttrTemplates.isEmpty()
+ && mPlainAttrTemplates.isEmpty() && mDerAttrTemplates.isEmpty() && mVirAttrTemplates.isEmpty();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/mod/MembershipMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/MembershipMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/MembershipMod.java
index bdcfcbf..d414011 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/MembershipMod.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/MembershipMod.java
@@ -28,19 +28,19 @@ public class MembershipMod extends AbstractAttributableMod {
private static final long serialVersionUID = 2511869129977331525L;
- private long role;
+ private long group;
- public long getRole() {
- return role;
+ public long getGroup() {
+ return group;
}
- public void setRole(final long role) {
- this.role = role;
+ public void setGroup(final long group) {
+ this.group = group;
}
@JsonIgnore
@Override
public boolean isEmpty() {
- return super.isEmpty() && role == 0;
+ return super.isEmpty() && group == 0;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ReferenceMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ReferenceMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ReferenceMod.java
index e8356c2..25fd02d 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ReferenceMod.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ReferenceMod.java
@@ -33,13 +33,14 @@ public class ReferenceMod extends AbstractBaseBean {
private static final long serialVersionUID = -4188817853738067677L;
- private Long key;
+ private Long key = null;
public ReferenceMod() {
- this.key = null;
+ this(null);
}
public ReferenceMod(final Long key) {
+ super();
this.key = key;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ResourceAssociationMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ResourceAssociationMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ResourceAssociationMod.java
index 6312349..f381104 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ResourceAssociationMod.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ResourceAssociationMod.java
@@ -66,7 +66,7 @@ public class ResourceAssociationMod extends AbstractBaseBean {
return changePwd;
}
- public void setChangePwd(boolean changePwd) {
+ public void setChangePwd(final boolean changePwd) {
this.changePwd = changePwd;
}
@@ -74,7 +74,7 @@ public class ResourceAssociationMod extends AbstractBaseBean {
return password;
}
- public void setPassword(String password) {
+ public void setPassword(final String password) {
this.password = password;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/mod/RoleMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/RoleMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/RoleMod.java
deleted file mode 100644
index b1b8f4f..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/RoleMod.java
+++ /dev/null
@@ -1,300 +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.mod;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "roleMod")
-@XmlType
-public class RoleMod extends AbstractSubjectMod {
-
- private static final long serialVersionUID = 7455805264680210747L;
-
- private String name;
-
- private ReferenceMod userOwner;
-
- private ReferenceMod roleOwner;
-
- private Boolean inheritOwner;
-
- private Boolean inheritTemplates;
-
- private Boolean inheritPlainAttrs;
-
- private Boolean inheritDerAttrs;
-
- private Boolean inheritVirAttrs;
-
- private Boolean inheritAccountPolicy;
-
- private Boolean inheritPasswordPolicy;
-
- private boolean modEntitlements;
-
- private final List<String> entitlements = new ArrayList<>();
-
- private boolean modRAttrTemplates;
-
- private final List<String> rPlainAttrTemplates = new ArrayList<>();
-
- private boolean modRDerAttrTemplates;
-
- private final List<String> rDerAttrTemplates = new ArrayList<>();
-
- private boolean modRVirAttrTemplates;
-
- private final List<String> rVirAttrTemplates = new ArrayList<>();
-
- private boolean modMAttrTemplates;
-
- private final List<String> mPlainAttrTemplates = new ArrayList<>();
-
- private boolean modMDerAttrTemplates;
-
- private final List<String> mDerAttrTemplates = new ArrayList<>();
-
- private boolean modMVirAttrTemplates;
-
- private final List<String> mVirAttrTemplates = new ArrayList<>();
-
- private ReferenceMod passwordPolicy;
-
- private ReferenceMod accountPolicy;
-
- public String getName() {
- return name;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
- public ReferenceMod getUserOwner() {
- return userOwner;
- }
-
- public void setUserOwner(final ReferenceMod userOwner) {
- this.userOwner = userOwner;
- }
-
- public ReferenceMod getRoleOwner() {
- return roleOwner;
- }
-
- public void setRoleOwner(final ReferenceMod roleOwner) {
- this.roleOwner = roleOwner;
- }
-
- public Boolean getInheritOwner() {
- return inheritOwner;
- }
-
- public void setInheritOwner(final Boolean inheritOwner) {
- this.inheritOwner = inheritOwner;
- }
-
- public Boolean getInheritTemplates() {
- return inheritTemplates;
- }
-
- public void setInheritTemplates(final Boolean inheritTemplates) {
- this.inheritTemplates = inheritTemplates;
- }
-
- public Boolean getInheritPlainAttrs() {
- return inheritPlainAttrs;
- }
-
- public void setInheritPlainAttrs(final Boolean inheritAttrs) {
- this.inheritPlainAttrs = inheritAttrs;
- }
-
- public Boolean getInheritDerAttrs() {
- return inheritDerAttrs;
- }
-
- public void setInheritDerAttrs(final Boolean inheritDerAttrs) {
- this.inheritDerAttrs = inheritDerAttrs;
- }
-
- public Boolean getInheritVirAttrs() {
- return inheritVirAttrs;
- }
-
- public void setInheritVirAttrs(final Boolean inheritVirAttrs) {
- this.inheritVirAttrs = inheritVirAttrs;
- }
-
- public boolean isModEntitlements() {
- return modEntitlements;
- }
-
- public void setModEntitlements(final boolean modEntitlements) {
- this.modEntitlements = modEntitlements;
- }
-
- @XmlElementWrapper(name = "entitlements")
- @XmlElement(name = "entitlement")
- @JsonProperty("entitlements")
- public List<String> getEntitlements() {
- return entitlements;
- }
-
- public boolean isModRAttrTemplates() {
- return modRAttrTemplates;
- }
-
- public void setModRAttrTemplates(final boolean modRAttrTemplates) {
- this.modRAttrTemplates = modRAttrTemplates;
- }
-
- @XmlElementWrapper(name = "rPlainAttrTemplates")
- @XmlElement(name = "rAttrTemplate")
- @JsonProperty("rPlainAttrTemplates")
- public List<String> getRPlainAttrTemplates() {
- return rPlainAttrTemplates;
- }
-
- public boolean isModRDerAttrTemplates() {
- return modRDerAttrTemplates;
- }
-
- public void setModRDerAttrTemplates(final boolean modRDerAttrTemplates) {
- this.modRDerAttrTemplates = modRDerAttrTemplates;
- }
-
- @XmlElementWrapper(name = "rDerAttrTemplates")
- @XmlElement(name = "rDerAttrTemplate")
- @JsonProperty("rDerAttrTemplates")
- public List<String> getRDerAttrTemplates() {
- return rDerAttrTemplates;
- }
-
- public boolean isModRVirAttrTemplates() {
- return modRVirAttrTemplates;
- }
-
- public void setModRVirAttrTemplates(final boolean modRVirAttrTemplates) {
- this.modRVirAttrTemplates = modRVirAttrTemplates;
- }
-
- @XmlElementWrapper(name = "rVirAttrTemplates")
- @XmlElement(name = "rVirAttrTemplate")
- @JsonProperty("rVirAttrTemplates")
- public List<String> getRVirAttrTemplates() {
- return rVirAttrTemplates;
- }
-
- public boolean isModMAttrTemplates() {
- return modMAttrTemplates;
- }
-
- public void setModMAttrTemplates(final boolean modMAttrTemplates) {
- this.modMAttrTemplates = modMAttrTemplates;
- }
-
- @XmlElementWrapper(name = "mPlainAttrTemplates")
- @XmlElement(name = "mAttrTemplate")
- @JsonProperty("mPlainAttrTemplates")
- public List<String> getMPlainAttrTemplates() {
- return mPlainAttrTemplates;
- }
-
- public boolean isModMDerAttrTemplates() {
- return modMDerAttrTemplates;
- }
-
- public void setModMDerAttrTemplates(final boolean modMDerAttrTemplates) {
- this.modMDerAttrTemplates = modMDerAttrTemplates;
- }
-
- @XmlElementWrapper(name = "mDerAttrTemplates")
- @XmlElement(name = "mDerAttrTemplate")
- @JsonProperty("mDerAttrTemplates")
- public List<String> getMDerAttrTemplates() {
- return mDerAttrTemplates;
- }
-
- public boolean isModMVirAttrTemplates() {
- return modMVirAttrTemplates;
- }
-
- public void setModMVirAttrTemplates(final boolean modMVirAttrTemplates) {
- this.modMVirAttrTemplates = modMVirAttrTemplates;
- }
-
- @XmlElementWrapper(name = "mVirAttrTemplates")
- @XmlElement(name = "mVirAttrTemplate")
- @JsonProperty("mVirAttrTemplates")
- public List<String> getMVirAttrTemplates() {
- return mVirAttrTemplates;
- }
-
- public ReferenceMod getPasswordPolicy() {
- return passwordPolicy;
- }
-
- public void setPasswordPolicy(final ReferenceMod passwordPolicy) {
- this.passwordPolicy = passwordPolicy;
- }
-
- public Boolean getInheritPasswordPolicy() {
- return inheritPasswordPolicy;
- }
-
- public void setInheritPasswordPolicy(final Boolean inheritPasswordPolicy) {
- this.inheritPasswordPolicy = inheritPasswordPolicy;
- }
-
- public ReferenceMod getAccountPolicy() {
- return accountPolicy;
- }
-
- public void setAccountPolicy(final ReferenceMod accountPolicy) {
- this.accountPolicy = accountPolicy;
- }
-
- public Boolean getInheritAccountPolicy() {
- return inheritAccountPolicy;
- }
-
- public void setInheritAccountPolicy(final Boolean inheritAccountPolicy) {
- this.inheritAccountPolicy = inheritAccountPolicy;
- }
-
- @JsonIgnore
- @Override
- public boolean isEmpty() {
- return super.isEmpty() && name == null && userOwner == null && roleOwner == null
- && inheritTemplates == null && inheritOwner == null
- && inheritAccountPolicy == null && inheritPasswordPolicy == null
- && inheritPlainAttrs == null && inheritDerAttrs == null && inheritVirAttrs == null
- && accountPolicy == null && passwordPolicy == null && entitlements.isEmpty()
- && rPlainAttrTemplates.isEmpty() && rDerAttrTemplates.isEmpty() && rVirAttrTemplates.isEmpty()
- && mPlainAttrTemplates.isEmpty() && mDerAttrTemplates.isEmpty() && mVirAttrTemplates.isEmpty();
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/mod/StatusMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/StatusMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/StatusMod.java
index 57ea366..082b6f8 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/StatusMod.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/StatusMod.java
@@ -70,7 +70,7 @@ public class StatusMod extends AbstractBaseBean {
return key;
}
- public void setKey(long key) {
+ public void setKey(final long key) {
this.key = key;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractReportletConf.java
index 0082591..8fe5e24 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractReportletConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractReportletConf.java
@@ -24,7 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlType
-@XmlSeeAlso({ StaticReportletConf.class, UserReportletConf.class, RoleReportletConf.class })
+@XmlSeeAlso({ StaticReportletConf.class, UserReportletConf.class, GroupReportletConf.class })
public abstract class AbstractReportletConf extends AbstractBaseBean implements ReportletConf {
private static final long serialVersionUID = -6130008602014516608L;
@@ -37,6 +37,7 @@ public abstract class AbstractReportletConf extends AbstractBaseBean implements
}
public AbstractReportletConf(final String name) {
+ super();
this.name = name;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractSubjectReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractSubjectReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractSubjectReportletConf.java
new file mode 100644
index 0000000..28b4cba
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractSubjectReportletConf.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.lib.report;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.annotation.FormAttributeField;
+import org.apache.syncope.common.lib.types.IntMappingType;
+
+@XmlType
+public abstract class AbstractSubjectReportletConf extends AbstractReportletConf {
+
+ private static final long serialVersionUID = -5388597116592877789L;
+
+ @FormAttributeField(userSearch = true)
+ protected String matchingCond;
+
+ @FormAttributeField(schema = IntMappingType.UserPlainSchema)
+ protected final List<String> plainAttrs = new ArrayList<>();
+
+ @FormAttributeField(schema = IntMappingType.UserDerivedSchema)
+ protected final List<String> derAttrs = new ArrayList<>();
+
+ @FormAttributeField(schema = IntMappingType.UserVirtualSchema)
+ protected final List<String> virAttrs = new ArrayList<>();
+
+ public AbstractSubjectReportletConf() {
+ super();
+ }
+
+ public AbstractSubjectReportletConf(final String name) {
+ super(name);
+ }
+
+ public String getMatchingCond() {
+ return matchingCond;
+ }
+
+ public void setMatchingCond(final String matchingCond) {
+ this.matchingCond = matchingCond;
+ }
+
+ @XmlElementWrapper(name = "plainAttributes")
+ @XmlElement(name = "plainAttribute")
+ @JsonProperty("plainAttributes")
+ public List<String> getPlainAttrs() {
+ return plainAttrs;
+ }
+
+ @XmlElementWrapper(name = "derivedAttributes")
+ @XmlElement(name = "attribute")
+ @JsonProperty("derivedAttributes")
+ public List<String> getDerAttrs() {
+ return derAttrs;
+ }
+
+ @XmlElementWrapper(name = "virtualAttributes")
+ @XmlElement(name = "attribute")
+ @JsonProperty("virtualAttributes")
+ public List<String> getVirAttrs() {
+ return virAttrs;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
new file mode 100644
index 0000000..dee3ff4
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
@@ -0,0 +1,66 @@
+/*
+ * 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.report;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "groupReportletConf")
+@XmlType
+public class GroupReportletConf extends AbstractSubjectReportletConf {
+
+ private static final long serialVersionUID = -8488503068032439699L;
+
+ @XmlEnum
+ @XmlType(name = "groupReportletConfFeature")
+ public enum Feature {
+
+ key,
+ name,
+ groupOwner,
+ userOwner,
+ entitlements,
+ users,
+ resources
+
+ }
+
+ private final List<Feature> features = new ArrayList<>();
+
+ public GroupReportletConf() {
+ super();
+ }
+
+ public GroupReportletConf(final String name) {
+ super(name);
+ }
+
+ @XmlElementWrapper(name = "features")
+ @XmlElement(name = "feature")
+ @JsonProperty("features")
+ public List<Feature> getFeatures() {
+ return features;
+ }
+}
[17/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/roleReportlet2csv.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/roleReportlet2csv.xsl b/core/logic/src/main/resources/report/roleReportlet2csv.xsl
deleted file mode 100644
index ad092d5..0000000
--- a/core/logic/src/main/resources/report/roleReportlet2csv.xsl
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
-
- <xsl:variable name="delimiter" select="';'"/>
-
- <xsl:template match="reportlet[@class='org.apache.syncope.core.report.RoleReportlet']">
-
- <xsl:call-template name="header">
- <xsl:with-param name="node" select="configurations/roleAttributes"/>
- </xsl:call-template>
- <xsl:for-each select="role">
- <xsl:call-template name="roleAttributes">
- <xsl:with-param name="header" select="../configurations/roleAttributes"/>
- <xsl:with-param name="attrs" select="."/>
- </xsl:call-template>
- <xsl:text> </xsl:text>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="header">
- <xsl:param name="node"/>
- <xsl:for-each select="$node/*">
- <xsl:value-of select="text()"/>
- <xsl:if test="position() != last()">
- <xsl:value-of select="$delimiter"/>
- </xsl:if>
- </xsl:for-each>
- <xsl:text> </xsl:text>
- </xsl:template>
-
- <xsl:template name="roleAttributes">
- <xsl:param name="header"/>
- <xsl:param name="attrs"/>
-
- <xsl:for-each select="$header/*">
- <xsl:variable name="nameAttr" select="text()"/>
-
- <xsl:choose>
- <xsl:when test="string-length($attrs/@*[name()=$nameAttr]) > 0">
- <xsl:variable name="roleAttr" select="$attrs/@*[name()=$nameAttr]"/>
- <xsl:text>"</xsl:text>
- <xsl:value-of select="$roleAttr/."/>
- <xsl:text>"</xsl:text>
- </xsl:when>
- <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='entitlement'])
- and count($attrs/*[name(.)=$nameAttr]/node()) > 0">
- <xsl:text>"</xsl:text>
- <xsl:for-each select="$attrs/*/entitlement">
- <xsl:variable name="value" select="@id"/>
- <xsl:value-of select="$value"/>
- <xsl:if test="position() != last()">
- <xsl:value-of select="$delimiter"/>
- </xsl:if>
- </xsl:for-each>
- <xsl:text>"</xsl:text>
- </xsl:when>
- <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='resource'])
- and count($attrs/*[name(.)=$nameAttr]/node()) > 0">
- <xsl:text>"</xsl:text>
- <xsl:for-each select="$attrs/*/resource">
- <xsl:variable name="value" select="@name"/>
- <xsl:value-of select="$value"/>
- <xsl:if test="position() != last()">
- <xsl:value-of select="$delimiter"/>
- </xsl:if>
- </xsl:for-each>
- <xsl:text>"</xsl:text>
- </xsl:when>
- <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='user'])
- and count($attrs/*[name(.)=$nameAttr]/node()) > 0">
- <xsl:text>"</xsl:text>
- <xsl:for-each select="$attrs/*/user">
- <xsl:variable name="value" select="@userUsername"/>
- <xsl:value-of select="$value"/>
- <xsl:if test="position() != last()">
- <xsl:value-of select="$delimiter"/>
- </xsl:if>
- </xsl:for-each>
- <xsl:text>"</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>"</xsl:text>
- <xsl:if test="string-length($attrs/*/*[@name=$nameAttr]/value/text()) > 0">
- <xsl:variable name="value" select="$attrs/*/*[@name=$nameAttr]/value/text()"/>
- <xsl:value-of select="$value"/>
- </xsl:if>
- <xsl:text>"</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="position() != last()">
- <xsl:value-of select="$delimiter"/>
- </xsl:if>
-
- </xsl:for-each>
- </xsl:template>
-
-</xsl:stylesheet>
-
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/roleReportlet2fo.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/roleReportlet2fo.xsl b/core/logic/src/main/resources/report/roleReportlet2fo.xsl
deleted file mode 100644
index bb319a4..0000000
--- a/core/logic/src/main/resources/report/roleReportlet2fo.xsl
+++ /dev/null
@@ -1,228 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format"
- version="1.0">
-
- <xsl:template match="reportlet[@class='org.apache.syncope.core.report.RoleReportlet']">
-
- <fo:block font-size="16pt" font-weight="bold" space-after="0.5cm" space-before="5mm">Reportlet: <xsl:value-of select="@name"/></fo:block>
-
- <xsl:for-each select="role">
- <fo:block font-size="14pt" font-weight="bold" space-before="15mm" space-after="5mm" background-color="(#8888ff)">Role <xsl:value-of select="@name"/></fo:block>
- <fo:table table-layout="fixed" space-after="7mm">
- <fo:table-column/>
- <fo:table-column/>
- <fo:table-body>
- <fo:table-row background-color="(#ccccff)">
- <fo:table-cell>
- <fo:block>Id:</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block font-style="italic">
- <xsl:value-of select="@id"/>
- </fo:block>
- </fo:table-cell>
- </fo:table-row>
- <xsl:if test="@roleOwner != 'null'">
- <fo:table-row background-color="(#ccccff)">
- <fo:table-cell>
- <fo:block>Role Owner:</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block font-style="italic">
- <xsl:value-of select="@roleOwner"/>
- </fo:block>
- </fo:table-cell>
- </fo:table-row>
- </xsl:if>
- <xsl:if test="@userOwner != 'null'">
- <fo:table-row background-color="(#ccccff)">
- <fo:table-cell>
- <fo:block>Last Login Date:</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block font-style="italic">
- <xsl:value-of select="@userOwner"/>
- </fo:block>
- </fo:table-cell>
- </fo:table-row>
- </xsl:if>
- </fo:table-body>
- </fo:table>
- <xsl:choose>
- <xsl:when test="string-length(attributes/attribute) > 0">
- <xsl:call-template name="attributes">
- <xsl:with-param name="label">Attributes</xsl:with-param>
- <xsl:with-param name="node" select="attributes/attribute"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY ATTRIBUTE</fo:block>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0">
- <xsl:call-template name="attributes">
- <xsl:with-param name="label">Derived Attributes</xsl:with-param>
- <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY DERIVED ATTRIBUTE</fo:block>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0">
- <xsl:call-template name="attributes">
- <xsl:with-param name="label">Virtual Attributes</xsl:with-param>
- <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY VIRTUAL ATTRIBUTE</fo:block>
- </xsl:otherwise>
- </xsl:choose>
-
- <!--entitlements-->
- <xsl:choose>
- <xsl:when test="entitlements/entitlement">
- <xsl:call-template name="entitlements">
- <xsl:with-param name="label">Entitlements</xsl:with-param>
- <xsl:with-param name="node" select="entitlements/entitlement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY ENTITLEMENT</fo:block>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="users/user">
- <fo:block font-size="11pt" font-weight="bold">Users</fo:block>
- <xsl:for-each select="users/user">
- <fo:block background-color="(#ccccff)" font-size="9pt" font-weight="bold" space-before="4mm">User: <xsl:value-of select="@userUsername"/> (Id: <xsl:value-of select="@userId"/>)</fo:block>
-
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY USER ASSIGNED TO</fo:block>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template name="roleResources">
- <xsl:with-param name="node" select="resources/resource"/>
- </xsl:call-template>
- </xsl:for-each>
-
- </xsl:template>
-
- <xsl:template name="attributes">
- <xsl:param name="label"/>
- <xsl:param name="node"/>
- <fo:block font-size="11pt" font-weight="bold" space-after="2mm">
- <xsl:value-of select="$label"/>
- </fo:block>
- <fo:table table-layout="fixed" space-after="7mm">
- <fo:table-column/>
- <fo:table-column/>
- <fo:table-header>
- <fo:table-row height="7mm" background-color="(#ccccba)">
- <fo:table-cell>
- <fo:block font-weight="bold">Schema name</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block font-weight="bold">Value(s)</fo:block>
- </fo:table-cell>
- </fo:table-row>
- </fo:table-header>
- <fo:table-body>
- <xsl:for-each select="$node">
- <xsl:if test="string-length(value/text()) > 0">
- <fo:table-row height="4mm" background-color="(#ccccff)">
- <fo:table-cell>
- <fo:block>
- <xsl:value-of select="@name"/>
- </fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <xsl:for-each select="value">
- <fo:block></fo:block><!-- <fo:block>•</fo:block>-->
- <fo:block font-style="italic">
- <xsl:value-of select="text()"/>
- </fo:block>
- </xsl:for-each>
- </fo:table-cell>
- </fo:table-row>
- </xsl:if>
- <fo:table-row>
- <fo:table-cell>
- <fo:block></fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block></fo:block>
- </fo:table-cell>
- </fo:table-row>
- </xsl:for-each>
- </fo:table-body>
- </fo:table>
- </xsl:template>
- <!--entitlements template-->
- <xsl:template name="entitlements">
- <xsl:param name="label"/>
- <xsl:param name="node"/>
- <fo:block font-size="11pt" font-weight="bold" space-after="2mm" space-before="5mm">
- <xsl:value-of select="$label"/>
- </fo:block>
- <fo:table table-layout="fixed" space-after="7mm">
- <fo:table-column/>
- <!--<fo:table-column/>-->
- <fo:table-header>
- <fo:table-row height="7mm" background-color="(#ccccba)">
- <fo:table-cell>
- <fo:block font-weight="bold">Name</fo:block>
- </fo:table-cell>
- </fo:table-row>
- </fo:table-header>
- <fo:table-body>
- <xsl:for-each select="$node">
- <fo:table-row height="4mm" background-color="(#ccccff)">
- <fo:table-cell>
- <fo:block>
- <xsl:value-of select="@id"/>
- </fo:block>
- </fo:table-cell>
- </fo:table-row>
- </xsl:for-each>
- </fo:table-body>
- </fo:table>
- </xsl:template>
-
- <xsl:template name="roleResources">
- <xsl:param name="node"/>
- <fo:block font-size="11pt" font-weight="bold" space-after="3mm" space-before="5mm">Role Resources</fo:block>
- <xsl:for-each select="$node">
- <fo:block></fo:block> <!-- <fo:block>•</fo:block>-->
- <fo:block background-color="(#ccccff)">
- <xsl:value-of select="@name"/>
- </fo:block>
- </xsl:for-each>
- </xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/roleReportlet2html.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/roleReportlet2html.xsl b/core/logic/src/main/resources/report/roleReportlet2html.xsl
deleted file mode 100644
index 9f5825f..0000000
--- a/core/logic/src/main/resources/report/roleReportlet2html.xsl
+++ /dev/null
@@ -1,196 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
-
- <xsl:template match="reportlet[@class='org.apache.syncope.core.report.RoleReportlet']">
- <h2>Reportlet: <xsl:value-of select="@name"/></h2>
- <xsl:for-each select="role">
- <h3>Role <xsl:value-of select="@name"/></h3>
-
- <table style="border: 1px solid black;">
- <tr>
- <td>Id:</td>
- <td>
- <xsl:value-of select="@id"/>
- </td>
- </tr>
- <xsl:if test="@roleOwner != 'null'"> <!--!= null test="not(USER/FIRSTNAME)" -->
- <tr>
- <td>Role Owner:</td>
- <td>
- <xsl:value-of select="@roleOwner"/>
- </td>
- </tr>
- </xsl:if>
- <xsl:if test="@userOwner != 'null'">
- <tr>
- <td>User Owner:</td>
- <td>
- <xsl:value-of select="@userOwner"/>
- </td>
- </tr>
- </xsl:if>
-
- </table>
-
- <xsl:choose>
- <xsl:when test="string-length(attributes/attribute) > 0">
- <xsl:call-template name="attributes">
- <xsl:with-param name="label">Attributes</xsl:with-param>
- <xsl:with-param name="node" select="attributes/attribute"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <h5>THIS ROLE HASN'T ANY ATTRIBUTE</h5>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0">
- <xsl:call-template name="attributes">
- <xsl:with-param name="label">Derived Attributes</xsl:with-param>
- <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <h5>THIS ROLE HASN'T ANY DERIVED ATTRIBUTE</h5>
- </xsl:otherwise>
- </xsl:choose>
- <!--</xsl:if>-->
- <xsl:choose>
- <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0">
- <xsl:call-template name="attributes">
- <xsl:with-param name="label">Virtual Attributes</xsl:with-param>
- <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <h5>THIS ROLE HASN'T ANY VIRTUAL ATTRIBUTE</h5>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="entitlements/entitlement">
- <xsl:call-template name="entitlements">
- <xsl:with-param name="label">Entitlements: </xsl:with-param>
- <xsl:with-param name="node" select="entitlements/entitlement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <h5>THIS ROLE HASN'T ANY ENTITLEMENT</h5>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="users/user">
- <h4>Users</h4>
- <xsl:for-each select="users/user">
- <h5>User: <xsl:value-of select="@userUsername"/> (Id: <xsl:value-of select="@userId"/>)</h5>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <h5>THIS ROLE HASN'T ANY USER ASSIGNED TO</h5>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:call-template name="roleResources">
- <xsl:with-param name="node" select="resources/resource"/>
- </xsl:call-template>
- <hr/>
-
- </xsl:for-each>
- </xsl:template>
-
- <!--entitlement template-->
- <xsl:template name="entitlements">
- <xsl:param name="label"/>
- <xsl:param name="node"/>
-
- <h4>
- <xsl:value-of select="$label"/>
- </h4>
-
- <table>
-
- <tbody>
- <xsl:for-each select="$node">
- <tr>
- <td>
- <xsl:value-of select="@id"/>
- </td>
- </tr>
- </xsl:for-each>
- </tbody>
- </table>
- </xsl:template>
-
-
- <xsl:template name="attributes">
- <xsl:param name="label"/>
- <xsl:param name="node"/>
-
- <h4>
- <xsl:value-of select="$label"/>
- </h4>
-
- <table>
- <thead>
- <tr>
- <th>Schema name</th>
- <th>Value(s)</th>
- </tr>
- </thead>
- <tbody>
- <xsl:for-each select="$node">
- <xsl:if test="string-length(value/text()) > 0">
- <tr>
- <td>
- <xsl:value-of select="@name"/>
- </td>
- <td>
- <ul>
- <xsl:for-each select="value">
- <li>
- <xsl:value-of select="text()"/>
- </li>
- </xsl:for-each>
- </ul>
- </td>
- </tr>
- </xsl:if>
- </xsl:for-each>
- </tbody>
- </table>
- </xsl:template>
-
- <xsl:template name="roleResources">
- <xsl:param name="node"/>
-
- <h4>Role Resources</h4>
- <ul>
- <xsl:for-each select="$node">
- <li>
- <xsl:value-of select="@name"/>
- </li>
- </xsl:for-each>
- </ul>
- </xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/userReportlet2csv.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/userReportlet2csv.xsl b/core/logic/src/main/resources/report/userReportlet2csv.xsl
index 87c670f..8fd9f51 100644
--- a/core/logic/src/main/resources/report/userReportlet2csv.xsl
+++ b/core/logic/src/main/resources/report/userReportlet2csv.xsl
@@ -83,9 +83,9 @@ under the License.
<xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='membership'])
and count($attrs/*[name(.)=$nameAttr]/node()) > 0">
<xsl:text>"</xsl:text>
- <xsl:variable name="value" select="@roleName"/>
+ <xsl:variable name="value" select="@groupName"/>
<xsl:for-each select="$attrs/*/membership">
- <xsl:variable name="value" select="@roleName"/>
+ <xsl:variable name="value" select="@groupName"/>
<xsl:value-of select="$value"/>
<xsl:if test="position() != last()">
<xsl:value-of select="$delimiter"/>
@@ -116,4 +116,4 @@ under the License.
</xsl:for-each>
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/userReportlet2fo.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/userReportlet2fo.xsl b/core/logic/src/main/resources/report/userReportlet2fo.xsl
index 977ef4c..222229d 100644
--- a/core/logic/src/main/resources/report/userReportlet2fo.xsl
+++ b/core/logic/src/main/resources/report/userReportlet2fo.xsl
@@ -133,7 +133,7 @@ under the License.
<xsl:when test="string-length(memberships/membership) > 0">
<fo:block font-size="11pt" font-weight="bold">Memberships</fo:block>
<xsl:for-each select="memberships/membership">
- <fo:block font-size="10pt" font-weight="bold" space-before="2mm">Role: <xsl:value-of select="@roleName"/>(<xsl:value-of select="@roleId"/>)</fo:block>
+ <fo:block font-size="10pt" font-weight="bold" space-before="2mm">Group: <xsl:value-of select="@groupName"/>(<xsl:value-of select="@groupId"/>)</fo:block>
<fo:block start-indent="1cm" space-before="3mm" space-after="0.5cm">
<xsl:choose>
<xsl:when test="string-length(attributes/attribute) > 0">
@@ -143,7 +143,7 @@ under the License.
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <fo:block color="red" font-size="8pt" space-after="2mm">THIS ROLE HASN'T ANY ATTRIBUTE</fo:block>
+ <fo:block color="red" font-size="8pt" space-after="2mm">THIS GROUP HASN'T ANY ATTRIBUTE</fo:block>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
@@ -154,7 +154,7 @@ under the License.
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <fo:block color="red" font-size="8pt" space-after="2mm">THIS ROLE HASN'T ANY DERIVED ATTRIBUTE</fo:block>
+ <fo:block color="red" font-size="8pt" space-after="2mm">THIS GROUP HASN'T ANY DERIVED ATTRIBUTE</fo:block>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
@@ -165,18 +165,18 @@ under the License.
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <fo:block color="red" font-size="8pt" space-after="2mm">THIS ROLE HASN'T ANY VIRTUAL ATTRIBUTE</fo:block>
+ <fo:block color="red" font-size="8pt" space-after="2mm">THIS GROUP HASN'T ANY VIRTUAL ATTRIBUTE</fo:block>
</xsl:otherwise>
</xsl:choose>
- <!-- 'roleResources" is defined in roleReportlet2fo.xsl -->
- <xsl:call-template name="roleResources">
+ <!-- 'groupResources" is defined in groupReportlet2fo.xsl -->
+ <xsl:call-template name="groupResources">
<xsl:with-param name="node" select="resources/resource"/>
</xsl:call-template>
</fo:block>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
- <fo:block color="red" font-size="9pt" space-after="3mm">THIS USER HASN'T BEEN ASSIGNED TO ANY ROLE</fo:block>
+ <fo:block color="red" font-size="9pt" space-after="3mm">THIS USER HASN'T BEEN ASSIGNED TO ANY GROUP</fo:block>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="resources">
@@ -244,4 +244,4 @@ under the License.
</fo:block>
</xsl:for-each>
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/userReportlet2html.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/userReportlet2html.xsl b/core/logic/src/main/resources/report/userReportlet2html.xsl
index 751cb4c..0a0e5c5 100644
--- a/core/logic/src/main/resources/report/userReportlet2html.xsl
+++ b/core/logic/src/main/resources/report/userReportlet2html.xsl
@@ -110,7 +110,7 @@ under the License.
<xsl:when test="string-length(memberships/membership) > 0">
<h4>Memberships</h4>
<xsl:for-each select="memberships/membership">
- <h5>Role: <xsl:value-of select="@roleName"/>(<xsl:value-of select="@roleId"/>)</h5>
+ <h5>Group: <xsl:value-of select="@groupName"/>(<xsl:value-of select="@groupId"/>)</h5>
<blockquote>
<xsl:choose>
<xsl:when test="string-length(attributes/attribute) > 0">
@@ -120,7 +120,7 @@ under the License.
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <h5>THIS ROLE HASN'T ATTRIBUTES</h5>
+ <h5>THIS GROUP HASN'T ATTRIBUTES</h5>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
@@ -131,7 +131,7 @@ under the License.
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <h5>THIS ROLE HASN'T DERIVED ATTRIBUTES</h5>
+ <h5>THIS GROUP HASN'T DERIVED ATTRIBUTES</h5>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
@@ -142,18 +142,18 @@ under the License.
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <h5>THIS ROLE HASN'T VIRTUAL ATTRIBUTES</h5>
+ <h5>THIS GROUP HASN'T VIRTUAL ATTRIBUTES</h5>
</xsl:otherwise>
</xsl:choose>
- <!-- 'roleResources" is defined in roleReportlet2html.xsl -->
- <xsl:call-template name="roleResources">
+ <!-- 'groupResources" is defined in groupReportlet2html.xsl -->
+ <xsl:call-template name="groupResources">
<xsl:with-param name="node" select="resources/resource"/>
</xsl:call-template>
</blockquote>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
- <h5>THIS USER ISN'T ASSIGNED TO A ROLE</h5>
+ <h5>THIS USER ISN'T ASSIGNED TO A GROUP</h5>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="string-length(resources) > 0">
@@ -216,4 +216,4 @@ under the License.
</xsl:for-each>
</ul>
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
----------------------------------------------------------------------
diff --git a/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java b/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
index 39b79ce..fdf4d11 100644
--- a/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
+++ b/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
@@ -39,12 +39,12 @@ import javax.mail.Session;
import javax.mail.Store;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.search.RoleFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.NotificationTaskTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.IntMappingType;
@@ -137,7 +137,7 @@ public class NotificationTest {
private UserLogic userLogic;
@Autowired
- private RoleLogic roleLogic;
+ private GroupLogic groupLogic;
@Autowired
private TaskLogic taskLogic;
@@ -257,8 +257,8 @@ public class NotificationTest {
// 1. create suitable notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
- notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query());
- notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query());
+ notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query());
+ notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
@@ -279,7 +279,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7);
+ membershipTO.setGroupId(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -315,8 +315,8 @@ public class NotificationTest {
// 1. create suitable notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
- notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query());
- notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query());
+ notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query());
+ notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
@@ -336,7 +336,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7);
+ membershipTO.setGroupId(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -368,7 +368,7 @@ public class NotificationTest {
Notification notification = entityFactory.newEntity(Notification.class);
notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
notification.setUserAbout(null);
- notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query());
+ notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
@@ -389,7 +389,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7);
+ membershipTO.setGroupId(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -418,7 +418,7 @@ public class NotificationTest {
Notification notification = entityFactory.newEntity(Notification.class);
notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
notification.setUserAbout(null);
- notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query());
+ notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
@@ -439,7 +439,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7);
+ membershipTO.setGroupId(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -486,8 +486,8 @@ public class NotificationTest {
// 1. create suitable notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
- notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query());
- notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query());
+ notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query());
+ notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
@@ -510,7 +510,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7);
+ membershipTO.setGroupId(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -545,7 +545,7 @@ public class NotificationTest {
// 1. create suitable disabled notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
- notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query());
+ notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
@@ -571,7 +571,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getUniqueSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7);
+ membershipTO.setGroupId(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -588,8 +588,8 @@ public class NotificationTest {
// 1. create suitable notification for subsequent tests
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("[REST]:[RoleLogic]:[]:[create]:[SUCCESS]");
- notification.setRoleAbout(new RoleFiqlSearchConditionBuilder().is("name").equalTo("role446").query());
+ notification.addEvent("[REST]:[GroupLogic]:[]:[create]:[SUCCESS]");
+ notification.setGroupAbout(new GroupFiqlSearchConditionBuilder().is("name").equalTo("group446").query());
notification.setSelfAsRecipient(false);
notification.setRecipientAttrName("email");
@@ -609,13 +609,13 @@ public class NotificationTest {
notificationDAO.flush();
- // 2. create role
- RoleTO roleTO = new RoleTO();
- roleTO.setName("role446");
- roleTO.setParent(1L);
+ // 2. create group
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName("group446");
+ groupTO.setParent(1L);
- RoleTO createdRole = roleLogic.create(roleTO);
- assertNotNull(createdRole);
+ GroupTO createdGroup = groupLogic.create(groupTO);
+ assertNotNull(createdGroup);
// 3. force Quartz job execution and verify e-mail
notificationJob.execute(null);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/AuditManager.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/AuditManager.java b/core/misc/src/main/java/org/apache/syncope/core/misc/AuditManager.java
index 474b96d..8590aee 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/AuditManager.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/AuditManager.java
@@ -52,30 +52,30 @@ public class AuditManager {
final Object output,
final Object... input) {
- final Throwable throwable;
- final StringBuilder message = new StringBuilder();
+ final StringBuilder message = new StringBuilder(32);
- message.append("BEFORE:\n");
- message.append("\t").append(before == null ? "unknown" : before).append("\n");
+ message.append("BEFORE:\n").
+ append('\t').append(before == null ? "unknown" : before).append('\n');
message.append("INPUT:\n");
if (ArrayUtils.isNotEmpty(input)) {
for (Object obj : input) {
- message.append("\t").append(obj == null ? null : obj.toString()).append("\n");
+ message.append('\t').append(obj == null ? null : obj.toString()).append('\n');
}
} else {
- message.append("\t").append("none").append("\n");
+ message.append('\t').append("none").append('\n');
}
message.append("OUTPUT:\n");
+ Throwable throwable;
if (output instanceof Throwable) {
throwable = (Throwable) output;
- message.append("\t").append(throwable.getMessage());
+ message.append('\t').append(throwable.getMessage());
} else {
throwable = null;
- message.append("\t").append(output == null ? "none" : output.toString());
+ message.append('\t').append(output == null ? "none" : output.toString());
}
AuditLoggerName auditLoggerName = null;
@@ -93,7 +93,7 @@ public class AuditManager {
final SecurityContext ctx = SecurityContextHolder.getContext();
if (ctx != null && ctx.getAuthentication() != null) {
- auditMessage.append('[').append(ctx.getAuthentication().getName()).append(']').append(' ');
+ auditMessage.append('[').append(ctx.getAuthentication().getName()).append("] ");
}
auditMessage.append(message);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java
index adb1637..182e2c7 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java
@@ -37,7 +37,7 @@ import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.AttributableType;
@@ -46,10 +46,9 @@ import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.PasswordPolicySpec;
import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
-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.dao.PolicyDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.Attributable;
import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
@@ -61,7 +60,7 @@ import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.Subject;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.Connector;
@@ -69,7 +68,6 @@ import org.apache.syncope.core.provisioning.api.ConnectorFactory;
import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
import org.apache.syncope.core.provisioning.api.cache.VirAttrCacheValue;
import org.apache.syncope.core.misc.security.Encryptor;
-import org.apache.syncope.core.misc.security.UnauthorizedRoleException;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.misc.jexl.JexlUtil;
import org.identityconnectors.common.Base64;
@@ -102,7 +100,7 @@ public class ConnObjectUtil {
private UserDAO userDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private ExternalResourceDAO resourceDAO;
@@ -130,7 +128,7 @@ public class ConnObjectUtil {
if (subject instanceof User) {
result = ObjectClass.ACCOUNT;
}
- if (subject instanceof Role) {
+ if (subject instanceof Group) {
result = ObjectClass.GROUP;
}
@@ -138,12 +136,12 @@ public class ConnObjectUtil {
}
/**
- * Build a UserTO / RoleTO out of connector object attributes and schema mapping.
+ * Build a UserTO / GroupTO out of connector object attributes and schema mapping.
*
* @param obj connector object
* @param syncTask synchronization task
* @param attrUtil AttributableUtil
- * @param <T> user/role
+ * @param <T> user/group
* @return UserTO for the user to be created
*/
@Transactional(readOnly = true)
@@ -164,11 +162,11 @@ public class ConnObjectUtil {
}
for (MembershipTO memb : userTO.getMemberships()) {
- Role role = roleDAO.find(memb.getRoleId());
- if (role != null && role.getPasswordPolicy() != null
- && role.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
+ Group group = groupDAO.find(memb.getGroupId());
+ if (group != null && group.getPasswordPolicy() != null
+ && group.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
- ppSpecs.add(role.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
+ ppSpecs.add(group.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
}
}
@@ -203,16 +201,13 @@ public class ConnObjectUtil {
* @param original subject to get diff from
* @param syncTask synchronization task
* @param attrUtil AttributableUtil
- * @param <T> user/role
- * @return modifications for the user/role to be updated
- * @throws NotFoundException if given id does not correspond to a T instance
- * @throws UnauthorizedRoleException if there are no enough entitlements to access the T instance
+ * @param <T> user/group
+ * @return modifications for the user/group to be updated
*/
@SuppressWarnings("unchecked")
@Transactional(readOnly = true)
public <T extends AbstractAttributableMod> T getAttributableMod(final Long key, final ConnectorObject obj,
- final AbstractAttributableTO original, final SyncTask syncTask, final AttributableUtil attrUtil)
- throws NotFoundException, UnauthorizedRoleException {
+ final AbstractAttributableTO original, final SyncTask syncTask, final AttributableUtil attrUtil) {
final AbstractAttributableTO updated = getSubjectTOFromConnObject(obj, syncTask, attrUtil);
updated.setKey(key);
@@ -228,7 +223,7 @@ public class ConnObjectUtil {
}
for (MembershipTO membTO : ((UserTO) updated).getMemberships()) {
- Membership memb = user.getMembership(membTO.getRoleId());
+ Membership memb = user.getMembership(membTO.getGroupId());
if (memb != null) {
membTO.setKey(memb.getKey());
}
@@ -236,10 +231,10 @@ public class ConnObjectUtil {
return (T) AttributableOperations.diff(((UserTO) updated), ((UserTO) original), true);
}
- if (AttributableType.ROLE == attrUtil.getType()) {
+ if (AttributableType.GROUP == attrUtil.getType()) {
// reading from connector object cannot change entitlements
- ((RoleTO) updated).getEntitlements().addAll(((RoleTO) original).getEntitlements());
- return (T) AttributableOperations.diff(((RoleTO) updated), ((RoleTO) original), true);
+ ((GroupTO) updated).getEntitlements().addAll(((GroupTO) original).getEntitlements());
+ return (T) AttributableOperations.diff(((GroupTO) updated), ((GroupTO) original), true);
}
return null;
@@ -259,7 +254,7 @@ public class ConnObjectUtil {
AttrTO attributeTO;
switch (item.getIntMappingType()) {
case UserId:
- case RoleId:
+ case GroupId:
break;
case Password:
@@ -279,19 +274,19 @@ public class ConnObjectUtil {
}
break;
- case RoleName:
- if (subjectTO instanceof RoleTO) {
- ((RoleTO) subjectTO).setName(attribute == null || attribute.getValue().isEmpty()
+ case GroupName:
+ if (subjectTO instanceof GroupTO) {
+ ((GroupTO) subjectTO).setName(attribute == null || attribute.getValue().isEmpty()
|| attribute.getValue().get(0) == null
? null
: attribute.getValue().get(0).toString());
}
break;
- case RoleOwnerSchema:
- if (subjectTO instanceof RoleTO && attribute != null) {
+ case GroupOwnerSchema:
+ if (subjectTO instanceof GroupTO && attribute != null) {
// using a special attribute (with schema "", that will be ignored) for carrying the
- // RoleOwnerSchema value
+ // GroupOwnerSchema value
attributeTO = new AttrTO();
attributeTO.setSchema(StringUtils.EMPTY);
if (attribute.getValue().isEmpty() || attribute.getValue().get(0) == null) {
@@ -300,12 +295,12 @@ public class ConnObjectUtil {
attributeTO.getValues().add(attribute.getValue().get(0).toString());
}
- ((RoleTO) subjectTO).getPlainAttrs().add(attributeTO);
+ ((GroupTO) subjectTO).getPlainAttrs().add(attributeTO);
}
break;
case UserPlainSchema:
- case RolePlainSchema:
+ case GroupPlainSchema:
attributeTO = new AttrTO();
attributeTO.setSchema(item.getIntAttrName());
@@ -335,6 +330,7 @@ public class ConnObjectUtil {
attrValue.setStringValue(value.toString());
schemaType = AttrSchemaType.String;
}
+ break;
}
attributeTO.getValues().add(attrValue.getValueAsString(schemaType));
}
@@ -344,14 +340,14 @@ public class ConnObjectUtil {
break;
case UserDerivedSchema:
- case RoleDerivedSchema:
+ case GroupDerivedSchema:
attributeTO = new AttrTO();
attributeTO.setSchema(item.getIntAttrName());
subjectTO.getDerAttrs().add(attributeTO);
break;
case UserVirtualSchema:
- case RoleVirtualSchema:
+ case GroupVirtualSchema:
attributeTO = new AttrTO();
attributeTO.setSchema(item.getIntAttrName());
@@ -373,7 +369,7 @@ public class ConnObjectUtil {
// 2. add data from defined template (if any)
AbstractSubjectTO template = AttributableType.USER == attrUtil.getType()
- ? syncTask.getUserTemplate() : syncTask.getRoleTemplate();
+ ? syncTask.getUserTemplate() : syncTask.getGroupTemplate();
if (template != null) {
if (template instanceof UserTO) {
@@ -394,63 +390,63 @@ public class ConnObjectUtil {
Map<Long, MembershipTO> currentMembs = ((UserTO) subjectTO).getMembershipMap();
for (MembershipTO membTO : ((UserTO) template).getMemberships()) {
MembershipTO membTBU;
- if (currentMembs.containsKey(membTO.getRoleId())) {
- membTBU = currentMembs.get(membTO.getRoleId());
+ if (currentMembs.containsKey(membTO.getGroupId())) {
+ membTBU = currentMembs.get(membTO.getGroupId());
} else {
membTBU = new MembershipTO();
- membTBU.setRoleId(membTO.getRoleId());
+ membTBU.setGroupId(membTO.getGroupId());
((UserTO) subjectTO).getMemberships().add(membTBU);
}
fillFromTemplate(membTBU, membTO);
}
}
- if (template instanceof RoleTO) {
- if (StringUtils.isNotBlank(((RoleTO) template).getName())) {
- String evaluated = JexlUtil.evaluate(((RoleTO) template).getName(), subjectTO);
+ if (template instanceof GroupTO) {
+ if (StringUtils.isNotBlank(((GroupTO) template).getName())) {
+ String evaluated = JexlUtil.evaluate(((GroupTO) template).getName(), subjectTO);
if (StringUtils.isNotBlank(evaluated)) {
- ((RoleTO) subjectTO).setName(evaluated);
+ ((GroupTO) subjectTO).setName(evaluated);
}
}
- if (((RoleTO) template).getParent() != 0) {
- final Role parentRole = roleDAO.find(((RoleTO) template).getParent());
- if (parentRole != null) {
- ((RoleTO) subjectTO).setParent(parentRole.getKey());
+ if (((GroupTO) template).getParent() != 0) {
+ final Group parentGroup = groupDAO.find(((GroupTO) template).getParent());
+ if (parentGroup != null) {
+ ((GroupTO) subjectTO).setParent(parentGroup.getKey());
}
}
- if (((RoleTO) template).getUserOwner() != null) {
- final User userOwner = userDAO.find(((RoleTO) template).getUserOwner());
+ if (((GroupTO) template).getUserOwner() != null) {
+ final User userOwner = userDAO.find(((GroupTO) template).getUserOwner());
if (userOwner != null) {
- ((RoleTO) subjectTO).setUserOwner(userOwner.getKey());
+ ((GroupTO) subjectTO).setUserOwner(userOwner.getKey());
}
}
- if (((RoleTO) template).getRoleOwner() != null) {
- final Role roleOwner = roleDAO.find(((RoleTO) template).getRoleOwner());
- if (roleOwner != null) {
- ((RoleTO) subjectTO).setRoleOwner(roleOwner.getKey());
+ if (((GroupTO) template).getGroupOwner() != null) {
+ final Group groupOwner = groupDAO.find(((GroupTO) template).getGroupOwner());
+ if (groupOwner != null) {
+ ((GroupTO) subjectTO).setGroupOwner(groupOwner.getKey());
}
}
- ((RoleTO) subjectTO).getEntitlements().addAll(((RoleTO) template).getEntitlements());
-
- ((RoleTO) subjectTO).getRPlainAttrTemplates().addAll(((RoleTO) template).getRPlainAttrTemplates());
- ((RoleTO) subjectTO).getRDerAttrTemplates().addAll(((RoleTO) template).getRDerAttrTemplates());
- ((RoleTO) subjectTO).getRVirAttrTemplates().addAll(((RoleTO) template).getRVirAttrTemplates());
- ((RoleTO) subjectTO).getMPlainAttrTemplates().addAll(((RoleTO) template).getMPlainAttrTemplates());
- ((RoleTO) subjectTO).getMDerAttrTemplates().addAll(((RoleTO) template).getMDerAttrTemplates());
- ((RoleTO) subjectTO).getMVirAttrTemplates().addAll(((RoleTO) template).getMVirAttrTemplates());
-
- ((RoleTO) subjectTO).setAccountPolicy(((RoleTO) template).getAccountPolicy());
- ((RoleTO) subjectTO).setPasswordPolicy(((RoleTO) template).getPasswordPolicy());
-
- ((RoleTO) subjectTO).setInheritOwner(((RoleTO) template).isInheritOwner());
- ((RoleTO) subjectTO).setInheritTemplates(((RoleTO) template).isInheritTemplates());
- ((RoleTO) subjectTO).setInheritPlainAttrs(((RoleTO) template).isInheritPlainAttrs());
- ((RoleTO) subjectTO).setInheritDerAttrs(((RoleTO) template).isInheritDerAttrs());
- ((RoleTO) subjectTO).setInheritVirAttrs(((RoleTO) template).isInheritVirAttrs());
- ((RoleTO) subjectTO).setInheritPasswordPolicy(((RoleTO) template).isInheritPasswordPolicy());
- ((RoleTO) subjectTO).setInheritAccountPolicy(((RoleTO) template).isInheritAccountPolicy());
+ ((GroupTO) subjectTO).getEntitlements().addAll(((GroupTO) template).getEntitlements());
+
+ ((GroupTO) subjectTO).getGPlainAttrTemplates().addAll(((GroupTO) template).getGPlainAttrTemplates());
+ ((GroupTO) subjectTO).getGDerAttrTemplates().addAll(((GroupTO) template).getGDerAttrTemplates());
+ ((GroupTO) subjectTO).getGVirAttrTemplates().addAll(((GroupTO) template).getGVirAttrTemplates());
+ ((GroupTO) subjectTO).getMPlainAttrTemplates().addAll(((GroupTO) template).getMPlainAttrTemplates());
+ ((GroupTO) subjectTO).getMDerAttrTemplates().addAll(((GroupTO) template).getMDerAttrTemplates());
+ ((GroupTO) subjectTO).getMVirAttrTemplates().addAll(((GroupTO) template).getMVirAttrTemplates());
+
+ ((GroupTO) subjectTO).setAccountPolicy(((GroupTO) template).getAccountPolicy());
+ ((GroupTO) subjectTO).setPasswordPolicy(((GroupTO) template).getPasswordPolicy());
+
+ ((GroupTO) subjectTO).setInheritOwner(((GroupTO) template).isInheritOwner());
+ ((GroupTO) subjectTO).setInheritTemplates(((GroupTO) template).isInheritTemplates());
+ ((GroupTO) subjectTO).setInheritPlainAttrs(((GroupTO) template).isInheritPlainAttrs());
+ ((GroupTO) subjectTO).setInheritDerAttrs(((GroupTO) template).isInheritDerAttrs());
+ ((GroupTO) subjectTO).setInheritVirAttrs(((GroupTO) template).isInheritVirAttrs());
+ ((GroupTO) subjectTO).setInheritPasswordPolicy(((GroupTO) template).isInheritPasswordPolicy());
+ ((GroupTO) subjectTO).setInheritAccountPolicy(((GroupTO) template).isInheritAccountPolicy());
}
fillFromTemplate(subjectTO, template);
@@ -533,7 +529,7 @@ public class ConnObjectUtil {
/**
* Query connected external resources for values to populated virtual attributes associated with the given owner.
*
- * @param owner user or role
+ * @param owner user or group
* @param attrUtil attributable util
*/
public void retrieveVirAttrValues(final Attributable<?, ?, ?> owner, final AttributableUtil attrUtil) {
@@ -541,8 +537,8 @@ public class ConnObjectUtil {
final ConnectorFactory connFactory = context.getBean(ConnectorFactory.class);
final IntMappingType type = attrUtil.getType() == AttributableType.USER
- ? IntMappingType.UserVirtualSchema : attrUtil.getType() == AttributableType.ROLE
- ? IntMappingType.RoleVirtualSchema : IntMappingType.MembershipVirtualSchema;
+ ? IntMappingType.UserVirtualSchema : attrUtil.getType() == AttributableType.GROUP
+ ? IntMappingType.GroupVirtualSchema : IntMappingType.MembershipVirtualSchema;
final Map<String, ConnectorObject> externalResources = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java
index 267cfa0..8075650 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java
@@ -55,11 +55,11 @@ import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema;
@@ -133,8 +133,8 @@ public final class MappingUtil {
/**
* Prepare attributes for sending to a connector instance.
*
- * @param attrUtil user / role
- * @param subject given user / role
+ * @param attrUtil user / group
+ * @param subject given user / group
* @param password clear-text password
* @param changePwd whether password should be included for propagation attributes or not
* @param vAttrsToBeRemoved virtual attributes to be removed
@@ -172,8 +172,8 @@ public final class MappingUtil {
try {
if ((attrUtil.getType() == AttributableType.USER
&& mapping.getIntMappingType() == IntMappingType.UserVirtualSchema)
- || (attrUtil.getType() == AttributableType.ROLE
- && mapping.getIntMappingType() == IntMappingType.RoleVirtualSchema)) {
+ || (attrUtil.getType() == AttributableType.GROUP
+ && mapping.getIntMappingType() == IntMappingType.GroupVirtualSchema)) {
LOG.debug("Expire entry cache {}-{}", subject.getKey(), mapping.getIntAttrName());
virAttrCache.expire(attrUtil.getType(), subject.getKey(), mapping.getIntAttrName());
@@ -272,14 +272,14 @@ public final class MappingUtil {
}
break;
- case ROLE:
+ case GROUP:
if (subject instanceof User) {
- for (Role role : ((User) subject).getRoles()) {
- connObjectUtil.retrieveVirAttrValues(role, attrUtilFactory.getInstance(role));
- attributables.add(role);
+ for (Group group : ((User) subject).getGroups()) {
+ connObjectUtil.retrieveVirAttrValues(group, attrUtilFactory.getInstance(group));
+ attributables.add(group);
}
}
- if (subject instanceof Role) {
+ if (subject instanceof Group) {
attributables.add(subject);
}
break;
@@ -304,7 +304,7 @@ public final class MappingUtil {
switch (mapItem.getIntMappingType()) {
case UserPlainSchema:
- case RolePlainSchema:
+ case GroupPlainSchema:
case MembershipPlainSchema:
final PlainSchemaDAO plainSchemaDAO = context.getBean(PlainSchemaDAO.class);
schema = plainSchemaDAO.find(mapItem.getIntAttrName(),
@@ -313,7 +313,7 @@ public final class MappingUtil {
break;
case UserVirtualSchema:
- case RoleVirtualSchema:
+ case GroupVirtualSchema:
case MembershipVirtualSchema:
VirSchemaDAO virSchemaDAO = context.getBean(VirSchemaDAO.class);
VirSchema virSchema = virSchemaDAO.find(mapItem.getIntAttrName(),
@@ -402,7 +402,7 @@ public final class MappingUtil {
* Build __NAME__ for propagation. First look if there ia a defined accountLink for the given resource (and in this
* case evaluate as JEXL); otherwise, take given accountId.
*
- * @param subject given user / role
+ * @param subject given user / group
* @param resource target resource
* @param accountId accountId
* @return the value to be propagated as __NAME__
@@ -447,7 +447,7 @@ public final class MappingUtil {
return name;
}
- private static String getRoleOwnerValue(
+ private static String getGroupOwnerValue(
final ExternalResource resource, final Subject<?, ?, ?> subject) {
AttributableUtilFactory attrUtilFactory =
@@ -459,8 +459,8 @@ public final class MappingUtil {
Collections.<String>emptySet(), Collections.<String, AttrMod>emptyMap());
String accountId = preparedAttr.getKey();
- final Name roleOwnerName = evaluateNAME(subject, resource, accountId);
- return roleOwnerName.getNameValue();
+ final Name groupOwnerName = evaluateNAME(subject, resource, accountId);
+ return groupOwnerName.getNameValue();
}
/**
@@ -488,7 +488,7 @@ public final class MappingUtil {
PlainAttrValue attrValue;
switch (mappingItem.getIntMappingType()) {
case UserPlainSchema:
- case RolePlainSchema:
+ case GroupPlainSchema:
case MembershipPlainSchema:
for (Attributable<?, ?, ?> attributable : attributables) {
final PlainAttr attr = attributable.getPlainAttr(mappingItem.getIntAttrName());
@@ -510,7 +510,7 @@ public final class MappingUtil {
break;
case UserVirtualSchema:
- case RoleVirtualSchema:
+ case GroupVirtualSchema:
for (Attributable<?, ?, ?> attributable : attributables) {
VirAttr virAttr = attributable.getVirAttr(mappingItem.getIntAttrName());
if (virAttr != null) {
@@ -579,13 +579,13 @@ public final class MappingUtil {
break;
case UserDerivedSchema:
- case RoleDerivedSchema:
+ case GroupDerivedSchema:
case MembershipDerivedSchema:
for (Attributable<?, ?, ?> attributable : attributables) {
DerAttr derAttr = attributable.getDerAttr(mappingItem.getIntAttrName());
if (derAttr != null) {
- attrValue = attributable instanceof Role
- ? entityFactory.newEntity(RPlainAttrValue.class)
+ attrValue = attributable instanceof Group
+ ? entityFactory.newEntity(GPlainAttrValue.class)
: entityFactory.newEntity(UPlainAttrValue.class);
attrValue.setStringValue(derAttr.getValue(attributable.getPlainAttrs()));
values.add(attrValue);
@@ -600,7 +600,7 @@ public final class MappingUtil {
break;
case UserId:
- case RoleId:
+ case GroupId:
case MembershipId:
for (Attributable<?, ?, ?> attributable : attributables) {
attrValue = entityFactory.newEntity(UPlainAttrValue.class);
@@ -619,31 +619,31 @@ public final class MappingUtil {
}
break;
- case RoleName:
+ case GroupName:
for (Attributable<?, ?, ?> attributable : attributables) {
- if (attributable instanceof Role) {
- attrValue = entityFactory.newEntity(RPlainAttrValue.class);
- attrValue.setStringValue(((Role) attributable).getName());
+ if (attributable instanceof Group) {
+ attrValue = entityFactory.newEntity(GPlainAttrValue.class);
+ attrValue.setStringValue(((Group) attributable).getName());
values.add(attrValue);
}
}
break;
- case RoleOwnerSchema:
+ case GroupOwnerSchema:
for (Attributable<?, ?, ?> attributable : attributables) {
- if (attributable instanceof Role) {
- Role role = (Role) attributable;
- String roleOwnerValue = null;
- if (role.getUserOwner() != null && resource.getUmapping() != null) {
- roleOwnerValue = getRoleOwnerValue(resource, role.getUserOwner());
+ if (attributable instanceof Group) {
+ Group group = (Group) attributable;
+ String groupOwnerValue = null;
+ if (group.getUserOwner() != null && resource.getUmapping() != null) {
+ groupOwnerValue = getGroupOwnerValue(resource, group.getUserOwner());
}
- if (role.getRoleOwner() != null && resource.getRmapping() != null) {
- roleOwnerValue = getRoleOwnerValue(resource, role.getRoleOwner());
+ if (group.getGroupOwner() != null && resource.getGmapping() != null) {
+ groupOwnerValue = getGroupOwnerValue(resource, group.getGroupOwner());
}
- if (StringUtils.isNotBlank(roleOwnerValue)) {
- attrValue = entityFactory.newEntity(RPlainAttrValue.class);
- attrValue.setStringValue(roleOwnerValue);
+ if (StringUtils.isNotBlank(groupOwnerValue)) {
+ attrValue = entityFactory.newEntity(GPlainAttrValue.class);
+ attrValue.setStringValue(groupOwnerValue);
values.add(attrValue);
}
}
@@ -691,8 +691,8 @@ public final class MappingUtil {
result = UPlainSchema.class;
break;
- case RolePlainSchema:
- result = RPlainSchema.class;
+ case GroupPlainSchema:
+ result = GPlainSchema.class;
break;
case MembershipPlainSchema:
@@ -703,8 +703,8 @@ public final class MappingUtil {
result = UDerSchema.class;
break;
- case RoleDerivedSchema:
- result = RDerSchema.class;
+ case GroupDerivedSchema:
+ result = GDerSchema.class;
break;
case MembershipDerivedSchema:
@@ -715,8 +715,8 @@ public final class MappingUtil {
result = UVirSchema.class;
break;
- case RoleVirtualSchema:
- result = RVirSchema.class;
+ case GroupVirtualSchema:
+ result = GVirSchema.class;
break;
case MembershipVirtualSchema:
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/EmptyClassLoader.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/EmptyClassLoader.java b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/EmptyClassLoader.java
index 6b21915..fe688f3 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/EmptyClassLoader.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/EmptyClassLoader.java
@@ -29,7 +29,7 @@ class EmptyClassLoader extends ClassLoader {
}
@Override
- protected Class<?> loadClass(final String name, boolean resolve) throws ClassNotFoundException {
+ protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
throw new ClassNotFoundException("This classloader won't attemp to load " + name);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java
index e060dca..b624eaa 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java
@@ -48,28 +48,24 @@ import org.slf4j.LoggerFactory;
*/
public final class JexlUtil {
- /**
- * Logger.
- *
- */
private static final Logger LOG = LoggerFactory.getLogger(JexlUtil.class);
private static final String[] IGNORE_FIELDS = { "password", "clearPassword", "serialVersionUID", "class" };
- private static JexlEngine jexlEngine;
+ private static JexlEngine JEXL_ENGINE;
private static JexlEngine getEngine() {
synchronized (LOG) {
- if (jexlEngine == null) {
- jexlEngine = new JexlEngine(new ClassFreeUberspectImpl(null), null, null, null);
- jexlEngine.setClassLoader(new EmptyClassLoader());
- jexlEngine.setCache(512);
- jexlEngine.setLenient(true);
- jexlEngine.setSilent(false);
+ if (JEXL_ENGINE == null) {
+ JEXL_ENGINE = new JexlEngine(new ClassFreeUberspectImpl(null), null, null, null);
+ JEXL_ENGINE.setClassLoader(new EmptyClassLoader());
+ JEXL_ENGINE.setCache(512);
+ JEXL_ENGINE.setLenient(true);
+ JEXL_ENGINE.setSilent(false);
}
}
- return jexlEngine;
+ return JEXL_ENGINE;
}
public static boolean isExpressionValid(final String expression) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
index c924721..ab0e7fb 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
@@ -35,9 +35,7 @@ public class AccountPolicyEnforcer implements PolicyEnforcer<AccountPolicySpec,
private UserSuspender userSuspender;
@Override
- public void enforce(final AccountPolicySpec policy, final PolicyType type, final User user)
- throws AccountPolicyException, PolicyEnforceException {
-
+ public void enforce(final AccountPolicySpec policy, final PolicyType type, final User user) {
if (user.getUsername() == null) {
throw new PolicyEnforceException("Invalid account");
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java
index 12968c5..41a6bb6 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java
@@ -27,9 +27,7 @@ import org.springframework.stereotype.Component;
public class PasswordPolicyEnforcer implements PolicyEnforcer<PasswordPolicySpec, User> {
@Override
- public void enforce(final PasswordPolicySpec policy, final PolicyType type, final User user)
- throws PasswordPolicyException, PolicyEnforceException {
-
+ public void enforce(final PasswordPolicySpec policy, final PolicyType type, final User user) {
final String clearPassword = user.getClearPassword();
final String password = user.getPassword();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java
index fb9f364..c8274a4 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java
@@ -18,13 +18,10 @@
*/
package org.apache.syncope.core.misc.policy;
-import java.io.InvalidObjectException;
-
import org.apache.syncope.common.lib.types.PolicySpec;
import org.apache.syncope.common.lib.types.PolicyType;
public interface PolicyEnforcer<T extends PolicySpec, E> {
- void enforce(final T policy, final PolicyType type, final E object)
- throws InvalidObjectException, PolicyException;
+ void enforce(final T policy, final PolicyType type, final E object);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
index dd56314..e6756ad 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
@@ -20,7 +20,7 @@ package org.apache.syncope.core.misc.search;
import org.apache.cxf.jaxrs.ext.search.SearchBean;
import org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser;
-import org.apache.syncope.common.lib.search.SyncopeFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
/**
@@ -37,7 +37,7 @@ public final class SearchCondConverter {
*/
public static SearchCond convert(final String fiqlExpression) {
FiqlParser<SearchBean> fiqlParser = new FiqlParser<SearchBean>(
- SearchBean.class, SyncopeFiqlSearchConditionBuilder.CONTEXTUAL_PROPERTIES);
+ SearchBean.class, AbstractFiqlSearchConditionBuilder.CONTEXTUAL_PROPERTIES);
SearchCondVisitor searchCondVisitor = new SearchCondVisitor();
searchCondVisitor.visit(fiqlParser.parse(fiqlExpression));
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
index 3e941ac..949dee7 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
@@ -28,7 +28,7 @@ import org.apache.cxf.jaxrs.ext.search.SearchUtils;
import org.apache.cxf.jaxrs.ext.search.visitor.AbstractSearchConditionVisitor;
import org.apache.syncope.common.lib.search.SearchableFields;
import org.apache.syncope.common.lib.search.SpecialAttr;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
import org.apache.syncope.core.persistence.api.dao.search.EntitlementCond;
@@ -47,7 +47,7 @@ public class SearchCondVisitor extends AbstractSearchConditionVisitor<SearchBean
static {
ATTRIBUTABLE_FIELDS = new ArrayList<String>();
ATTRIBUTABLE_FIELDS.addAll(SearchableFields.get(UserTO.class));
- ATTRIBUTABLE_FIELDS.addAll(SearchableFields.get(RoleTO.class));
+ ATTRIBUTABLE_FIELDS.addAll(SearchableFields.get(GroupTO.class));
}
private SearchCond searchCond;
@@ -96,9 +96,9 @@ public class SearchCondVisitor extends AbstractSearchConditionVisitor<SearchBean
leaf = SearchCond.getLeafCond(attributeCond);
} else {
switch (specialAttrName) {
- case ROLES:
+ case GROUPS:
MembershipCond membershipCond = new MembershipCond();
- membershipCond.setRoleId(Long.valueOf(value));
+ membershipCond.setGroupId(Long.valueOf(value));
leaf = SearchCond.getLeafCond(membershipCond);
break;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java
index 6f91fe3..d88c353 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java
@@ -52,15 +52,15 @@ public final class AuthContextUtil {
}
/**
- * Extend the current authentication context to include the given role.
+ * Extend the current authentication context to include the given group.
*
- * @param roleKey role key
- * @param roleEntitlement role entitlement
+ * @param groupKey group key
+ * @param groupEntitlement group entitlement
*/
- public static void extendAuthContext(final Long roleKey, final String roleEntitlement) {
+ public static void extendAuthContext(final Long groupKey, final String groupEntitlement) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
List<GrantedAuthority> authorities = new ArrayList<>(auth.getAuthorities());
- authorities.add(new SimpleGrantedAuthority(roleEntitlement));
+ authorities.add(new SimpleGrantedAuthority(groupEntitlement));
Authentication newAuth = new UsernamePasswordAuthenticationToken(
auth.getPrincipal(), auth.getCredentials(), authorities);
SecurityContextHolder.getContext().setAuthentication(newAuth);
[48/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeAuthenticationProvider.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeAuthenticationProvider.java
index 0094aef..6d530ae 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeAuthenticationProvider.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeAuthenticationProvider.java
@@ -18,11 +18,11 @@
*/
package org.apache.syncope.core.misc.security;
-import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.Set;
import javax.annotation.Resource;
+import org.apache.commons.collections4.SetUtils;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.AuditElements.Result;
@@ -30,16 +30,16 @@ import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.core.persistence.api.dao.ConfDAO;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
-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.provisioning.api.ConnectorFactory;
import org.apache.syncope.core.misc.AuditManager;
-import org.apache.syncope.core.misc.MappingUtil;
+import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
import org.identityconnectors.framework.common.objects.Uid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,6 +68,9 @@ public class SyncopeAuthenticationProvider implements AuthenticationProvider {
protected ConfDAO confDAO;
@Autowired
+ protected RealmDAO realmDAO;
+
+ @Autowired
protected UserDAO userDAO;
@Autowired
@@ -77,7 +80,7 @@ public class SyncopeAuthenticationProvider implements AuthenticationProvider {
protected ConnectorFactory connFactory;
@Autowired
- protected AttributableUtilFactory attrUtilFactory;
+ protected AttributableUtilsFactory attrUtilsFactory;
@Resource(name = "adminUser")
protected String adminUser;
@@ -232,46 +235,32 @@ public class SyncopeAuthenticationProvider implements AuthenticationProvider {
}
}
- // 2. look for owned groups, pick the ones whose account policy has authentication resources
- for (Group group : user.getGroups()) {
- if (group.getAccountPolicy() != null && !group.getAccountPolicy().getResources().isEmpty()) {
+ // 2. look for realms, pick the ones whose account policy has authentication resources
+ for (Realm realm : realmDAO.findAncestors(user.getRealm())) {
+ if (realm.getAccountPolicy() != null && !realm.getAccountPolicy().getResources().isEmpty()) {
if (result == null) {
- result = group.getAccountPolicy().getResources();
+ result = realm.getAccountPolicy().getResources();
} else {
- result.retainAll(group.getAccountPolicy().getResources());
+ result.retainAll(realm.getAccountPolicy().getResources());
}
}
}
- // 3. look for global account policy (if defined)
- AccountPolicy global = policyDAO.getGlobalAccountPolicy();
- if (global != null && !global.getResources().isEmpty()) {
- if (result == null) {
- result = global.getResources();
- } else {
- result.retainAll(global.getResources());
- }
- }
-
- if (result == null) {
- result = Collections.emptySet();
- }
-
- return result;
+ return SetUtils.emptyIfNull(result);
}
protected boolean authenticate(final User user, final String password) {
boolean authenticated = encryptor.verify(password, user.getCipherAlgorithm(), user.getPassword());
LOG.debug("{} authenticated on internal storage: {}", user.getUsername(), authenticated);
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(AttributableType.USER);
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(AttributableType.USER);
for (Iterator<? extends ExternalResource> itor = getPassthroughResources(user).iterator();
itor.hasNext() && !authenticated;) {
ExternalResource resource = itor.next();
String accountId = null;
try {
- accountId = MappingUtil.getAccountIdValue(user, resource, attrUtil.getAccountIdItem(resource));
+ accountId = MappingUtils.getAccountIdValue(user, resource, attrUtils.getAccountIdItem(resource));
Uid uid = connFactory.getConnector(resource).authenticate(accountId, password, null);
if (uid != null) {
authenticated = true;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeGrantedAuthority.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeGrantedAuthority.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeGrantedAuthority.java
new file mode 100644
index 0000000..860224e
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeGrantedAuthority.java
@@ -0,0 +1,76 @@
+/*
+ * 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.misc.security;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.SetUtils;
+import org.apache.syncope.common.lib.types.Entitlement;
+import org.apache.syncope.core.misc.RealmUtils;
+import org.springframework.security.core.GrantedAuthority;
+
+public class SyncopeGrantedAuthority implements GrantedAuthority {
+
+ private static final long serialVersionUID = -5647624636011919735L;
+
+ private final Entitlement entitlement;
+
+ private final Set<String> realms = SetUtils.orderedSet(new HashSet<String>());
+
+ public SyncopeGrantedAuthority(final Entitlement entitlement) {
+ this.entitlement = entitlement;
+ }
+
+ public SyncopeGrantedAuthority(final Entitlement entitlement, final String realm) {
+ this.entitlement = entitlement;
+ this.realms.add(realm);
+ }
+
+ public boolean addRealm(final String newRealm) {
+ return RealmUtils.normalizingAddTo(realms, newRealm);
+ }
+
+ public void addRealms(final List<String> newRealms) {
+ CollectionUtils.forAllDo(newRealms, new Closure<String>() {
+
+ @Override
+ public void execute(final String newRealm) {
+ addRealm(newRealm);
+ }
+ });
+ }
+
+ public Entitlement getEntitlement() {
+ return entitlement;
+ }
+
+ public Set<String> getRealms() {
+ return Collections.unmodifiableSet(realms);
+ }
+
+ @Override
+ public String getAuthority() {
+ return entitlement.name();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeUserDetailsService.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeUserDetailsService.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeUserDetailsService.java
index d617ae2..31f8346 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeUserDetailsService.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeUserDetailsService.java
@@ -18,20 +18,27 @@
*/
package org.apache.syncope.core.misc.security;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Resource;
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.PredicateUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.syncope.common.lib.CollectionUtils2;
import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
+import org.apache.syncope.common.lib.types.Entitlement;
+import org.apache.syncope.core.misc.RealmUtils;
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.Entitlement;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.Role;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
@@ -46,9 +53,6 @@ public class SyncopeUserDetailsService implements UserDetailsService {
@Autowired
protected GroupDAO groupDAO;
- @Autowired
- protected EntitlementDAO entitlementDAO;
-
@Resource(name = "adminUser")
protected String adminUser;
@@ -57,45 +61,60 @@ public class SyncopeUserDetailsService implements UserDetailsService {
@Override
public UserDetails loadUserByUsername(final String username) {
- final Set<SimpleGrantedAuthority> authorities = new HashSet<>();
+ final Set<SyncopeGrantedAuthority> authorities = new HashSet<>();
if (anonymousUser.equals(username)) {
- authorities.add(new SimpleGrantedAuthority(SyncopeConstants.ANONYMOUS_ENTITLEMENT));
+ authorities.add(new SyncopeGrantedAuthority(Entitlement.ANONYMOUS));
} else if (adminUser.equals(username)) {
- for (Entitlement entitlement : entitlementDAO.findAll()) {
- authorities.add(new SimpleGrantedAuthority(entitlement.getKey()));
- }
+ CollectionUtils2.collect(Arrays.asList(Entitlement.values()),
+ new Transformer<Entitlement, SyncopeGrantedAuthority>() {
+
+ @Override
+ public SyncopeGrantedAuthority transform(final Entitlement entitlement) {
+ return new SyncopeGrantedAuthority(entitlement, SyncopeConstants.ROOT_REALM);
+ }
+ },
+ PredicateUtils.notPredicate(PredicateUtils.equalPredicate(Entitlement.ANONYMOUS)),
+ authorities);
} else {
org.apache.syncope.core.persistence.api.entity.user.User user = userDAO.find(username);
-
if (user == null) {
throw new UsernameNotFoundException("Could not find any user with id " + username);
}
- // Give entitlements based on groups assigned to user (and their ancestors)
- final Set<Group> groups = new HashSet<>(user.getGroups());
- for (Group group : user.getGroups()) {
- groups.addAll(groupDAO.findAncestors(group));
- }
- for (Group group : groups) {
- for (Entitlement entitlement : group.getEntitlements()) {
- authorities.add(new SimpleGrantedAuthority(entitlement.getKey()));
- }
+ // Give entitlements as assigned by roles (with realms, where applicable)
+ for (final Role role : user.getRoles()) {
+ CollectionUtils.forAllDo(role.getEntitlements(), new Closure<Entitlement>() {
+
+ @Override
+ public void execute(final Entitlement entitlement) {
+ SyncopeGrantedAuthority authority = new SyncopeGrantedAuthority(entitlement);
+ authorities.add(authority);
+
+ List<String> realmFullPahs = new ArrayList<>();
+ CollectionUtils.collect(role.getRealms(), new Transformer<Realm, String>() {
+
+ @Override
+ public String transform(final Realm realm) {
+ return realm.getFullPath();
+ }
+ }, realmFullPahs);
+ authority.addRealms(realmFullPahs);
+ }
+ });
}
- // Give group operational entitlements for owned groups
- List<Group> ownedGroups = groupDAO.findOwnedByUser(user.getKey());
- if (!ownedGroups.isEmpty()) {
- authorities.add(new SimpleGrantedAuthority("GROUP_CREATE"));
- authorities.add(new SimpleGrantedAuthority("GROUP_READ"));
- authorities.add(new SimpleGrantedAuthority("GROUP_UPDATE"));
- authorities.add(new SimpleGrantedAuthority("GROUP_DELETE"));
- for (Group group : ownedGroups) {
- authorities.add(new SimpleGrantedAuthority(
- GroupEntitlementUtil.getEntitlementNameFromGroupKey(group.getKey())));
+ // Give group entitlements for owned groups
+ for (Group group : groupDAO.findOwnedByUser(user.getKey())) {
+ for (Entitlement entitlement : Arrays.asList(
+ Entitlement.GROUP_READ, Entitlement.GROUP_UPDATE, Entitlement.GROUP_DELETE)) {
+
+ SyncopeGrantedAuthority authority = new SyncopeGrantedAuthority(entitlement);
+ authority.addRealm(RealmUtils.getGroupOwnerRealm(group.getRealm().getFullPath(), group.getKey()));
+ authorities.add(authority);
}
}
}
- return new User(username, "<PASSWORD_PLACEHOLDER>", true, true, true, true, authorities);
+ return new User(username, "<PASSWORD_PLACEHOLDER>", authorities);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedException.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedException.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedException.java
new file mode 100644
index 0000000..85df5b7
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedException.java
@@ -0,0 +1,30 @@
+/*
+ * 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.misc.security;
+
+import org.apache.syncope.common.lib.types.SubjectType;
+
+public class UnauthorizedException extends RuntimeException {
+
+ private static final long serialVersionUID = 7540587364235915081L;
+
+ public UnauthorizedException(final SubjectType subject, final Long key) {
+ super("Missing entitlement or realm administration for " + subject + " " + key);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java
deleted file mode 100644
index e1a817f..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/UnauthorizedGroupException.java
+++ /dev/null
@@ -1,42 +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.misc.security;
-
-import java.util.Collection;
-import java.util.Collections;
-
-public class UnauthorizedGroupException extends RuntimeException {
-
- private static final long serialVersionUID = 7540587364235915081L;
-
- private final Collection<Long> groupIds;
-
- public UnauthorizedGroupException(final Collection<Long> groupIds) {
- super("Missing entitlement for group(s) " + groupIds);
- this.groupIds = groupIds;
- }
-
- public UnauthorizedGroupException(final Long groupId) {
- this(Collections.singleton(groupId));
- }
-
- public Collection<Long> getGroupIds() {
- return groupIds;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
----------------------------------------------------------------------
diff --git a/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java b/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
index f358de2..db222af 100644
--- a/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
+++ b/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
@@ -20,11 +20,9 @@ package org.apache.syncope.core.misc.search;
import static org.junit.Assert.assertEquals;
-import org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.search.SpecialAttr;
import org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder;
import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
-import org.apache.syncope.core.persistence.api.dao.search.EntitlementCond;
import org.apache.syncope.core.persistence.api.dao.search.MembershipCond;
import org.apache.syncope.core.persistence.api.dao.search.ResourceCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
@@ -108,18 +106,6 @@ public class SearchCondConverterTest {
}
@Test
- public void entitlements() {
- String fiqlExpression = new GroupFiqlSearchConditionBuilder().hasEntitlements("USER_LIST").query();
- assertEquals(SpecialAttr.ENTITLEMENTS + "==USER_LIST", fiqlExpression);
-
- EntitlementCond entCond = new EntitlementCond();
- entCond.setExpression("USER_LIST");
- SearchCond simpleCond = SearchCond.getLeafCond(entCond);
-
- assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
- }
-
- @Test
public void and() {
String fiqlExpression = new UserFiqlSearchConditionBuilder().
is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query();
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java
deleted file mode 100644
index 723dfe1..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/GroupEntitlementUtil.java
+++ /dev/null
@@ -1,92 +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;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Pattern;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Utility class for manipulating entitlements.
- */
-public final class GroupEntitlementUtil {
-
- private static final Pattern GROUP_ENTITLEMENT_NAME_PATTERN = Pattern.compile("^GROUP_([\\d])+");
-
- private static final Logger LOG = LoggerFactory.getLogger(GroupEntitlementUtil.class);
-
- public static String getEntitlementNameFromGroupKey(final Long groupKey) {
- return "GROUP_" + groupKey;
- }
-
- public static boolean isGroupEntitlement(final String entitlementName) {
- return GROUP_ENTITLEMENT_NAME_PATTERN.matcher(entitlementName).matches();
- }
-
- public static Long getGroupKey(final String entitlementName) {
- Long result = null;
-
- if (isGroupEntitlement(entitlementName)) {
- try {
- result = Long.valueOf(entitlementName.substring(entitlementName.indexOf('_') + 1));
- } catch (Exception e) {
- LOG.error("unable to parse {} to Long", entitlementName, e);
- }
- }
-
- return result;
- }
-
- public static Set<Long> getGroupKeys(final Set<String> entitlements) {
- Set<Long> result = new HashSet<>();
-
- for (String entitlement : entitlements) {
- if (isGroupEntitlement(entitlement)) {
- Long groupId = getGroupKey(entitlement);
- if (groupId != null) {
- result.add(groupId);
- }
- }
- }
-
- return result;
- }
-
- public static Set<Long> getGroupKeys(final List<Entitlement> entitlements) {
- return getGroupKeys(CollectionUtils.collect(entitlements, new Transformer<Entitlement, String>() {
-
- @Override
- public String transform(final Entitlement entitlement) {
- return entitlement.getKey();
- }
- }, new HashSet<String>()));
- }
-
- /**
- * Private default constructor, for static-only classes.
- */
- private GroupEntitlementUtil() {
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java
index 3376e3f..6c959aa 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java
@@ -19,7 +19,7 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
@@ -33,5 +33,5 @@ public interface DerSchemaDAO extends DAO<DerSchema, String> {
<T extends DerSchema> T save(T derSchema);
- void delete(String name, AttributableUtil attributableUtil);
+ void delete(String name, AttributableUtils attributableUtil);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java
deleted file mode 100644
index 560ff91..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java
+++ /dev/null
@@ -1,38 +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 java.util.List;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-
-public interface EntitlementDAO extends DAO<Entitlement, String> {
-
- Entitlement find(String key);
-
- List<Entitlement> findAll();
-
- Entitlement save(Entitlement entitlement);
-
- Entitlement saveGroupEntitlement(Group group);
-
- void delete(String key);
-
- void delete(Entitlement entitlement);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/GroupDAO.java
----------------------------------------------------------------------
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 56ea6c2..a81db9d 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
@@ -20,12 +20,10 @@ package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import java.util.Map;
-import org.apache.syncope.common.lib.types.PolicyType;
+import java.util.Set;
import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.Policy;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
@@ -37,41 +35,27 @@ public interface GroupDAO extends SubjectDAO<GPlainAttr, GDerAttr, GVirAttr> {
Group find(Long key);
- List<Group> find(String name);
+ Group find(String name);
- Group find(String name, Long parent);
+ List<Group> findOwnedByUser(Long userKey);
- List<Group> findOwnedByUser(Long userId);
+ List<Group> findOwnedByGroup(Long groupKey);
- List<Group> findOwnedByGroup(Long groupId);
-
- List<Group> findByEntitlement(Entitlement entitlement);
-
- List<Group> findByPolicy(Policy policy);
-
- List<Group> findWithoutPolicy(PolicyType type);
-
- List<Group> findAncestors(Group group);
-
- List<Group> findChildren(Group group);
-
- List<Group> findDescendants(Group group);
+ List<Group> findByAttrValue(String schemaName, GPlainAttrValue attrValue);
List<Group> findByDerAttrValue(String schemaName, String value);
- List<Group> findByAttrValue(String schemaName, GPlainAttrValue attrValue);
-
Group findByAttrUniqueValue(String schemaName, GPlainAttrValue attrUniqueValue);
List<Group> findByResource(ExternalResource resource);
- List<Group> findAll();
+ List<Group> findAll(Set<String> adminRealms, int page, int itemsPerPage);
- List<Group> findAll(int page, int itemsPerPage, List<OrderByClause> orderBy);
+ List<Group> findAll(Set<String> adminRealms, int page, int itemsPerPage, List<OrderByClause> orderBy);
List<Membership> findMemberships(Group group);
- int count();
+ int count(Set<String> adminRealms);
Group save(Group group);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java
index 717a3c4..122faee 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java
@@ -19,7 +19,7 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
@@ -33,5 +33,5 @@ public interface PlainSchemaDAO extends DAO<PlainSchema, String> {
<T extends PlainSchema> T save(T schema);
- void delete(String name, AttributableUtil attributableUtil);
+ void delete(String name, AttributableUtils attributableUtil);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
index 0eefcbb..dff687d 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
@@ -22,9 +22,7 @@ import java.util.List;
import org.apache.syncope.common.lib.types.PolicyType;
import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Policy;
-import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
public interface PolicyDAO extends DAO<Policy, Long> {
@@ -34,12 +32,6 @@ public interface PolicyDAO extends DAO<Policy, Long> {
List<AccountPolicy> findByResource(ExternalResource resource);
- PasswordPolicy getGlobalPasswordPolicy();
-
- AccountPolicy getGlobalAccountPolicy();
-
- SyncPolicy getGlobalSyncPolicy();
-
List<Policy> findAll();
<T extends Policy> T save(T policy);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
index 5aa6106..515779e 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
@@ -19,6 +19,7 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
+import org.apache.syncope.core.persistence.api.entity.Policy;
import org.apache.syncope.core.persistence.api.entity.Realm;
public interface RealmDAO extends DAO<Realm, Long> {
@@ -29,6 +30,10 @@ public interface RealmDAO extends DAO<Realm, Long> {
Realm find(String fullPath);
+ <T extends Policy> List<Realm> findByPolicy(T policy);
+
+ List<Realm> findAncestors(Realm realm);
+
List<Realm> findChildren(Realm realm);
List<Realm> findDescendants(Realm realm);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectDAO.java
index 9e909d7..aca7bf4 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectDAO.java
@@ -19,7 +19,7 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
@@ -31,14 +31,14 @@ public interface SubjectDAO<P extends PlainAttr, D extends DerAttr, V extends Vi
extends DAO<Subject<P, D, V>, Long> {
List<? extends Subject<P, D, V>> findByAttrValue(
- String schemaName, PlainAttrValue attrValue, AttributableUtil attrUtil);
+ String schemaName, PlainAttrValue attrValue, AttributableUtils attrUtils);
Subject<P, D, V> findByAttrUniqueValue(
- String schemaName, PlainAttrValue attrUniqueValue, AttributableUtil attrUtil);
+ String schemaName, PlainAttrValue attrUniqueValue, AttributableUtils attrUtils);
List<? extends Subject<P, D, V>> findByDerAttrValue(
- String schemaName, String value, AttributableUtil attrUtil);
+ String schemaName, String value, AttributableUtils attrUtils);
List<? extends Subject<P, D, V>> findByResource(
- ExternalResource resource, AttributableUtil attrUtil);
+ ExternalResource resource, AttributableUtils attrUtils);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java
index c90cdf8..a4cd7d4 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java
@@ -28,25 +28,25 @@ import org.apache.syncope.core.persistence.api.entity.Subject;
public interface SubjectSearchDAO extends DAO<Subject<?, ?, ?>, Long> {
/**
- * @param adminGroups the set of admin groups owned by the caller
+ * @param adminRealms realms for which the caller owns the proper entitlement(s)
* @param searchCondition the search condition
* @param type user or group
* @return size of search result
*/
- int count(Set<Long> adminGroups, SearchCond searchCondition, SubjectType type);
+ int count(Set<String> adminRealms, SearchCond searchCondition, SubjectType type);
/**
- * @param adminGroups the set of admin groups owned by the caller
+ * @param adminRealms realms for which the caller owns the proper entitlement(s)
* @param searchCondition the search condition
* @param type user or group
* @param <T> user/group
* @return the list of users/groups matching the given search condition
*/
<T extends Subject<?, ?, ?>> List<T> search(
- Set<Long> adminGroups, SearchCond searchCondition, SubjectType type);
+ Set<String> adminRealms, SearchCond searchCondition, SubjectType type);
/**
- * @param adminGroups the set of admin groups owned by the caller
+ * @param adminRealms the set of admin groups owned by the caller
* @param searchCondition the search condition
* @param orderBy list of ordering clauses
* @param type user or group
@@ -54,10 +54,10 @@ public interface SubjectSearchDAO extends DAO<Subject<?, ?, ?>, Long> {
* @return the list of users/groups matching the given search condition
*/
<T extends Subject<?, ?, ?>> List<T> search(
- Set<Long> adminGroups, SearchCond searchCondition, List<OrderByClause> orderBy, SubjectType type);
+ Set<String> adminRealms, SearchCond searchCondition, List<OrderByClause> orderBy, SubjectType type);
/**
- * @param adminGroups the set of admin groups owned by the caller
+ * @param adminRealms realms for which the caller owns the proper entitlement(s)
* @param searchCondition the search condition
* @param page position of the first result, start from 1
* @param itemsPerPage number of results per page
@@ -67,7 +67,7 @@ public interface SubjectSearchDAO extends DAO<Subject<?, ?, ?>, Long> {
* @return the list of users/groups matching the given search condition (in the given page)
*/
<T extends Subject<?, ?, ?>> List<T> search(
- Set<Long> adminGroups, SearchCond searchCondition, int page, int itemsPerPage,
+ Set<String> adminRealms, SearchCond searchCondition, int page, int itemsPerPage,
List<OrderByClause> orderBy, SubjectType type);
/**
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java
----------------------------------------------------------------------
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 adc0a36..46388b3 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
@@ -49,11 +49,11 @@ public interface UserDAO extends SubjectDAO<UPlainAttr, UDerAttr, UVirAttr> {
List<User> findByResource(ExternalResource resource);
- List<User> findAll(Set<Long> adminGroups, int page, int itemsPerPage);
+ List<User> findAll(Set<String> adminRealms, int page, int itemsPerPage);
- List<User> findAll(Set<Long> adminGroups, int page, int itemsPerPage, List<OrderByClause> orderBy);
+ List<User> findAll(Set<String> adminRealms, int page, int itemsPerPage, List<OrderByClause> orderBy);
- int count(Set<Long> adminGroups);
+ int count(Set<String> adminRealms);
User save(User user);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirSchemaDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirSchemaDAO.java
index 149ef97..160f109 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirSchemaDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirSchemaDAO.java
@@ -19,7 +19,7 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
@@ -33,5 +33,5 @@ public interface VirSchemaDAO extends DAO<VirSchema, String> {
<T extends VirSchema> T save(T virSchema);
- void delete(String key, AttributableUtil attributableUtil);
+ void delete(String key, AttributableUtils attributableUtil);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtil.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtil.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtil.java
deleted file mode 100644
index eb46fd0..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtil.java
+++ /dev/null
@@ -1,91 +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 org.apache.syncope.common.lib.to.AbstractAttributableTO;
-import org.apache.syncope.common.lib.to.AbstractSubjectTO;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-
-public interface AttributableUtil {
-
- AttributableType getType();
-
- <T extends Attributable<?, ?, ?>> Class<T> attributableClass();
-
- <T extends PlainSchema> Class<T> plainSchemaClass();
-
- <T extends PlainSchema> T newPlainSchema();
-
- <T extends PlainAttr> Class<T> plainAttrClass();
-
- <T extends PlainAttr> T newPlainAttr();
-
- <T extends PlainAttrValue> Class<T> plainAttrValueClass();
-
- <T extends PlainAttrValue> T newPlainAttrValue();
-
- <T extends AttrTemplate<PlainSchema>> Class<T> plainAttrTemplateClass();
-
- <T extends PlainAttrValue> Class<T> plainAttrUniqueValueClass();
-
- <T extends PlainAttrValue> T newPlainAttrUniqueValue();
-
- <T extends DerSchema> Class<T> derSchemaClass();
-
- <T extends DerSchema> T newDerSchema();
-
- <T extends DerAttr> Class<T> derAttrClass();
-
- <T extends DerAttr> T newDerAttr();
-
- <T extends AttrTemplate<DerSchema>> Class<T> derAttrTemplateClass();
-
- <T extends VirSchema> Class<T> virSchemaClass();
-
- <T extends VirSchema> T newVirSchema();
-
- <T extends VirAttr> Class<T> virAttrClass();
-
- <T extends VirAttr> T newVirAttr();
-
- <T extends AttrTemplate<VirSchema>> Class<T> virAttrTemplateClass();
-
- <T extends MappingItem> T getAccountIdItem(ExternalResource resource);
-
- String getAccountLink(ExternalResource resource);
-
- <T extends MappingItem> List<T> getMappingItems(ExternalResource resource, MappingPurpose purpose);
-
- <T extends MappingItem> List<T> getUidToMappingItems(ExternalResource resource, MappingPurpose purpose);
-
- IntMappingType plainIntMappingType();
-
- IntMappingType derIntMappingType();
-
- IntMappingType virIntMappingType();
-
- <T extends MappingItem> Class<T> mappingItemClass();
-
- <T extends AbstractAttributableTO> T newAttributableTO();
-
- <T extends AbstractSubjectTO> T newSubjectTO();
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtilFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtilFactory.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtilFactory.java
deleted file mode 100644
index 8eaf78e..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtilFactory.java
+++ /dev/null
@@ -1,33 +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.common.lib.types.AttributableType;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-
-public interface AttributableUtilFactory {
-
- AttributableUtil getInstance(AttributableType type);
-
- AttributableUtil getInstance(String attributableType);
-
- AttributableUtil getInstance(ObjectClass objectClass);
-
- AttributableUtil getInstance(Attributable<?, ?, ?> attributable);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtils.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtils.java
new file mode 100644
index 0000000..b36cd18
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtils.java
@@ -0,0 +1,91 @@
+/*
+ * 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 org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+
+public interface AttributableUtils {
+
+ AttributableType getType();
+
+ <T extends Attributable<?, ?, ?>> Class<T> attributableClass();
+
+ <T extends PlainSchema> Class<T> plainSchemaClass();
+
+ <T extends PlainSchema> T newPlainSchema();
+
+ <T extends PlainAttr> Class<T> plainAttrClass();
+
+ <T extends PlainAttr> T newPlainAttr();
+
+ <T extends PlainAttrValue> Class<T> plainAttrValueClass();
+
+ <T extends PlainAttrValue> T newPlainAttrValue();
+
+ <T extends AttrTemplate<PlainSchema>> Class<T> plainAttrTemplateClass();
+
+ <T extends PlainAttrValue> Class<T> plainAttrUniqueValueClass();
+
+ <T extends PlainAttrValue> T newPlainAttrUniqueValue();
+
+ <T extends DerSchema> Class<T> derSchemaClass();
+
+ <T extends DerSchema> T newDerSchema();
+
+ <T extends DerAttr> Class<T> derAttrClass();
+
+ <T extends DerAttr> T newDerAttr();
+
+ <T extends AttrTemplate<DerSchema>> Class<T> derAttrTemplateClass();
+
+ <T extends VirSchema> Class<T> virSchemaClass();
+
+ <T extends VirSchema> T newVirSchema();
+
+ <T extends VirAttr> Class<T> virAttrClass();
+
+ <T extends VirAttr> T newVirAttr();
+
+ <T extends AttrTemplate<VirSchema>> Class<T> virAttrTemplateClass();
+
+ <T extends MappingItem> T getAccountIdItem(ExternalResource resource);
+
+ String getAccountLink(ExternalResource resource);
+
+ <T extends MappingItem> List<T> getMappingItems(ExternalResource resource, MappingPurpose purpose);
+
+ <T extends MappingItem> List<T> getUidToMappingItems(ExternalResource resource, MappingPurpose purpose);
+
+ IntMappingType plainIntMappingType();
+
+ IntMappingType derIntMappingType();
+
+ IntMappingType virIntMappingType();
+
+ <T extends MappingItem> Class<T> mappingItemClass();
+
+ <T extends AbstractAttributableTO> T newAttributableTO();
+
+ <T extends AbstractSubjectTO> T newSubjectTO();
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtilsFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtilsFactory.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtilsFactory.java
new file mode 100644
index 0000000..4b5e363
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtilsFactory.java
@@ -0,0 +1,33 @@
+/*
+ * 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.common.lib.types.AttributableType;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+
+public interface AttributableUtilsFactory {
+
+ AttributableUtils getInstance(AttributableType type);
+
+ AttributableUtils getInstance(String attributableType);
+
+ AttributableUtils getInstance(ObjectClass objectClass);
+
+ AttributableUtils getInstance(Attributable<?, ?, ?> attributable);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Entitlement.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Entitlement.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Entitlement.java
deleted file mode 100644
index 7f0b451..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Entitlement.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;
-
-public interface Entitlement extends Entity<String> {
-
- String getDescription();
-
- void setKey(String key);
-
- void setDescription(String description);
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/EntityFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/EntityFactory.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/EntityFactory.java
index f827703..91a6a0f 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/EntityFactory.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/EntityFactory.java
@@ -22,7 +22,5 @@ public interface EntityFactory {
<KEY, T extends Entity<KEY>> T newEntity(Class<T> reference);
- <T extends Policy> T newPolicy(Class<T> reference, boolean global);
-
ConnPoolConf newConnPoolConf();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttr.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttr.java
index 11e33b5..8474778 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttr.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttr.java
@@ -22,7 +22,7 @@ import java.util.List;
public interface PlainAttr extends Attr<PlainSchema> {
- void addValue(String value, AttributableUtil attributableUtil);
+ void addValue(String value, AttributableUtils attributableUtil);
boolean removeValue(PlainAttrValue attrValue);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Role.java
----------------------------------------------------------------------
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 7753ee2..0705804 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
@@ -28,10 +28,6 @@ public interface Role extends Entity<Long> {
void setName(String name);
- String getCriteria();
-
- void setCriteria(String criteria);
-
Set<Entitlement> getEntitlements();
boolean addRealm(Realm realm);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Subject.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Subject.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Subject.java
index 78b898c..11f0c81 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Subject.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Subject.java
@@ -22,6 +22,10 @@ import java.util.Set;
public interface Subject<N extends PlainAttr, D extends DerAttr, V extends VirAttr> extends Attributable<N, D, V> {
+ Realm getRealm();
+
+ void setRealm(Realm realm);
+
boolean addResource(ExternalResource resource);
boolean removeResource(ExternalResource resource);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/Group.java
----------------------------------------------------------------------
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 3c9f5df..6de9a81 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
@@ -19,11 +19,7 @@
package org.apache.syncope.core.persistence.api.entity.group;
import java.util.List;
-import java.util.Set;
-import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Schema;
import org.apache.syncope.core.persistence.api.entity.Subject;
import org.apache.syncope.core.persistence.api.entity.user.User;
@@ -32,100 +28,18 @@ public interface Group extends Subject<GPlainAttr, GDerAttr, GVirAttr> {
String getName();
- Group getParent();
-
- boolean addEntitlement(Entitlement entitlement);
-
- boolean removeEntitlement(Entitlement entitlement);
-
- /**
- * Get all inherited attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- List<? extends GPlainAttr> findLastInheritedAncestorPlainAttrs();
-
- /**
- * Get all inherited derived attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- List<? extends GDerAttr> findLastInheritedAncestorDerAttrs();
-
- /**
- * Get all inherited virtual attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- List<? extends GVirAttr> findLastInheritedAncestorVirAttrs();
-
- /**
- * Get first valid account policy.
- *
- * @return parent account policy if isInheritAccountPolicy is 'true' and parent is not null, local account policy
- * otherwise.
- */
- AccountPolicy getAccountPolicy();
-
- <T extends AttrTemplate<K>, K extends Schema> List<T> findInheritedTemplates(Class<T> reference);
-
- <T extends AttrTemplate<K>, K extends Schema> T getAttrTemplate(
- Class<T> reference, String schemaName);
+ <T extends AttrTemplate<K>, K extends Schema> T getAttrTemplate(Class<T> reference, String schemaName);
<T extends AttrTemplate<K>, K extends Schema> List<K> getAttrTemplateSchemas(Class<T> reference);
<T extends AttrTemplate<K>, K extends Schema> List<T> getAttrTemplates(Class<T> reference);
- Set<? extends Entitlement> getEntitlements();
-
- /**
- * Get first valid password policy.
- *
- * @return parent password policy if isInheritPasswordPolicy is 'true' and parent is not null, local password policy
- * otherwise
- */
- PasswordPolicy getPasswordPolicy();
-
Group getGroupOwner();
User getUserOwner();
- boolean isInheritAccountPolicy();
-
- boolean isInheritPlainAttrs();
-
- boolean isInheritDerAttrs();
-
- boolean isInheritOwner();
-
- boolean isInheritPasswordPolicy();
-
- boolean isInheritTemplates();
-
- boolean isInheritVirAttrs();
-
- void setAccountPolicy(AccountPolicy accountPolicy);
-
- void setInheritAccountPolicy(boolean condition);
-
- void setInheritPlainAttrs(boolean inheritAttrs);
-
- void setInheritDerAttrs(boolean inheritDerAttrs);
-
- void setInheritOwner(boolean inheritOwner);
-
- void setInheritPasswordPolicy(boolean condition);
-
- void setInheritTemplates(boolean condition);
-
- void setInheritVirAttrs(boolean inheritVirAttrs);
-
void setName(String name);
- void setParent(Group parent);
-
- void setPasswordPolicy(PasswordPolicy passwordPolicy);
-
void setGroupOwner(Group groupOwner);
void setUserOwner(User userOwner);
@@ -134,12 +48,21 @@ public interface Group extends Subject<GPlainAttr, GDerAttr, GVirAttr> {
boolean addPlainAttr(GPlainAttr attr);
@Override
+ boolean removePlainAttr(GPlainAttr attr);
+
+ @Override
boolean addDerAttr(GDerAttr attr);
@Override
+ boolean removeDerAttr(GDerAttr derAttr);
+
+ @Override
boolean addVirAttr(GVirAttr attr);
@Override
+ boolean removeVirAttr(GVirAttr virAttr);
+
+ @Override
GPlainAttr getPlainAttr(String plainSchemaName);
@Override
@@ -157,12 +80,4 @@ public interface Group extends Subject<GPlainAttr, GDerAttr, GVirAttr> {
@Override
List<? extends GVirAttr> getVirAttrs();
- @Override
- boolean removePlainAttr(GPlainAttr attr);
-
- @Override
- boolean removeDerAttr(GDerAttr derAttr);
-
- @Override
- boolean removeVirAttr(GVirAttr virAttr);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/SyncTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/SyncTask.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/SyncTask.java
index 0d3b24c..600ef88 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/SyncTask.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/SyncTask.java
@@ -20,9 +20,12 @@ package org.apache.syncope.core.persistence.api.entity.task;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
public interface SyncTask extends ProvisioningTask {
+ Realm getDestinatioRealm();
+
GroupTO getGroupTemplate();
UserTO getUserTemplate();
@@ -34,4 +37,6 @@ public interface SyncTask extends ProvisioningTask {
void setGroupTemplate(GroupTO groupTemplate);
void setUserTemplate(UserTO userTemplate);
+
+ void setDestinationRealm(Realm destinationRealm);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtil.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtil.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtil.java
deleted file mode 100644
index 7abe76d..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtil.java
+++ /dev/null
@@ -1,36 +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.task;
-
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
-import org.apache.syncope.common.lib.types.TaskType;
-
-public interface TaskUtil {
-
- TaskType getType();
-
- <T extends Task> T newTask();
-
- <T extends AbstractTaskTO> T newTaskTO();
-
- <T extends Task> Class<T> taskClass();
-
- <T extends AbstractTaskTO> Class<T> taskTOClass();
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilFactory.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilFactory.java
deleted file mode 100644
index 6bc172d..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilFactory.java
+++ /dev/null
@@ -1,33 +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.task;
-
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
-import org.apache.syncope.common.lib.types.TaskType;
-
-public interface TaskUtilFactory {
-
- TaskUtil getInstance(TaskType type);
-
- TaskUtil getInstance(Task task);
-
- TaskUtil getInstance(Class<? extends AbstractTaskTO> taskClass);
-
- TaskUtil getInstance(AbstractTaskTO taskTO);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtils.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtils.java
new file mode 100644
index 0000000..2e00784
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtils.java
@@ -0,0 +1,36 @@
+/*
+ * 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.task;
+
+import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.types.TaskType;
+
+public interface TaskUtils {
+
+ TaskType getType();
+
+ <T extends Task> T newTask();
+
+ <T extends AbstractTaskTO> T newTaskTO();
+
+ <T extends Task> Class<T> taskClass();
+
+ <T extends AbstractTaskTO> Class<T> taskTOClass();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilsFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilsFactory.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilsFactory.java
new file mode 100644
index 0000000..6da4de9
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilsFactory.java
@@ -0,0 +1,33 @@
+/*
+ * 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.task;
+
+import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.types.TaskType;
+
+public interface TaskUtilsFactory {
+
+ TaskUtils getInstance(TaskType type);
+
+ TaskUtils getInstance(Task task);
+
+ TaskUtils getInstance(Class<? extends AbstractTaskTO> taskClass);
+
+ TaskUtils getInstance(AbstractTaskTO taskTO);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
index 5c3ec4d..303d756 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
@@ -23,12 +23,15 @@ import java.util.List;
import java.util.Set;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
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.Subject;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
import org.apache.syncope.core.persistence.api.entity.group.Group;
public interface User extends Subject<UPlainAttr, UDerAttr, UVirAttr> {
+ boolean addRole(Role role);
+
boolean addMembership(Membership membership);
boolean canDecodePassword();
@@ -47,6 +50,8 @@ public interface User extends Subject<UPlainAttr, UDerAttr, UVirAttr> {
Date getLastLoginDate();
+ List<? extends Role> getRoles();
+
Membership getMembership(Long groupKey);
List<? extends Membership> getMemberships();
@@ -81,6 +86,8 @@ public interface User extends Subject<UPlainAttr, UDerAttr, UVirAttr> {
void removeClearPassword();
+ boolean removeRole(Role role);
+
boolean removeMembership(Membership membership);
void removeToken();
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/pom.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/pom.xml b/core/persistence-jpa/pom.xml
index bd9ce25..26422f6 100644
--- a/core/persistence-jpa/pom.xml
+++ b/core/persistence-jpa/pom.xml
@@ -112,6 +112,11 @@ under the License.
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
index 0361773..49b573a 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
@@ -65,7 +65,8 @@ class ContentLoaderHandler extends DefaultHandler {
Map<String, Integer> colTypes = new HashMap<>();
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
- colTypes.put(rs.getMetaData().getColumnName(i).toUpperCase(),
+ colTypes.put(
+ rs.getMetaData().getColumnName(i).toUpperCase(),
rs.getMetaData().getColumnType(i));
}
return colTypes;
@@ -191,7 +192,6 @@ class ContentLoaderHandler extends DefaultHandler {
query.append(") VALUES (").append(values).append(')');
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
-
try {
jdbcTemplate.update(query.toString(), getParameters(qName, atts));
} catch (DataAccessException e) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractSubjectDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractSubjectDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractSubjectDAO.java
index 93c54e9..247da9e 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractSubjectDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractSubjectDAO.java
@@ -35,7 +35,11 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectDAO;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
+import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
+import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
+import org.apache.syncope.core.persistence.api.dao.search.SubjectCond;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
@@ -56,6 +60,15 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
@Autowired
protected DerSchemaDAO derSchemaDAO;
+ @Autowired
+ protected SubjectSearchDAO searchDAO;
+
+ protected SearchCond getAllMatchingCond() {
+ SubjectCond idCond = new SubjectCond(AttributeCond.Type.ISNOTNULL);
+ idCond.setSchema("id");
+ return SearchCond.getLeafCond(idCond);
+ }
+
/**
* Split an attribute value recurring on provided literals/tokens.
*
@@ -82,10 +95,10 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
*
* @param expression derived schema expression
* @param value derived attribute value
- * @param attrUtil USER / GROUP
+ * @param attrUtils USER / GROUP
* @return where clauses to use to build the query
*/
- private Set<String> getWhereClause(final String expression, final String value, final AttributableUtil attrUtil) {
+ private Set<String> getWhereClause(final String expression, final String value, final AttributableUtils attrUtils) {
final Parser parser = new Parser(new StringReader(expression));
// Schema names
@@ -149,7 +162,7 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
if (!used.contains(identifiers.get(i))) {
// verify schema existence and get schema type
- PlainSchema schema = plainSchemaDAO.find(identifiers.get(i), attrUtil.plainSchemaClass());
+ PlainSchema schema = plainSchemaDAO.find(identifiers.get(i), attrUtils.plainSchemaClass());
if (schema == null) {
LOG.error("Invalid schema name '{}'", identifiers.get(i));
throw new IllegalArgumentException("Invalid schema name " + identifiers.get(i));
@@ -217,17 +230,17 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
@Override
@SuppressWarnings("unchecked")
public List<? extends Subject<P, D, V>> findByAttrValue(
- final String schemaName, final PlainAttrValue attrValue, final AttributableUtil attrUtil) {
+ final String schemaName, final PlainAttrValue attrValue, final AttributableUtils attrUtils) {
- PlainSchema schema = plainSchemaDAO.find(schemaName, attrUtil.plainSchemaClass());
+ PlainSchema schema = plainSchemaDAO.find(schemaName, attrUtils.plainSchemaClass());
if (schema == null) {
LOG.error("Invalid schema name '{}'", schemaName);
return Collections.<Subject<P, D, V>>emptyList();
}
final String entityName = schema.isUniqueConstraint()
- ? attrUtil.plainAttrUniqueValueClass().getName()
- : attrUtil.plainAttrValueClass().getName();
+ ? attrUtils.plainAttrUniqueValueClass().getName()
+ : attrUtils.plainAttrValueClass().getName();
Query query = findByAttrValueQuery(entityName);
@@ -257,9 +270,9 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
@Override
public Subject<P, D, V> findByAttrUniqueValue(
- final String schemaName, final PlainAttrValue attrUniqueValue, final AttributableUtil attrUtil) {
+ final String schemaName, final PlainAttrValue attrUniqueValue, final AttributableUtils attrUtils) {
- PlainSchema schema = plainSchemaDAO.find(schemaName, attrUtil.plainSchemaClass());
+ PlainSchema schema = plainSchemaDAO.find(schemaName, attrUtils.plainSchemaClass());
if (schema == null) {
LOG.error("Invalid schema name '{}'", schemaName);
return null;
@@ -269,7 +282,7 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
return null;
}
- List<? extends Subject<P, D, V>> result = findByAttrValue(schemaName, attrUniqueValue, attrUtil);
+ List<? extends Subject<P, D, V>> result = findByAttrValue(schemaName, attrUniqueValue, attrUtils);
return result.isEmpty()
? null
: result.iterator().next();
@@ -283,14 +296,14 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
*
* @param schemaName derived schema name
* @param value derived attribute value
- * @param attrUtil AttributableUtil
+ * @param attrUtils AttributableUtil
* @return list of users / groups
*/
@Override
public List<? extends Subject<P, D, V>> findByDerAttrValue(
- final String schemaName, final String value, final AttributableUtil attrUtil) {
+ final String schemaName, final String value, final AttributableUtils attrUtils) {
- DerSchema schema = derSchemaDAO.find(schemaName, attrUtil.derSchemaClass());
+ DerSchema schema = derSchemaDAO.find(schemaName, attrUtils.derSchemaClass());
if (schema == null) {
LOG.error("Invalid schema name '{}'", schemaName);
return Collections.<Subject<P, D, V>>emptyList();
@@ -300,16 +313,16 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
final StringBuilder querystring = new StringBuilder();
boolean subquery = false;
- for (String clause : getWhereClause(schema.getExpression(), value, attrUtil)) {
+ for (String clause : getWhereClause(schema.getExpression(), value, attrUtils)) {
if (querystring.length() > 0) {
subquery = true;
querystring.append(" AND a.owner_id IN ( ");
}
querystring.append("SELECT a.owner_id ").
- append("FROM ").append(attrUtil.plainAttrClass().getSimpleName().substring(3)).append(" a, ").
- append(attrUtil.plainAttrValueClass().getSimpleName().substring(3)).append(" v, ").
- append(attrUtil.plainSchemaClass().getSimpleName().substring(3)).append(" s ").
+ append("FROM ").append(attrUtils.plainAttrClass().getSimpleName().substring(3)).append(" a, ").
+ append(attrUtils.plainAttrValueClass().getSimpleName().substring(3)).append(" v, ").
+ append(attrUtils.plainSchemaClass().getSimpleName().substring(3)).append(" s ").
append("WHERE ").append(clause);
if (subquery) {
@@ -335,10 +348,10 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
@Override
@SuppressWarnings("unchecked")
public List<? extends Subject<P, D, V>> findByResource(
- final ExternalResource resource, final AttributableUtil attrUtil) {
+ final ExternalResource resource, final AttributableUtils attrUtils) {
Query query = entityManager.createQuery(
- "SELECT e FROM " + attrUtil.attributableClass().getSimpleName() + " e "
+ "SELECT e FROM " + attrUtils.attributableClass().getSimpleName() + " e "
+ "WHERE :resource MEMBER OF e.resources");
query.setParameter("resource", resource);
[13/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
index f7a1e55..2da7ef5 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
@@ -32,13 +32,13 @@ import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
import org.apache.syncope.core.persistence.api.entity.user.UMappingItem;
import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
import org.apache.syncope.core.persistence.api.entity.user.UVirSchema;
import org.apache.syncope.core.persistence.jpa.entity.AbstractVirSchema;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirSchema;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirSchema;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@@ -56,8 +56,8 @@ public class JPAVirSchemaDAO extends AbstractDAO<VirSchema, String> implements V
private ExternalResourceDAO resourceDAO;
private <T extends VirSchema> Class<? extends AbstractVirSchema> getJPAEntityReference(final Class<T> reference) {
- return RVirSchema.class.isAssignableFrom(reference)
- ? JPARVirSchema.class
+ return GVirSchema.class.isAssignableFrom(reference)
+ ? JPAGVirSchema.class
: MVirSchema.class.isAssignableFrom(reference)
? JPAMVirSchema.class
: UVirSchema.class.isAssignableFrom(reference)
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
----------------------------------------------------------------------
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 6922b85..77d133b 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
@@ -94,8 +94,8 @@ class SearchSupport {
result = "user_search";
break;
- case ROLE:
- result = "role_search";
+ case GROUP:
+ result = "group_search";
break;
}
@@ -118,8 +118,8 @@ class SearchSupport {
return new SearchView("svr", field().name + "_resource");
}
- public SearchView roleResource() {
- return new SearchView("svrr", field().name + "_role_resource");
+ public SearchView groupResource() {
+ return new SearchView("svrr", field().name + "_group_resource");
}
public SearchView uniqueAttr() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
index 3a85859..814909d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
@@ -58,7 +58,7 @@ public abstract class AbstractMapping<T extends MappingItem> extends AbstractEnt
protected boolean addAccountIdItem(final T accountIdItem) {
if (IntMappingType.UserVirtualSchema == accountIdItem.getIntMappingType()
- || IntMappingType.RoleVirtualSchema == accountIdItem.getIntMappingType()
+ || IntMappingType.GroupVirtualSchema == accountIdItem.getIntMappingType()
|| IntMappingType.MembershipVirtualSchema == accountIdItem.getIntMappingType()
|| IntMappingType.Password == accountIdItem.getIntMappingType()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMappingItem.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMappingItem.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMappingItem.java
index c183908..98aab13 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMappingItem.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMappingItem.java
@@ -115,7 +115,7 @@ public abstract class AbstractMappingItem extends AbstractEntity<Long> implement
switch (getIntMappingType()) {
case UserId:
- case RoleId:
+ case GroupId:
case MembershipId:
name = "id";
break;
@@ -128,12 +128,12 @@ public abstract class AbstractMappingItem extends AbstractEntity<Long> implement
name = "password";
break;
- case RoleName:
- name = "roleName";
+ case GroupName:
+ name = "groupName";
break;
- case RoleOwnerSchema:
- name = "roleOwnerSchema";
+ case GroupOwnerSchema:
+ name = "groupOwnerSchema";
break;
default:
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
index 3b744c6..0ccf030 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
@@ -25,7 +25,7 @@ import org.apache.syncope.common.lib.to.AbstractAttributableTO;
import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.ConfTO;
import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.IntMappingType;
@@ -59,19 +59,19 @@ import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttr;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerSchema;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMappingItem;
@@ -110,8 +110,8 @@ public class JPAAttributableUtil implements AttributableUtil {
Class result;
switch (type) {
- case ROLE:
- result = JPARole.class;
+ case GROUP:
+ result = JPAGroup.class;
break;
case MEMBERSHIP:
@@ -135,8 +135,8 @@ public class JPAAttributableUtil implements AttributableUtil {
Class result;
switch (type) {
- case ROLE:
- result = JPARPlainSchema.class;
+ case GROUP:
+ result = JPAGPlainSchema.class;
break;
case MEMBERSHIP:
@@ -165,8 +165,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = (T) new JPAUPlainSchema();
break;
- case ROLE:
- result = (T) new JPARPlainSchema();
+ case GROUP:
+ result = (T) new JPAGPlainSchema();
break;
case MEMBERSHIP:
@@ -186,8 +186,8 @@ public class JPAAttributableUtil implements AttributableUtil {
Class result = null;
switch (type) {
- case ROLE:
- result = JPARPlainAttr.class;
+ case GROUP:
+ result = JPAGPlainAttr.class;
break;
case MEMBERSHIP:
@@ -216,8 +216,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = (T) new JPAUPlainAttr();
break;
- case ROLE:
- result = (T) new JPARPlainAttr();
+ case GROUP:
+ result = (T) new JPAGPlainAttr();
break;
case MEMBERSHIP:
@@ -238,8 +238,8 @@ public class JPAAttributableUtil implements AttributableUtil {
Class result;
switch (type) {
- case ROLE:
- result = JPARPlainAttrValue.class;
+ case GROUP:
+ result = JPAGPlainAttrValue.class;
break;
case MEMBERSHIP:
@@ -268,8 +268,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = (T) new JPAUPlainAttrValue();
break;
- case ROLE:
- result = (T) new JPARPlainAttrValue();
+ case GROUP:
+ result = (T) new JPAGPlainAttrValue();
break;
case MEMBERSHIP:
@@ -291,8 +291,8 @@ public class JPAAttributableUtil implements AttributableUtil {
Class result;
switch (type) {
- case ROLE:
- result = JPARPlainAttrUniqueValue.class;
+ case GROUP:
+ result = JPAGPlainAttrUniqueValue.class;
break;
case MEMBERSHIP:
@@ -321,8 +321,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = (T) new JPAUPlainAttrUniqueValue();
break;
- case ROLE:
- result = (T) new JPARPlainAttrUniqueValue();
+ case GROUP:
+ result = (T) new JPAGPlainAttrUniqueValue();
break;
case MEMBERSHIP:
@@ -344,8 +344,8 @@ public class JPAAttributableUtil implements AttributableUtil {
Class result;
switch (type) {
- case ROLE:
- result = JPARPlainAttrTemplate.class;
+ case GROUP:
+ result = JPAGPlainAttrTemplate.class;
break;
case MEMBERSHIP:
@@ -370,8 +370,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = JPAUDerSchema.class;
break;
- case ROLE:
- result = JPARDerSchema.class;
+ case GROUP:
+ result = JPAGDerSchema.class;
break;
case MEMBERSHIP:
@@ -395,8 +395,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = (T) new JPAUDerSchema();
break;
- case ROLE:
- result = (T) new JPARDerSchema();
+ case GROUP:
+ result = (T) new JPAGDerSchema();
break;
case MEMBERSHIP:
@@ -419,8 +419,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = JPAUDerAttr.class;
break;
- case ROLE:
- result = JPARDerAttr.class;
+ case GROUP:
+ result = JPAGDerAttr.class;
break;
case MEMBERSHIP:
@@ -443,8 +443,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = (T) new JPAUDerAttr();
break;
- case ROLE:
- result = (T) new JPARDerAttr();
+ case GROUP:
+ result = (T) new JPAGDerAttr();
break;
case MEMBERSHIP:
@@ -466,8 +466,8 @@ public class JPAAttributableUtil implements AttributableUtil {
case USER:
break;
- case ROLE:
- result = JPARDerAttrTemplate.class;
+ case GROUP:
+ result = JPAGDerAttrTemplate.class;
break;
case MEMBERSHIP:
@@ -490,8 +490,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = JPAUVirSchema.class;
break;
- case ROLE:
- result = JPARVirSchema.class;
+ case GROUP:
+ result = JPAGVirSchema.class;
break;
case MEMBERSHIP:
@@ -514,8 +514,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = (T) new JPAUVirSchema();
break;
- case ROLE:
- result = (T) new JPARVirSchema();
+ case GROUP:
+ result = (T) new JPAGVirSchema();
break;
case MEMBERSHIP:
@@ -538,8 +538,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = JPAUVirAttr.class;
break;
- case ROLE:
- result = JPARVirAttr.class;
+ case GROUP:
+ result = JPAGVirAttr.class;
break;
case MEMBERSHIP:
@@ -562,8 +562,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = (T) new JPAUVirAttr();
break;
- case ROLE:
- result = (T) new JPARVirAttr();
+ case GROUP:
+ result = (T) new JPAGVirAttr();
break;
case MEMBERSHIP:
@@ -585,8 +585,8 @@ public class JPAAttributableUtil implements AttributableUtil {
case USER:
break;
- case ROLE:
- result = JPARVirAttrTemplate.class;
+ case GROUP:
+ result = JPAGVirAttrTemplate.class;
break;
case MEMBERSHIP:
@@ -606,9 +606,9 @@ public class JPAAttributableUtil implements AttributableUtil {
if (resource != null) {
switch (type) {
- case ROLE:
- if (resource.getRmapping() != null) {
- result = (T) resource.getRmapping().getAccountIdItem();
+ case GROUP:
+ if (resource.getGmapping() != null) {
+ result = (T) resource.getGmapping().getAccountIdItem();
}
break;
@@ -638,9 +638,9 @@ public class JPAAttributableUtil implements AttributableUtil {
}
break;
- case ROLE:
- if (resource.getRmapping() != null) {
- result = resource.getRmapping().getAccountLink();
+ case GROUP:
+ if (resource.getGmapping() != null) {
+ result = resource.getGmapping().getAccountLink();
}
break;
@@ -661,9 +661,9 @@ public class JPAAttributableUtil implements AttributableUtil {
if (resource != null) {
switch (type) {
- case ROLE:
- if (resource.getRmapping() != null) {
- items = (List<T>) resource.getRmapping().getItems();
+ case GROUP:
+ if (resource.getGmapping() != null) {
+ items = (List<T>) resource.getGmapping().getItems();
}
break;
@@ -729,7 +729,7 @@ public class JPAAttributableUtil implements AttributableUtil {
List<T> items = getMappingItems(resource, purpose);
- MappingItem uidItem = type == AttributableType.USER ? new JPAUMappingItem() : new JPARMappingItem();
+ MappingItem uidItem = type == AttributableType.USER ? new JPAUMappingItem() : new JPAGMappingItem();
BeanUtils.copyProperties(getAccountIdItem(resource), uidItem);
uidItem.setExtAttrName(Uid.NAME);
uidItem.setAccountid(false);
@@ -743,8 +743,8 @@ public class JPAAttributableUtil implements AttributableUtil {
IntMappingType result = null;
switch (type) {
- case ROLE:
- result = IntMappingType.RolePlainSchema;
+ case GROUP:
+ result = IntMappingType.GroupPlainSchema;
break;
case MEMBERSHIP:
@@ -767,8 +767,8 @@ public class JPAAttributableUtil implements AttributableUtil {
IntMappingType result = null;
switch (type) {
- case ROLE:
- result = IntMappingType.RoleDerivedSchema;
+ case GROUP:
+ result = IntMappingType.GroupDerivedSchema;
break;
case MEMBERSHIP:
@@ -791,8 +791,8 @@ public class JPAAttributableUtil implements AttributableUtil {
IntMappingType result = null;
switch (type) {
- case ROLE:
- result = IntMappingType.RoleVirtualSchema;
+ case GROUP:
+ result = IntMappingType.GroupVirtualSchema;
break;
case MEMBERSHIP:
@@ -819,8 +819,8 @@ public class JPAAttributableUtil implements AttributableUtil {
result = JPAUMappingItem.class;
break;
- case ROLE:
- result = JPARMappingItem.class;
+ case GROUP:
+ result = JPAGMappingItem.class;
break;
case MEMBERSHIP:
@@ -842,8 +842,8 @@ public class JPAAttributableUtil implements AttributableUtil {
case USER:
result = (T) new UserTO();
break;
- case ROLE:
- result = (T) new RoleTO();
+ case GROUP:
+ result = (T) new GroupTO();
break;
case MEMBERSHIP:
result = (T) new MembershipTO();
@@ -865,8 +865,8 @@ public class JPAAttributableUtil implements AttributableUtil {
case USER:
result = (T) new UserTO();
break;
- case ROLE:
- result = (T) new RoleTO();
+ case GROUP:
+ result = (T) new GroupTO();
break;
case MEMBERSHIP:
case CONFIGURATION:
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
index 202a605..7cb012a 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -51,20 +51,20 @@ import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RMapping;
-import org.apache.syncope.core.persistence.api.entity.role.RMappingItem;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GMapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMappingItem;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.persistence.api.entity.task.PushTask;
@@ -100,20 +100,20 @@ import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttr;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMapping;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
import org.apache.syncope.core.persistence.jpa.entity.task.JPANotificationTask;
import org.apache.syncope.core.persistence.jpa.entity.task.JPAPropagationTask;
import org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTask;
@@ -143,8 +143,8 @@ public class JPAEntityFactory implements EntityFactory {
if (reference.equals(User.class)) {
result = (T) new JPAUser();
- } else if (reference.equals(Role.class)) {
- result = (T) new JPARole();
+ } else if (reference.equals(Group.class)) {
+ result = (T) new JPAGroup();
} else if (reference.equals(Membership.class)) {
result = (T) new JPAMembership();
} else if (reference.equals(Conf.class)) {
@@ -177,32 +177,32 @@ public class JPAEntityFactory implements EntityFactory {
result = (T) new JPAUMapping();
} else if (reference.equals(UMappingItem.class)) {
result = (T) new JPAUMappingItem();
- } else if (reference.equals(RPlainSchema.class)) {
- result = (T) new JPARPlainSchema();
- } else if (reference.equals(RPlainAttr.class)) {
- result = (T) new JPARPlainAttr();
- } else if (reference.equals(RPlainAttrValue.class)) {
- result = (T) new JPARPlainAttrValue();
- } else if (reference.equals(RPlainAttrUniqueValue.class)) {
- result = (T) new JPARPlainAttrUniqueValue();
- } else if (reference.equals(RPlainAttrTemplate.class)) {
- result = (T) new JPARPlainAttrTemplate();
- } else if (reference.equals(RDerAttrTemplate.class)) {
- result = (T) new JPARDerAttrTemplate();
- } else if (reference.equals(RVirAttrTemplate.class)) {
- result = (T) new JPARVirAttrTemplate();
- } else if (reference.equals(RDerSchema.class)) {
- result = (T) new JPARDerSchema();
- } else if (reference.equals(RDerAttr.class)) {
- result = (T) new JPARDerAttr();
- } else if (reference.equals(RVirSchema.class)) {
- result = (T) new JPARVirSchema();
- } else if (reference.equals(RVirAttr.class)) {
- result = (T) new JPARVirAttr();
- } else if (reference.equals(RMapping.class)) {
- result = (T) new JPARMapping();
- } else if (reference.equals(RMappingItem.class)) {
- result = (T) new JPARMappingItem();
+ } else if (reference.equals(GPlainSchema.class)) {
+ result = (T) new JPAGPlainSchema();
+ } else if (reference.equals(GPlainAttr.class)) {
+ result = (T) new JPAGPlainAttr();
+ } else if (reference.equals(GPlainAttrValue.class)) {
+ result = (T) new JPAGPlainAttrValue();
+ } else if (reference.equals(GPlainAttrUniqueValue.class)) {
+ result = (T) new JPAGPlainAttrUniqueValue();
+ } else if (reference.equals(GPlainAttrTemplate.class)) {
+ result = (T) new JPAGPlainAttrTemplate();
+ } else if (reference.equals(GDerAttrTemplate.class)) {
+ result = (T) new JPAGDerAttrTemplate();
+ } else if (reference.equals(GVirAttrTemplate.class)) {
+ result = (T) new JPAGVirAttrTemplate();
+ } else if (reference.equals(GDerSchema.class)) {
+ result = (T) new JPAGDerSchema();
+ } else if (reference.equals(GDerAttr.class)) {
+ result = (T) new JPAGDerAttr();
+ } else if (reference.equals(GVirSchema.class)) {
+ result = (T) new JPAGVirSchema();
+ } else if (reference.equals(GVirAttr.class)) {
+ result = (T) new JPAGVirAttr();
+ } else if (reference.equals(GMapping.class)) {
+ result = (T) new JPAGMapping();
+ } else if (reference.equals(GMappingItem.class)) {
+ result = (T) new JPAGMappingItem();
} else if (reference.equals(MPlainSchema.class)) {
result = (T) new JPAMPlainSchema();
} else if (reference.equals(MPlainAttr.class)) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
index 49be3dc..e1c44aa 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
@@ -51,10 +51,10 @@ import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
-import org.apache.syncope.core.persistence.api.entity.role.RMapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMapping;
import org.apache.syncope.core.persistence.api.entity.user.UMapping;
import org.apache.syncope.core.persistence.jpa.validation.entity.ExternalResourceCheck;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMapping;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMapping;
import org.apache.syncope.core.misc.serialization.POJOHelper;
import org.identityconnectors.framework.common.objects.SyncToken;
@@ -100,10 +100,10 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
private JPAUMapping umapping;
/**
- * Mapping for role objects.
+ * Mapping for group objects.
*/
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "resource")
- private JPARMapping rmapping;
+ private JPAGMapping rmapping;
/**
* Is this resource primary, for propagations?
@@ -171,7 +171,7 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
private String userializedSyncToken;
/**
- * SyncToken for calling ConnId's sync() on roles.
+ * SyncToken for calling ConnId's sync() on groups.
*/
@Lob
private String rserializedSyncToken;
@@ -237,14 +237,14 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
}
@Override
- public RMapping getRmapping() {
+ public GMapping getGmapping() {
return rmapping;
}
@Override
- public void setRmapping(final RMapping rmapping) {
- checkType(rmapping, JPARMapping.class);
- this.rmapping = (JPARMapping) rmapping;
+ public void setGmapping(final GMapping gmapping) {
+ checkType(gmapping, JPAGMapping.class);
+ this.rmapping = (JPAGMapping) gmapping;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
index de591e2..b97ca54 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
@@ -61,7 +61,7 @@ public class JPANotification extends AbstractEntity<Long> implements Notificatio
private String userAbout;
- private String roleAbout;
+ private String groupAbout;
private String recipients;
@@ -128,13 +128,13 @@ public class JPANotification extends AbstractEntity<Long> implements Notificatio
}
@Override
- public String getRoleAbout() {
- return roleAbout;
+ public String getGroupAbout() {
+ return groupAbout;
}
@Override
- public void setRoleAbout(final String roleAbout) {
- this.roleAbout = roleAbout;
+ public void setGroupAbout(final String groupAbout) {
+ this.groupAbout = groupAbout;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
index 427e828..8eaf54e 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
@@ -24,7 +24,7 @@ import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
import org.apache.syncope.core.persistence.api.entity.conf.Conf;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.identityconnectors.framework.common.objects.ObjectClass;
import org.springframework.stereotype.Component;
@@ -49,7 +49,7 @@ public class JPAttributableUtilFactory implements AttributableUtilFactory {
type = AttributableType.USER;
}
if (ObjectClass.GROUP.equals(objectClass)) {
- type = AttributableType.ROLE;
+ type = AttributableType.GROUP;
}
if (type == null) {
@@ -65,8 +65,8 @@ public class JPAttributableUtilFactory implements AttributableUtilFactory {
if (attributable instanceof User) {
type = AttributableType.USER;
}
- if (attributable instanceof Role) {
- type = AttributableType.ROLE;
+ if (attributable instanceof Group) {
+ type = AttributableType.GROUP;
}
if (attributable instanceof Membership) {
type = AttributableType.MEMBERSHIP;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java
new file mode 100644
index 0000000..7a160cf
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java
@@ -0,0 +1,82 @@
+/*
+ * 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.group;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.Attributable;
+import org.apache.syncope.core.persistence.api.entity.DerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttr;
+
+@Entity
+@Table(name = JPAGDerAttr.TABLE)
+public class JPAGDerAttr extends AbstractDerAttr implements GDerAttr {
+
+ private static final long serialVersionUID = 8007080005675899946L;
+
+ public static final String TABLE = "GDerAttr";
+
+ @ManyToOne
+ private JPAGroup owner;
+
+ @Column(nullable = false)
+ @OneToOne(cascade = CascadeType.MERGE)
+ private JPAGDerAttrTemplate template;
+
+ @Override
+ public Group getOwner() {
+ return owner;
+ }
+
+ @Override
+ public void setOwner(final Attributable<?, ?, ?> owner) {
+ checkType(owner, JPAGroup.class);
+ this.owner = (JPAGroup) owner;
+ }
+
+ @Override
+ public GDerAttrTemplate getTemplate() {
+ return template;
+ }
+
+ @Override
+ public void setTemplate(final GDerAttrTemplate template) {
+ checkType(template, JPAGDerAttrTemplate.class);
+ this.template = (JPAGDerAttrTemplate) template;
+ }
+
+ @Override
+ public GDerSchema getSchema() {
+ return template == null ? null : template.getSchema();
+ }
+
+ @Override
+ public void setSchema(final DerSchema schema) {
+ LOG.warn("This is group attribute, set template to select schema");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java
new file mode 100644
index 0000000..427d91b
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java
@@ -0,0 +1,66 @@
+/*
+ * 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.group;
+
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttrTemplate;
+
+@Entity
+@Table(name = JPAGDerAttrTemplate.TABLE)
+public class JPAGDerAttrTemplate extends AbstractDerAttrTemplate<GDerSchema> implements GDerAttrTemplate {
+
+ private static final long serialVersionUID = 624868884107016649L;
+
+ public static final String TABLE = "GDerAttrTemplate";
+
+ @ManyToOne
+ private JPAGroup owner;
+
+ @ManyToOne
+ @JoinColumn(name = "schema_name")
+ private JPAGDerSchema schema;
+
+ @Override
+ public GDerSchema getSchema() {
+ return schema;
+ }
+
+ @Override
+ public void setSchema(final GDerSchema schema) {
+ checkType(schema, JPAGDerSchema.class);
+ this.schema = (JPAGDerSchema) schema;
+ }
+
+ @Override
+ public Group getOwner() {
+ return owner;
+ }
+
+ @Override
+ public void setOwner(final Group owner) {
+ checkType(owner, JPAGroup.class);
+ this.owner = (JPAGroup) owner;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerSchema.java
new file mode 100644
index 0000000..b0a41ac
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerSchema.java
@@ -0,0 +1,34 @@
+/*
+ * 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.group;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractDerSchema;
+
+@Entity
+@Table(name = JPAGDerSchema.TABLE)
+public class JPAGDerSchema extends AbstractDerSchema implements GDerSchema {
+
+ private static final long serialVersionUID = -6868889736207576372L;
+
+ public static final String TABLE = "GDerSchema";
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java
new file mode 100644
index 0000000..dd2679d
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java
@@ -0,0 +1,103 @@
+/*
+ * 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.group;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.group.GMapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractMapping;
+import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
+
+@Entity
+@Table(name = JPAGMapping.TABLE)
+public class JPAGMapping extends AbstractMapping<GMappingItem> implements GMapping {
+
+ public static final String TABLE = "GMapping";
+
+ private static final long serialVersionUID = 4578756002867863392L;
+
+ @Id
+ private Long id;
+
+ /**
+ * Resource owning this mapping.
+ */
+ @OneToOne
+ private JPAExternalResource resource;
+
+ /**
+ * Attribute mappings.
+ */
+ @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "mapping")
+ private List<JPAGMappingItem> items;
+
+ public JPAGMapping() {
+ super();
+
+ items = new ArrayList<>();
+ }
+
+ @Override
+ public Long getKey() {
+ return id;
+ }
+
+ @Override
+ public ExternalResource getResource() {
+ return resource;
+ }
+
+ @Override
+ public void setResource(final ExternalResource resource) {
+ checkType(resource, JPAExternalResource.class);
+ this.resource = (JPAExternalResource) resource;
+ }
+
+ @Override
+ public void setAccountIdItem(final GMappingItem item) {
+ checkType(item, JPAGMappingItem.class);
+ this.addAccountIdItem((JPAGMappingItem) item);
+ }
+
+ @Override
+ public List<? extends GMappingItem> getItems() {
+ return items;
+ }
+
+ @Override
+ public boolean addItem(final GMappingItem item) {
+ checkType(item, JPAGMappingItem.class);
+ return items.contains((JPAGMappingItem) item) || items.add((JPAGMappingItem) item);
+ }
+
+ @Override
+ public boolean removeItem(final GMappingItem item) {
+ checkType(item, JPAGMappingItem.class);
+ return items.remove((JPAGMappingItem) item);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java
new file mode 100644
index 0000000..2e3dd8e
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java
@@ -0,0 +1,58 @@
+/*
+ * 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.group;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.Mapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractMappingItem;
+
+@Entity
+@Table(name = JPAGMappingItem.TABLE)
+public class JPAGMappingItem extends AbstractMappingItem implements GMappingItem {
+
+ public static final String TABLE = "GMappingItem";
+
+ private static final long serialVersionUID = -2670787666933476166L;
+
+ @Id
+ private Long id;
+
+ @ManyToOne
+ private JPAGMapping mapping;
+
+ @Override
+ public Long getKey() {
+ return id;
+ }
+
+ @Override
+ public Mapping<GMappingItem> getMapping() {
+ return mapping;
+ }
+
+ @Override
+ public void setMapping(final Mapping<?> mapping) {
+ checkType(mapping, JPAGMapping.class);
+ this.mapping = (JPAGMapping) mapping;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java
new file mode 100644
index 0000000..e4f8f06
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java
@@ -0,0 +1,140 @@
+/*
+ * 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.group;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.validation.Valid;
+import org.apache.syncope.core.persistence.api.entity.Attributable;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttr;
+
+@Entity
+@Table(name = JPAGPlainAttr.TABLE)
+public class JPAGPlainAttr extends AbstractPlainAttr implements GPlainAttr {
+
+ private static final long serialVersionUID = 2848159565890995780L;
+
+ public static final String TABLE = "GPlainAttr";
+
+ @Id
+ private Long id;
+
+ @ManyToOne(fetch = FetchType.EAGER)
+ private JPAGroup owner;
+
+ @Column(nullable = false)
+ @OneToOne(cascade = CascadeType.MERGE)
+ private JPAGPlainAttrTemplate template;
+
+ @OneToMany(cascade = CascadeType.MERGE, orphanRemoval = true, mappedBy = "attribute")
+ @Valid
+ private List<JPAGPlainAttrValue> values;
+
+ @OneToOne(cascade = CascadeType.ALL, mappedBy = "attribute")
+ @Valid
+ private JPAGPlainAttrUniqueValue uniqueValue;
+
+ public JPAGPlainAttr() {
+ super();
+ values = new ArrayList<>();
+ }
+
+ @Override
+ public Long getKey() {
+ return id;
+ }
+
+ @Override
+ public Group getOwner() {
+ return owner;
+ }
+
+ @Override
+ public void setOwner(final Attributable<?, ?, ?> owner) {
+ checkType(owner, JPAGroup.class);
+ this.owner = (JPAGroup) owner;
+ }
+
+ @Override
+ public GPlainAttrTemplate getTemplate() {
+ return template;
+ }
+
+ @Override
+ public void setTemplate(final GPlainAttrTemplate template) {
+ checkType(template, JPAGPlainAttrTemplate.class);
+ this.template = (JPAGPlainAttrTemplate) template;
+ }
+
+ @Override
+ public GPlainSchema getSchema() {
+ return template == null ? null : template.getSchema();
+ }
+
+ @Override
+ public void setSchema(final PlainSchema schema) {
+ LOG.warn("This is group attribute, set template to select schema");
+ }
+
+ @Override
+ protected boolean addValue(final PlainAttrValue attrValue) {
+ checkType(attrValue, JPAGPlainAttrValue.class);
+ return values.add((JPAGPlainAttrValue) attrValue);
+ }
+
+ @Override
+ public boolean removeValue(final PlainAttrValue attrValue) {
+ checkType(attrValue, JPAGPlainAttrValue.class);
+ return values.remove((JPAGPlainAttrValue) attrValue);
+ }
+
+ @Override
+ public List<? extends GPlainAttrValue> getValues() {
+ return values;
+ }
+
+ @Override
+ public GPlainAttrUniqueValue getUniqueValue() {
+ return uniqueValue;
+ }
+
+ @Override
+ public void setUniqueValue(final PlainAttrUniqueValue uniqueValue) {
+ checkType(owner, JPAGPlainAttrUniqueValue.class);
+ this.uniqueValue = (JPAGPlainAttrUniqueValue) uniqueValue;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.java
new file mode 100644
index 0000000..2af988e
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.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.core.persistence.jpa.entity.group;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrTemplate;
+
+@Entity
+@Table(name = JPAGPlainAttrTemplate.TABLE)
+public class JPAGPlainAttrTemplate extends AbstractPlainAttrTemplate<GPlainSchema> implements GPlainAttrTemplate {
+
+ private static final long serialVersionUID = 6943917051517266268L;
+
+ public static final String TABLE = "GPlainAttrTemplate";
+
+ @Id
+ private Long id;
+
+ @ManyToOne
+ private JPAGroup owner;
+
+ @Override
+ public Long getKey() {
+ return id;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "schema_name")
+ private JPAGPlainSchema schema;
+
+ @Override
+ public GPlainSchema getSchema() {
+ return schema;
+ }
+
+ @Override
+ public void setSchema(final GPlainSchema schema) {
+ checkType(schema, JPAGPlainSchema.class);
+ this.schema = (JPAGPlainSchema) schema;
+ }
+
+ @Override
+ public Group getOwner() {
+ return owner;
+ }
+
+ @Override
+ public void setOwner(final Group owner) {
+ checkType(owner, JPAGroup.class);
+ this.owner = (JPAGroup) owner;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java
new file mode 100644
index 0000000..f361c03
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
+
+@Entity
+@Table(name = JPAGPlainAttrUniqueValue.TABLE)
+public class JPAGPlainAttrUniqueValue extends AbstractPlainAttrValue implements GPlainAttrUniqueValue {
+
+ private static final long serialVersionUID = 4681561795607192855L;
+
+ public static final String TABLE = "GPlainAttrUniqueValue";
+
+ @Id
+ private Long id;
+
+ @OneToOne(optional = false)
+ private JPAGPlainAttr attribute;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name = "schema_name")
+ private JPAGPlainSchema schema;
+
+ @Override
+ public Long getKey() {
+ return id;
+ }
+
+ @Override
+ public GPlainAttr getAttr() {
+ return attribute;
+ }
+
+ @Override
+ public void setAttr(final PlainAttr attr) {
+ checkType(attr, JPAGPlainAttr.class);
+ this.attribute = (JPAGPlainAttr) attr;
+ }
+
+ @Override
+ public GPlainSchema getSchema() {
+ return schema;
+ }
+
+ @Override
+ public void setSchema(final PlainSchema schema) {
+ checkType(schema, JPAGPlainSchema.class);
+ this.schema = (JPAGPlainSchema) schema;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrValue.java
new file mode 100644
index 0000000..ed93477
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrValue.java
@@ -0,0 +1,64 @@
+/*
+ * 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.group;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
+
+@Entity
+@Table(name = JPAGPlainAttrValue.TABLE)
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+public class JPAGPlainAttrValue extends AbstractPlainAttrValue implements GPlainAttrValue {
+
+ private static final long serialVersionUID = -766808291128424707L;
+
+ public static final String TABLE = "GPlainAttrValue";
+
+ @Id
+ private Long id;
+
+ @ManyToOne
+ @NotNull
+ private JPAGPlainAttr attribute;
+
+ @Override
+ public Long getKey() {
+ return id;
+ }
+
+ @Override
+ public GPlainAttr getAttr() {
+ return attribute;
+ }
+
+ @Override
+ public void setAttr(final PlainAttr attr) {
+ checkType(attr, JPAGPlainAttr.class);
+ this.attribute = (JPAGPlainAttr) attr;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java
new file mode 100644
index 0000000..684be57
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java
@@ -0,0 +1,36 @@
+/*
+ * 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.group;
+
+import javax.persistence.Cacheable;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainSchema;
+
+@Entity
+@Table(name = JPAGPlainSchema.TABLE)
+@Cacheable
+public class JPAGPlainSchema extends AbstractPlainSchema implements GPlainSchema {
+
+ private static final long serialVersionUID = -7417234690221851342L;
+
+ public static final String TABLE = "GPlainSchema";
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java
new file mode 100644
index 0000000..95d9a37
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java
@@ -0,0 +1,82 @@
+/*
+ * 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.group;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.Attributable;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttr;
+
+@Entity
+@Table(name = JPAGVirAttr.TABLE)
+public class JPAGVirAttr extends AbstractVirAttr implements GVirAttr {
+
+ private static final long serialVersionUID = -1747430556914428649L;
+
+ public static final String TABLE = "GVirAttr";
+
+ @ManyToOne
+ private JPAGroup owner;
+
+ @Column(nullable = false)
+ @OneToOne(cascade = CascadeType.MERGE)
+ private JPAGVirAttrTemplate template;
+
+ @Override
+ public Group getOwner() {
+ return owner;
+ }
+
+ @Override
+ public void setOwner(final Attributable<?, ?, ?> owner) {
+ checkType(owner, JPAGroup.class);
+ this.owner = (JPAGroup) owner;
+ }
+
+ @Override
+ public GVirAttrTemplate getTemplate() {
+ return template;
+ }
+
+ @Override
+ public void setTemplate(final GVirAttrTemplate template) {
+ checkType(template, JPAGVirAttrTemplate.class);
+ this.template = (JPAGVirAttrTemplate) template;
+ }
+
+ @Override
+ public GVirSchema getSchema() {
+ return template == null ? null : template.getSchema();
+ }
+
+ @Override
+ public void setSchema(final VirSchema schema) {
+ LOG.warn("This is group attribute, set template to select schema");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java
new file mode 100644
index 0000000..72f9fd3
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java
@@ -0,0 +1,66 @@
+/*
+ * 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.group;
+
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttrTemplate;
+
+@Entity
+@Table(name = JPAGVirAttrTemplate.TABLE)
+public class JPAGVirAttrTemplate extends AbstractVirAttrTemplate<GVirSchema> implements GVirAttrTemplate {
+
+ private static final long serialVersionUID = 4896495904794493479L;
+
+ public static final String TABLE = "GVirAttrTemplate";
+
+ @ManyToOne
+ private JPAGroup owner;
+
+ @ManyToOne
+ @JoinColumn(name = "schema_name")
+ private JPAGVirSchema schema;
+
+ @Override
+ public GVirSchema getSchema() {
+ return schema;
+ }
+
+ @Override
+ public void setSchema(final GVirSchema schema) {
+ checkType(schema, JPAGVirSchema.class);
+ this.schema = (JPAGVirSchema) schema;
+ }
+
+ @Override
+ public Group getOwner() {
+ return owner;
+ }
+
+ @Override
+ public void setOwner(final Group group) {
+ checkType(group, JPAGroup.class);
+ this.owner = (JPAGroup) group;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java
new file mode 100644
index 0000000..6f735a8
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java
@@ -0,0 +1,36 @@
+/*
+ * 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.group;
+
+import javax.persistence.Cacheable;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractVirSchema;
+
+@Entity
+@Table(name = JPAGVirSchema.TABLE)
+@Cacheable
+public class JPAGVirSchema extends AbstractVirSchema implements GVirSchema {
+
+ private static final long serialVersionUID = -2595041749349652939L;
+
+ public static final String TABLE = "GVirSchema";
+
+}
[09/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/resources/content.xml b/core/persistence-jpa/src/test/resources/content.xml
index 3b74dbc..6c6e527 100644
--- a/core/persistence-jpa/src/test/resources/content.xml
+++ b/core/persistence-jpa/src/test/resources/content.xml
@@ -81,9 +81,9 @@ under the License.
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
<CPlainSchema name="self.user.layout" type="String"
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
- <CPlainSchema name="admin.role.layout" type="String"
+ <CPlainSchema name="admin.group.layout" type="String"
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
- <CPlainSchema name="self.role.layout" type="String"
+ <CPlainSchema name="self.group.layout" type="String"
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
<CPlainSchema name="admin.membership.layout" type="String"
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
@@ -92,11 +92,11 @@ under the License.
<!-- sample policies -->
<Policy DTYPE="SyncPolicy" id="1" description="global sync policy" type="GLOBAL_SYNC"
- specification='{"userJavaRule":null,"roleJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"roleAltSearchSchemas":[]}'/>
+ specification='{"userJavaRule":null,"groupJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"groupAltSearchSchemas":[]}'/>
<Policy DTYPE="PasswordPolicy" id="2" description="global password policy" type="GLOBAL_PASSWORD"
specification='{"historyLength":1,"maxLength":0,"minLength":8,"nonAlphanumericRequired":false,"alphanumericRequired":false,"digitRequired":false,"lowercaseRequired":false,"uppercaseRequired":false,"mustStartWithDigit":false,"mustntStartWithDigit":false,"mustEndWithDigit":false,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[],"allowNullPassword":true}'/>
<Policy DTYPE="SyncPolicy" id="3" description="sync policy 2" type="SYNC"
- specification='{"userJavaRule":null,"roleJavaRule":null,"conflictResolutionAction":"ALL","userAltSearchSchemas":["username","firstname"],"roleAltSearchSchemas":[]}'/>
+ specification='{"userJavaRule":null,"groupJavaRule":null,"conflictResolutionAction":"ALL","userAltSearchSchemas":["username","firstname"],"groupAltSearchSchemas":[]}'/>
<Policy DTYPE="PasswordPolicy" id="4" description="sample password policy" type="PASSWORD"
specification='{"historyLength":0,"maxLength":0,"minLength":10,"nonAlphanumericRequired":false,"alphanumericRequired":false,"digitRequired":true,"lowercaseRequired":false,"uppercaseRequired":false,"mustStartWithDigit":false,"mustntStartWithDigit":false,"mustEndWithDigit":false,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[], "allowNullPassword":false}'/>
<Policy DTYPE="AccountPolicy" id="5" description="global account policy" type="GLOBAL_ACCOUNT"
@@ -104,11 +104,11 @@ under the License.
<Policy DTYPE="AccountPolicy" id="6" description="sample account policy" type="ACCOUNT"
specification='{"maxLength":0,"minLength":4,"pattern":null,"allUpperCase":false,"allLowerCase":false,"propagateSuspension":false,"permittedLoginRetries":3,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[]}'/>
<Policy DTYPE="SyncPolicy" id="7" description="sync policy 1" type="SYNC"
- specification='{"userJavaRule":null,"roleJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"roleAltSearchSchemas":[]}'/>
+ specification='{"userJavaRule":null,"groupJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"groupAltSearchSchemas":[]}'/>
<Policy DTYPE="PasswordPolicy" id="8" description="sample password policy" type="PASSWORD"
specification='{"historyLength":0,"maxLength":0,"minLength":10,"nonAlphanumericRequired":true,"alphanumericRequired":false,"digitRequired":true,"lowercaseRequired":true,"uppercaseRequired":true,"mustStartWithDigit":true,"mustntStartWithDigit":false,"mustEndWithDigit":true,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWithNonAlpha":false,"mustEndWithAlpha":false,"mustntEndWithNonAlpha":false,"mustntEndWithAlpha":false,"wordsNotPermitted":[],"schemasNotPermitted":[],"prefixesNotPermitted":["notpermitted1","notpermitted2"],"suffixesNotPermitted":[],"allowNullPassword":false}'/>
<Policy DTYPE="SyncPolicy" id="9" description="sync policy for java rule" type="SYNC"
- specification='{"userJavaRule":null,"roleJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"roleAltSearchSchemas":[]}'/>
+ specification='{"userJavaRule":null,"groupJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"groupAltSearchSchemas":[]}'/>
<SyncopeUser id="1" workflowId="4" status="active" password="5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8" cipherAlgorithm="SHA1"
username="rossini" creator="admin" lastModifier="admin"
@@ -126,22 +126,22 @@ under the License.
username="puccini" creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00" suspended="0"/>
- <SyncopeRole id="1" name="root"
+ <SyncopeGroup id="1" name="root"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="2" name="child" parent_id="1"
+ <SyncopeGroup id="2" name="child" parent_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="3" name="citizen"
+ <SyncopeGroup id="3" name="citizen"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="4" name="employee" parent_id="3"
+ <SyncopeGroup id="4" name="employee" parent_id="3"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="5" name="secretary" parent_id="4"
+ <SyncopeGroup id="5" name="secretary" parent_id="4"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="6"
+ <SyncopeGroup id="6"
name="director" parent_id="4" userOwner_id="5"
inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
inheritPasswordPolicy="0" inheritAccountPolicy="0"
@@ -149,37 +149,37 @@ under the License.
accountPolicy_id="6"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="7"
+ <SyncopeGroup id="7"
name="managingDirector" parent_id="6"
inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
inheritPasswordPolicy="1" inheritAccountPolicy="1" inheritOwner="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="8"
+ <SyncopeGroup id="8"
name="otherchild" parent_id="1"
inheritVirAttrs="1"
passwordPolicy_id="4"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="9" name="roleForWorkflowApproval" parent_id="1"
+ <SyncopeGroup id="9" name="groupForWorkflowApproval" parent_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="10"
+ <SyncopeGroup id="10"
name="managingConsultant" parent_id="6"
inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
inheritPasswordPolicy="1" inheritAccountPolicy="1" inheritOwner="0"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="11" name="roleForWorkflowOptIn" parent_id="1"
+ <SyncopeGroup id="11" name="groupForWorkflowOptIn" parent_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="12" name="aRoleForPropagation" parent_id="1"
+ <SyncopeGroup id="12" name="aGroupForPropagation" parent_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="13" name="bRoleForPropagation" parent_id="1"
+ <SyncopeGroup id="13" name="bGroupForPropagation" parent_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <SyncopeRole id="14"
+ <SyncopeGroup id="14"
name="artDirector" parent_id="4"
inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
inheritPasswordPolicy="0" inheritAccountPolicy="0"
@@ -188,25 +188,25 @@ under the License.
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <Membership id="1" user_id="1" role_id="1"
+ <Membership id="1" user_id="1" group_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <Membership id="2" user_id="2" role_id="1"
+ <Membership id="2" user_id="2" group_id="1"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <Membership id="3" user_id="2" role_id="2"
+ <Membership id="3" user_id="2" group_id="2"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <Membership id="4" user_id="4" role_id="7"
+ <Membership id="4" user_id="4" group_id="7"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <Membership id="5" user_id="1" role_id="8"
+ <Membership id="5" user_id="1" group_id="8"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <Membership id="6" user_id="2" role_id="3"
+ <Membership id="6" user_id="2" group_id="3"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <Membership id="7" user_id="5" role_id="14"
+ <Membership id="7" user_id="5" group_id="14"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
@@ -254,25 +254,25 @@ under the License.
<UVirSchema name="virtualdata"/>
- <RPlainSchema name="icon" type="String"
+ <GPlainSchema name="icon" type="String"
mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"/>
- <RPlainSchema name="show" type="Boolean"
+ <GPlainSchema name="show" type="Boolean"
mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"/>
- <RPlainSchema name="rderived_sx" type="String"
+ <GPlainSchema name="rderived_sx" type="String"
mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"/>
- <RPlainSchema name="rderived_dx" type="String"
+ <GPlainSchema name="rderived_dx" type="String"
mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"/>
- <RPlainSchema name="title" type="String"
+ <GPlainSchema name="title" type="String"
mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
- <RDerSchema name="rderiveddata" expression="rderived_sx + '-' + rderived_dx"/>
- <RDerSchema name="displayProperty" expression="icon + ': ' + show"/>
- <RDerSchema name="rderToBePropagated" expression="rderived_sx + '-' + rderived_dx"/>
+ <GDerSchema name="rderiveddata" expression="rderived_sx + '-' + rderived_dx"/>
+ <GDerSchema name="displayProperty" expression="icon + ': ' + show"/>
+ <GDerSchema name="rderToBePropagated" expression="rderived_sx + '-' + rderived_dx"/>
- <RVirSchema name="rvirtualdata"/>
+ <GVirSchema name="rvirtualdata"/>
<!-- rderiveddata is used to verify der schema deletion -->
- <RDerSchema name="rderivedschema" expression="rderived_sx + '-' + rderived_dx"/>
+ <GDerSchema name="rderivedschema" expression="rderived_sx + '-' + rderived_dx"/>
<MPlainSchema name="subscriptionDate" type="Date"
mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"
@@ -359,58 +359,58 @@ under the License.
<UDerAttr id="100" derSchema_name="cn" owner_id="3"/>
<UDerAttr id="101" derSchema_name="cn" owner_id="1"/>
- <RPlainAttrTemplate id="600" owner_id="1" schema_name="icon"/>
- <RPlainAttr id="600" owner_id="1" template_id="600"/>
- <RPlainAttrValue attribute_id="600" id="40" stringValue="niceIcon"/>
+ <GPlainAttrTemplate id="600" owner_id="1" schema_name="icon"/>
+ <GPlainAttr id="600" owner_id="1" template_id="600"/>
+ <GPlainAttrValue attribute_id="600" id="40" stringValue="niceIcon"/>
- <RPlainAttrTemplate id="700" owner_id="2" schema_name="icon"/>
- <RPlainAttr id="700" owner_id="2" template_id="700"/>
- <RPlainAttrValue attribute_id="700" id="41" stringValue="badIcon"/>
+ <GPlainAttrTemplate id="700" owner_id="2" schema_name="icon"/>
+ <GPlainAttr id="700" owner_id="2" template_id="700"/>
+ <GPlainAttrValue attribute_id="700" id="41" stringValue="badIcon"/>
- <RPlainAttrTemplate id="800" owner_id="1" schema_name="show"/>
- <RPlainAttr id="800" owner_id="1" template_id="800"/>
- <RPlainAttrValue attribute_id="800" id="42" booleanValue="1"/>
+ <GPlainAttrTemplate id="800" owner_id="1" schema_name="show"/>
+ <GPlainAttr id="800" owner_id="1" template_id="800"/>
+ <GPlainAttrValue attribute_id="800" id="42" booleanValue="1"/>
- <RPlainAttrTemplate id="900" owner_id="6" schema_name="icon"/>
- <RPlainAttr id="900" owner_id="6" template_id="900"/>
- <RPlainAttrValue attribute_id="900" id="43" stringValue="icon6"/>
+ <GPlainAttrTemplate id="900" owner_id="6" schema_name="icon"/>
+ <GPlainAttr id="900" owner_id="6" template_id="900"/>
+ <GPlainAttrValue attribute_id="900" id="43" stringValue="icon6"/>
- <RPlainAttrTemplate id="950" owner_id="4" schema_name="icon"/>
- <RPlainAttr id="950" owner_id="4" template_id="950"/>
- <RPlainAttrValue attribute_id="950" id="44" stringValue="icon4"/>
+ <GPlainAttrTemplate id="950" owner_id="4" schema_name="icon"/>
+ <GPlainAttr id="950" owner_id="4" template_id="950"/>
+ <GPlainAttrValue attribute_id="950" id="44" stringValue="icon4"/>
- <RPlainAttrTemplate id="992" owner_id="1" schema_name="rderived_sx"/>
- <RPlainAttr id="992" owner_id="1" template_id="992"/>
- <RPlainAttrValue attribute_id="992" id="92" stringValue="sx"/>
+ <GPlainAttrTemplate id="992" owner_id="1" schema_name="rderived_sx"/>
+ <GPlainAttr id="992" owner_id="1" template_id="992"/>
+ <GPlainAttrValue attribute_id="992" id="92" stringValue="sx"/>
- <RPlainAttrTemplate id="993" owner_id="1" schema_name="rderived_dx"/>
- <RPlainAttr id="993" owner_id="1" template_id="993"/>
- <RPlainAttrValue attribute_id="993" id="93" stringValue="dx"/>
+ <GPlainAttrTemplate id="993" owner_id="1" schema_name="rderived_dx"/>
+ <GPlainAttr id="993" owner_id="1" template_id="993"/>
+ <GPlainAttrValue attribute_id="993" id="93" stringValue="dx"/>
- <RPlainAttrTemplate id="994" owner_id="12" schema_name="title"/>
- <RPlainAttr id="994" owner_id="12" template_id="994"/>
- <RPlainAttrValue attribute_id="994" id="94" stringValue="r12"/>
+ <GPlainAttrTemplate id="994" owner_id="12" schema_name="title"/>
+ <GPlainAttr id="994" owner_id="12" template_id="994"/>
+ <GPlainAttrValue attribute_id="994" id="94" stringValue="r12"/>
- <RPlainAttrTemplate id="995" owner_id="13" schema_name="title"/>
- <RPlainAttr id="995" owner_id="13" template_id="995"/>
- <RPlainAttrValue attribute_id="995" id="95" stringValue="r13"/>
+ <GPlainAttrTemplate id="995" owner_id="13" schema_name="title"/>
+ <GPlainAttr id="995" owner_id="13" template_id="995"/>
+ <GPlainAttrValue attribute_id="995" id="95" stringValue="r13"/>
- <RDerAttrTemplate id="1000" owner_id="1" schema_name="rderiveddata"/>
- <RDerAttr id="1000" owner_id="1" template_id="1000"/>
+ <GDerAttrTemplate id="1000" owner_id="1" schema_name="rderiveddata"/>
+ <GDerAttr id="1000" owner_id="1" template_id="1000"/>
- <RDerAttrTemplate id="1001" owner_id="1" schema_name="displayProperty"/>
- <RDerAttr id="1001" owner_id="1" template_id="1001"/>
+ <GDerAttrTemplate id="1001" owner_id="1" schema_name="displayProperty"/>
+ <GDerAttr id="1001" owner_id="1" template_id="1001"/>
- <RDerAttrTemplate id="1002" owner_id="4" schema_name="displayProperty"/>
- <RDerAttr id="1002" owner_id="4" template_id="1002"/>
+ <GDerAttrTemplate id="1002" owner_id="4" schema_name="displayProperty"/>
+ <GDerAttr id="1002" owner_id="4" template_id="1002"/>
- <RDerAttrTemplate id="1003" owner_id="1" schema_name="rderToBePropagated"/>
- <RDerAttr id="1003" owner_id="1" template_id="1003"/>
+ <GDerAttrTemplate id="1003" owner_id="1" schema_name="rderToBePropagated"/>
+ <GDerAttr id="1003" owner_id="1" template_id="1003"/>
- <RVirAttrTemplate id="98" owner_id="4" schema_name="rvirtualdata"/>
- <RVirAttr id="98" owner_id="4" template_id="98"/>
+ <GVirAttrTemplate id="98" owner_id="4" schema_name="rvirtualdata"/>
+ <GVirAttr id="98" owner_id="4" template_id="98"/>
- <RVirAttrTemplate id="99" owner_id="3" schema_name="rvirtualdata"/>
+ <GVirAttrTemplate id="99" owner_id="3" schema_name="rvirtualdata"/>
<MPlainAttrTemplate id="98" owner_id="1" schema_name="mderived_sx"/>
@@ -497,7 +497,7 @@ under the License.
bundleName="net.tirasa.connid.bundles.csvdir"
connectorName="net.tirasa.connid.bundles.csvdir.CSVDirConnector"
version="${connid.csvdir.version}"
- jsonConf='[{"schema":{"name":"fields","displayName":"fields","helpMessage":"Column names separated by comma","type":"[Ljava.lang.String;","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["id","name","surname","email","password","role","membership","status","deleted"]},{"schema":{"name":"keyColumnNames","displayName":"Key column name","helpMessage":"Name of the column used to identify user uniquely","type":"[Ljava.lang.String;","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["name","surname"]},{"schema":{"name":"deleteColumnName","displayName":"Delete column name","helpMessage":"Name of the column used to specify users to be deleted","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["deleted"]},{"schema":{"name":"passwordColumnName","displayName":"Password column name","helpMessage":"Name of th
e column used to specify user password","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["password"]},{"schema":{"name":"keyseparator","displayName":"Key separator","helpMessage":"Character used to separate keys in a multi-key scenario","type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[","]},{"schema":{"name":"ignoreHeader","displayName":"Ignore header","helpMessage":"Specify it first line file must be ignored","type":"java.lang.Boolean","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[false]},{"schema":{"name":"fieldDelimiter","displayName":"fieldDelimiter","helpMessage":"fieldDelimiter","type":"char","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[","]},{"schema":{"name":"quotationRequired","displayName":"Value quotation required","
helpMessage":"Specify if value quotation is required","type":"java.lang.Boolean","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[false]},{"schema":{"name":"statusColumn","displayName":"statusColumn","helpMessage":"Status column","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["status"]},{"schema":{"name":"sourcePath","displayName":"Source path","helpMessage":"Absolute path of a directory where are located CSV files to be processed","type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["${test.csvdir.path}"]},{"schema":{"name":"fileMask","displayName":"File mask","helpMessage":"Regular expression describing files to be processed","type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["test.csv"]}]'/>
+ jsonConf='[{"schema":{"name":"fields","displayName":"fields","helpMessage":"Column names separated by comma","type":"[Ljava.lang.String;","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["id","name","surname","email","password","theirgroup","membership","status","deleted"]},{"schema":{"name":"keyColumnNames","displayName":"Key column name","helpMessage":"Name of the column used to identify user uniquely","type":"[Ljava.lang.String;","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["name","surname"]},{"schema":{"name":"deleteColumnName","displayName":"Delete column name","helpMessage":"Name of the column used to specify users to be deleted","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["deleted"]},{"schema":{"name":"passwordColumnName","displayName":"Password column name","helpMessage":"Name
of the column used to specify user password","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["password"]},{"schema":{"name":"keyseparator","displayName":"Key separator","helpMessage":"Character used to separate keys in a multi-key scenario","type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[","]},{"schema":{"name":"ignoreHeader","displayName":"Ignore header","helpMessage":"Specify it first line file must be ignored","type":"java.lang.Boolean","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[false]},{"schema":{"name":"fieldDelimiter","displayName":"fieldDelimiter","helpMessage":"fieldDelimiter","type":"char","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[","]},{"schema":{"name":"quotationRequired","displayName":"Value quotation requi
red","helpMessage":"Specify if value quotation is required","type":"java.lang.Boolean","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":[false]},{"schema":{"name":"statusColumn","displayName":"statusColumn","helpMessage":"Status column","type":"java.lang.String","required":false,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["status"]},{"schema":{"name":"sourcePath","displayName":"Source path","helpMessage":"Absolute path of a directory where are located CSV files to be processed","type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["${test.csvdir.path}"]},{"schema":{"name":"fileMask","displayName":"File mask","helpMessage":"Regular expression describing files to be processed","type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":false,"values":["test.csv"]}]'/>
<ConnInstance_capabilities ConnInstance_id="104" capabilities="ONE_PHASE_CREATE"/>
<ConnInstance_capabilities ConnInstance_id="104" capabilities="ONE_PHASE_UPDATE"/>
<ConnInstance_capabilities ConnInstance_id="104" capabilities="ONE_PHASE_DELETE"/>
@@ -651,13 +651,13 @@ under the License.
<SyncopeUser_ExternalResource user_id="3" resource_name="ws-target-resource-2"/>
<SyncopeUser_ExternalResource user_id="3" resource_name="ws-target-resource-1"/>
<SyncopeUser_ExternalResource user_id="5" resource_name="resource-testdb2"/>
- <SyncopeRole_ExternalResource role_id="3" resource_name="ws-target-resource-list-mappings-1"/>
- <SyncopeRole_ExternalResource role_id="8" resource_name="ws-target-resource-2"/>
- <SyncopeRole_ExternalResource role_id="3" resource_name="ws-target-resource-list-mappings-2"/>
- <SyncopeRole_ExternalResource role_id="7" resource_name="ws-target-resource-nopropagation"/>
- <SyncopeRole_ExternalResource role_id="10" resource_name="ws-target-resource-nopropagation3"/>
- <SyncopeRole_ExternalResource role_id="12" resource_name="resource-csv"/>
- <SyncopeRole_ExternalResource role_id="13" resource_name="resource-csv"/>
+ <SyncopeGroup_ExternalResource group_id="3" resource_name="ws-target-resource-list-mappings-1"/>
+ <SyncopeGroup_ExternalResource group_id="8" resource_name="ws-target-resource-2"/>
+ <SyncopeGroup_ExternalResource group_id="3" resource_name="ws-target-resource-list-mappings-2"/>
+ <SyncopeGroup_ExternalResource group_id="7" resource_name="ws-target-resource-nopropagation"/>
+ <SyncopeGroup_ExternalResource group_id="10" resource_name="ws-target-resource-nopropagation3"/>
+ <SyncopeGroup_ExternalResource group_id="12" resource_name="resource-csv"/>
+ <SyncopeGroup_ExternalResource group_id="13" resource_name="resource-csv"/>
<UMapping id="15" resource_name="ws-target-resource-1"/>
<UMappingItem id="99" mapping_id="15" extAttrName="userId"
@@ -787,8 +787,8 @@ under the License.
<UMappingItem id="207" extAttrName="__NAME__" mapping_id="9"
intAttrName="csvuserid" intMappingType="UserDerivedSchema" mandatoryCondition="true"
accountid="1" password="0" purpose="BOTH"/>
- <UMappingItem id="208" extAttrName="role" mapping_id="9"
- intAttrName="rderToBePropagated" intMappingType="RoleDerivedSchema" mandatoryCondition="false"
+ <UMappingItem id="208" extAttrName="theirgroup" mapping_id="9"
+ intAttrName="rderToBePropagated" intMappingType="GroupDerivedSchema" mandatoryCondition="false"
accountid="0" password="0" purpose="BOTH"/>
<UMappingItem id="209" extAttrName="membership" mapping_id="9"
intAttrName="mderToBePropagated" intMappingType="MembershipDerivedSchema" mandatoryCondition="false"
@@ -820,7 +820,7 @@ under the License.
extAttrName="mail" intAttrName="email" intMappingType="UserPlainSchema"
mandatoryCondition="false" purpose="BOTH"/>
<UMappingItem id="316" accountid="0" password="0" mapping_id="11"
- extAttrName="title" intAttrName="title" intMappingType="RolePlainSchema"
+ extAttrName="title" intAttrName="title" intMappingType="GroupPlainSchema"
mandatoryCondition="false" purpose="BOTH"/>
<UMappingItem id="317" accountid="0" password="0" mapping_id="11"
extAttrName="postalAddress" intAttrName="postalAddress" intMappingType="MembershipPlainSchema"
@@ -838,19 +838,19 @@ under the License.
extAttrName="jpegPhoto" intAttrName="photo" intMappingType="UserPlainSchema"
mandatoryCondition="false" purpose="BOTH"/>
- <RMapping id="1" resource_name="resource-ldap"
+ <GMapping id="1" resource_name="resource-ldap"
accountlink="'cn=' + name + ',ou=groups,o=isp'"/>
- <RMappingItem id="1" accountid="1" password="0" mapping_id="1"
- extAttrName="cn" intAttrName="roleName" intMappingType="RoleName"
+ <GMappingItem id="1" accountid="1" password="0" mapping_id="1"
+ extAttrName="cn" intAttrName="groupName" intMappingType="GroupName"
mandatoryCondition="true" purpose="BOTH"/>
- <RMappingItem id="2" accountid="0" password="0" mapping_id="1"
- extAttrName="owner" intAttrName="roleOwnerSchema" intMappingType="RoleOwnerSchema"
+ <GMappingItem id="2" accountid="0" password="0" mapping_id="1"
+ extAttrName="owner" intAttrName="groupOwnerSchema" intMappingType="GroupOwnerSchema"
mandatoryCondition="false" purpose="BOTH"/>
- <RMappingItem id="3" accountid="0" password="0" mapping_id="1"
- extAttrName="description" intAttrName="title" intMappingType="RolePlainSchema"
+ <GMappingItem id="3" accountid="0" password="0" mapping_id="1"
+ extAttrName="description" intAttrName="title" intMappingType="GroupPlainSchema"
mandatoryCondition="false" purpose="BOTH"/>
- <RMappingItem id="4" extAttrName="businessCategory" mapping_id="1"
- intAttrName="rvirtualdata" intMappingType="RoleVirtualSchema" mandatoryCondition="false"
+ <GMappingItem id="4" extAttrName="businessCategory" mapping_id="1"
+ intAttrName="rvirtualdata" intMappingType="GroupVirtualSchema" mandatoryCondition="false"
accountid="0" password="0" purpose="BOTH"/>
<UMapping id="16" resource_name="resource-db-sync"/>
@@ -904,8 +904,8 @@ under the License.
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="4" name="CSV (update matching; assign unmatching)" resource_name="resource-csv"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="ASSIGN" matchingRule="UPDATE"
- userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[{"schema":"type","readonly":false,"values":["email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'"]}],"derivedAttributes":[{"schema":"cn","readonly":false,"values":[null]}],"virtualAttributes":[],"resources":["resource-testdb"],"propagationStatuses":[],"memberships":[{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"roleId":8,"roleName":null,"attributes":[{"schema":"subscriptionDate","readonly":false,"values":["'2009-08-18T16:33:12.203+0200'"]}],"derivedAttributes":[],"virtualAttributes":[]}]}'
- roleTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":0,"userOwner":null,"roleOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"rPlainAttrTemplates":[],"rDerAttrTemplates":[],"rVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
+ userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[{"schema":"type","readonly":false,"values":["email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'"]}],"derivedAttributes":[{"schema":"cn","readonly":false,"values":[null]}],"virtualAttributes":[],"resources":["resource-testdb"],"propagationStatuses":[],"memberships":[{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"groupId":8,"groupName":null,"attributes":[{"schema":"subscriptionDate","readonly":false,"values":["'2009-08-18T16:33:12.203+0200'"]}],"derivedAttributes":[],"virtualAttributes":[]}]}'
+ groupTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":0,"userOwner":null,"groupOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"gPlainAttrTemplates":[],"gDerAttrTemplates":[],"gVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
<Task DTYPE="SchedTask" type="SCHEDULED" id="5" name="SampleJob Task" jobClassName="org.apache.syncope.core.provisioning.java.job.SampleJob" cronExpression="0 0 0 1 * ?"/>
<Task DTYPE="PropagationTask" type="PROPAGATION" id="6" propagationMode="TWO_PHASES" propagationOperation="UPDATE"
objectClassName="__ACCOUNT__" resource_name="ws-target-resource-nopropagation" subjectType="USER" subjectId="1"
@@ -915,7 +915,7 @@ under the License.
performCreate="1" performUpdate="1" performDelete="0" syncStatus="1" fullReconciliation="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="PROVISION" matchingRule="UPDATE"
userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[{"schema":"type","readonly":false,"values":["'type a'"]},{"schema":"userId","readonly":false,"values":["'reconciled@syncope.apache.org'"]},{"schema":"fullname","readonly":false,"values":["'reconciled fullname'"]},{"schema":"surname","readonly":false,"values":["'surname'"]}],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"memberships":[]}'
- roleTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":0,"userOwner":null,"roleOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"rPlainAttrTemplates":[],"rDerAttrTemplates":[],"rVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
+ groupTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":0,"userOwner":null,"groupOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"gPlainAttrTemplates":[],"gDerAttrTemplates":[],"gVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
<Task DTYPE="NotificationTask" type="NOTIFICATION" id="8" sender="admin@prova.org" subject="Notification for SYNCOPE-81"
textBody="NOTIFICATION-81" htmlBody="NOTIFICATION-81" traceLevel="ALL"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="9" name="TestDB2 Task" resource_name="resource-testdb2"
@@ -928,7 +928,7 @@ under the License.
fullReconciliation="1" performCreate="1" performDelete="1" performUpdate="1" syncStatus="0"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="PROVISION" matchingRule="UPDATE"
userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[{"schema":"virtualReadOnly","readonly":false,"values":[""]}],"resources":["resource-ldap"],"propagationStatuses":[],"memberships":[]}'
- roleTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":8,"userOwner":null,"roleOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[{"schema":"show","readonly":false,"values":["'true'"]}],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"rPlainAttrTemplates":["show"],"rDerAttrTemplates":[],"rVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
+ groupTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":8,"userOwner":null,"groupOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[{"schema":"show","readonly":false,"values":["'true'"]}],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"gPlainAttrTemplates":["show"],"gDerAttrTemplates":[],"gVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
<SyncTask_actionsClassNames SyncTask_id="11" actionClassName="org.apache.syncope.core.provisioning.java.sync.LDAPMembershipSyncActions"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="12" name="VirAttrCache test" resource_name="resource-csv"
performCreate="0" performUpdate="1" performDelete="0" syncStatus="0" fullReconciliation="1"
@@ -936,52 +936,52 @@ under the License.
<Task DTYPE="PushTask" type="PUSH" id="13" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="ASSIGN" matchingRule="IGNORE"
- userFilter="surname==Vivaldi" roleFilter="name==_NO_ONE_"/>
+ userFilter="surname==Vivaldi" groupFilter="name==_NO_ONE_"/>
<Task DTYPE="PushTask" type="PUSH" id="14" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="PROVISION" matchingRule="IGNORE"
- userFilter="surname==Bellini" roleFilter="name==_NO_ONE_"/>
+ userFilter="surname==Bellini" groupFilter="name==_NO_ONE_"/>
<Task DTYPE="PushTask" type="PUSH" id="15" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="UNLINK" matchingRule="IGNORE"
- userFilter="surname==Puccini" roleFilter="name==_NO_ONE_"/>
+ userFilter="surname==Puccini" groupFilter="name==_NO_ONE_"/>
<Task DTYPE="PushTask" type="PUSH" id="16" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="IGNORE" matchingRule="IGNORE"
- userFilter="surname==Verdi" roleFilter="name==_NO_ONE_"/>
+ userFilter="surname==Verdi" groupFilter="name==_NO_ONE_"/>
<Task DTYPE="PushTask" type="PUSH" id="17" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="ASSIGN" matchingRule="UPDATE"
- userFilter="username==_NO_ONE_" roleFilter="name==_NO_ONE_"/>
+ userFilter="username==_NO_ONE_" groupFilter="name==_NO_ONE_"/>
<Task DTYPE="PushTask" type="PUSH" id="18" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="IGNORE" matchingRule="DEPROVISION"
- userFilter="surname==Verdi" roleFilter="name==_NO_ONE_"/>
+ userFilter="surname==Verdi" groupFilter="name==_NO_ONE_"/>
<Task DTYPE="PushTask" type="PUSH" id="19" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="IGNORE" matchingRule="UNASSIGN"
- userFilter="surname==Rossini" roleFilter="name==_NO_ONE_"/>
+ userFilter="surname==Rossini" groupFilter="name==_NO_ONE_"/>
<Task DTYPE="PushTask" type="PUSH" id="20" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="IGNORE" matchingRule="LINK"
- userFilter="surname==Verdi" roleFilter="name==_NO_ONE_"/>
+ userFilter="surname==Verdi" groupFilter="name==_NO_ONE_"/>
<Task DTYPE="PushTask" type="PUSH" id="21" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="IGNORE" matchingRule="UNLINK"
- userFilter="surname==Verdi" roleFilter="name==_NO_ONE_"/>
+ userFilter="surname==Verdi" groupFilter="name==_NO_ONE_"/>
<Task DTYPE="PushTask" type="PUSH" id="22" name="Export on resource-testdb2" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="IGNORE" matchingRule="UPDATE"
- userFilter="surname==Verdi" roleFilter="name==_NO_ONE_"/>
+ userFilter="surname==Verdi" groupFilter="name==_NO_ONE_"/>
<Task DTYPE="PushTask" type="PUSH" id="23" name="Export on resource-ldap" resource_name="resource-ldap"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1"
jobClassName="org.apache.syncope.core.provisioning.api.job.PushJob" unmatchingRule="ASSIGN" matchingRule="UNLINK"
- userFilter="username==_NO_ONE_" roleFilter="name==citizen"/>
+ userFilter="username==_NO_ONE_" groupFilter="name==citizen"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="24" name="CSV Task (update matching; provision unmatching)" resource_name="resource-csv"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="PROVISION" matchingRule="UPDATE"
userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[{"schema":"firstname","readonly":false,"values":[""]},{"schema":"userId","readonly":false,"values":["'test'"]},{"schema":"fullname","readonly":false,"values":["'test'"]},{"schema":"surname","readonly":false,"values":["'test'"]}],"derivedAttributes":[],"virtualAttributes":[],"resources":["resource-testdb"],"propagationStatuses":[],"memberships":[]}'
- roleTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":0,"userOwner":null,"roleOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"rPlainAttrTemplates":[],"rDerAttrTemplates":[],"rVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
+ groupTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":0,"userOwner":null,"groupOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"gPlainAttrTemplates":[],"gDerAttrTemplates":[],"gVirAttrTemplates":[],"mPlainAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="25" name="CSV (unlink matching; ignore unmatching)" resource_name="resource-csv"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
jobClassName="org.apache.syncope.core.provisioning.api.job.SyncJob" unmatchingRule="IGNORE" matchingRule="UNLINK"/>
@@ -1002,7 +1002,7 @@ under the License.
<Notification id="10" sender="test@syncope.apache.org" subject="Test subject" template="test" selfAsRecipient="0"
traceLevel="FAILURES"
userAbout="fullname==*o*;fullname==*i*"
- recipients="$roles==7"
+ recipients="$groups==7"
recipientAttrType="UserPlainSchema" recipientAttrName="email" active="1"/>
<Notification_events Notification_id="10" events="[CUSTOM]:[]:[]:[unexisting1]:[FAILURE]"/>
<Notification_events Notification_id="10" events="[CUSTOM]:[]:[]:[unexisting2]:[SUCCESS]"/>
@@ -1030,11 +1030,11 @@ under the License.
<Entitlement name="USER_UPDATE"/>
<Entitlement name="USER_DELETE"/>
<Entitlement name="USER_VIEW"/>
- <Entitlement name="ROLE_LIST"/>
- <Entitlement name="ROLE_CREATE"/>
- <Entitlement name="ROLE_READ"/>
- <Entitlement name="ROLE_UPDATE"/>
- <Entitlement name="ROLE_DELETE"/>
+ <Entitlement name="GROUP_LIST"/>
+ <Entitlement name="GROUP_CREATE"/>
+ <Entitlement name="GROUP_READ"/>
+ <Entitlement name="GROUP_UPDATE"/>
+ <Entitlement name="GROUP_DELETE"/>
<Entitlement name="RESOURCE_LIST"/>
<Entitlement name="RESOURCE_CREATE"/>
<Entitlement name="RESOURCE_READ"/>
@@ -1089,37 +1089,37 @@ under the License.
<Entitlement name="SECURITY_QUESTION_CREATE"/>
<Entitlement name="SECURITY_QUESTION_UPDATE"/>
<Entitlement name="SECURITY_QUESTION_DELETE"/>
- <Entitlement name="ROLE_1"/>
- <Entitlement name="ROLE_2"/>
- <Entitlement name="ROLE_3"/>
- <Entitlement name="ROLE_4"/>
- <Entitlement name="ROLE_5"/>
- <Entitlement name="ROLE_6"/>
- <Entitlement name="ROLE_7"/>
- <Entitlement name="ROLE_8"/>
- <Entitlement name="ROLE_9"/>
- <Entitlement name="ROLE_10"/>
- <Entitlement name="ROLE_11"/>
- <Entitlement name="ROLE_12"/>
- <Entitlement name="ROLE_13"/>
- <Entitlement name="ROLE_14"/>
+ <Entitlement name="GROUP_1"/>
+ <Entitlement name="GROUP_2"/>
+ <Entitlement name="GROUP_3"/>
+ <Entitlement name="GROUP_4"/>
+ <Entitlement name="GROUP_5"/>
+ <Entitlement name="GROUP_6"/>
+ <Entitlement name="GROUP_7"/>
+ <Entitlement name="GROUP_8"/>
+ <Entitlement name="GROUP_9"/>
+ <Entitlement name="GROUP_10"/>
+ <Entitlement name="GROUP_11"/>
+ <Entitlement name="GROUP_12"/>
+ <Entitlement name="GROUP_13"/>
+ <Entitlement name="GROUP_14"/>
- <SyncopeRole_Entitlement entitlement_name="base" role_id="1"/>
- <SyncopeRole_Entitlement entitlement_name="advanced" role_id="1"/>
- <SyncopeRole_Entitlement entitlement_name="base" role_id="2"/>
- <SyncopeRole_Entitlement entitlement_name="USER_READ" role_id="2"/>
- <SyncopeRole_Entitlement entitlement_name="USER_LIST" role_id="2"/>
- <SyncopeRole_Entitlement entitlement_name="USER_READ" role_id="7"/>
- <SyncopeRole_Entitlement entitlement_name="USER_LIST" role_id="7"/>
- <SyncopeRole_Entitlement entitlement_name="ROLE_8" role_id="7"/>
- <SyncopeRole_Entitlement entitlement_name="ROLE_9" role_id="7"/>
- <SyncopeRole_Entitlement entitlement_name="ROLE_7" role_id="7"/>
- <SyncopeRole_Entitlement entitlement_name="ROLE_1" role_id="7"/>
- <SyncopeRole_Entitlement entitlement_name="WORKFLOW_FORM_CLAIM" role_id="7"/>
- <SyncopeRole_Entitlement entitlement_name="WORKFLOW_FORM_SUBMIT" role_id="7"/>
- <SyncopeRole_Entitlement entitlement_name="SCHEMA_READ" role_id="8"/>
- <SyncopeRole_Entitlement entitlement_name="ROLE_READ" role_id="8"/>
- <SyncopeRole_Entitlement entitlement_name="WORKFLOW_FORM_CLAIM" role_id="8"/>
+ <SyncopeGroup_Entitlement entitlement_name="base" group_id="1"/>
+ <SyncopeGroup_Entitlement entitlement_name="advanced" group_id="1"/>
+ <SyncopeGroup_Entitlement entitlement_name="base" group_id="2"/>
+ <SyncopeGroup_Entitlement entitlement_name="USER_READ" group_id="2"/>
+ <SyncopeGroup_Entitlement entitlement_name="USER_LIST" group_id="2"/>
+ <SyncopeGroup_Entitlement entitlement_name="USER_READ" group_id="7"/>
+ <SyncopeGroup_Entitlement entitlement_name="USER_LIST" group_id="7"/>
+ <SyncopeGroup_Entitlement entitlement_name="GROUP_8" group_id="7"/>
+ <SyncopeGroup_Entitlement entitlement_name="GROUP_9" group_id="7"/>
+ <SyncopeGroup_Entitlement entitlement_name="GROUP_7" group_id="7"/>
+ <SyncopeGroup_Entitlement entitlement_name="GROUP_1" group_id="7"/>
+ <SyncopeGroup_Entitlement entitlement_name="WORKFLOW_FORM_CLAIM" group_id="7"/>
+ <SyncopeGroup_Entitlement entitlement_name="WORKFLOW_FORM_SUBMIT" group_id="7"/>
+ <SyncopeGroup_Entitlement entitlement_name="SCHEMA_READ" group_id="8"/>
+ <SyncopeGroup_Entitlement entitlement_name="GROUP_READ" group_id="8"/>
+ <SyncopeGroup_Entitlement entitlement_name="WORKFLOW_FORM_CLAIM" group_id="8"/>
<SecurityQuestion id="1" content="What's your mother's maiden name?"/>
</dataset>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 243b27f..bb61b7a 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -33,6 +33,10 @@ under the License.
<artifactId>syncope-core</artifactId>
<packaging>pom</packaging>
+ <properties>
+ <rootpom.basedir>${basedir}/..</rootpom.basedir>
+ </properties>
+
<modules>
<module>persistence-api</module>
<module>persistence-jpa</module>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/AttributableTransformer.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/AttributableTransformer.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/AttributableTransformer.java
index bcbe900..5e8b9e7 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/AttributableTransformer.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/AttributableTransformer.java
@@ -22,7 +22,7 @@ import org.apache.syncope.common.lib.mod.AbstractAttributableMod;
import org.apache.syncope.common.lib.to.AbstractAttributableTO;
/**
- * Provides logic for transforming user or role, received as input by RESTful methods, before any internal
+ * Provides logic for transforming user or group, received as input by RESTful methods, before any internal
* processing logic takes place.
*/
public interface AttributableTransformer {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
index 2715637..61ff143 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
@@ -50,7 +50,7 @@ public interface Connector {
Uid authenticate(String username, String password, OperationOptions options);
/**
- * Create user / role on a connector instance.
+ * Create user / group on a connector instance.
*
* @param propagationMode propagation mode
* @param objectClass ConnId's object class
@@ -64,7 +64,7 @@ public interface Connector {
Set<String> propagationAttempted);
/**
- * Update user / role on a connector instance.
+ * Update user / group on a connector instance.
*
* @param propagationMode propagation mode
* @param objectClass ConnId's object class
@@ -79,7 +79,7 @@ public interface Connector {
Set<String> propagationAttempted);
/**
- * Delete user / role on a connector instance.
+ * Delete user / group on a connector instance.
*
* @param propagationMode propagation mode
* @param objectClass ConnId's object class
@@ -91,7 +91,7 @@ public interface Connector {
Uid uid, OperationOptions options, Set<String> propagationAttempted);
/**
- * Sync users / roles from a connector instance.
+ * Sync users / groups from a connector instance.
*
* @param objectClass ConnId's object class
* @param token to be passed to the underlying connector
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
new file mode 100644
index 0000000..16ffc7c
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
@@ -0,0 +1,37 @@
+/*
+ * 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.provisioning.api;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.GroupTO;
+
+public interface GroupProvisioningManager extends ProvisioningManager<GroupTO, GroupMod> {
+
+ Map.Entry<Long, List<PropagationStatus>> create(GroupTO groupTO, Set<String> excludedResources);
+
+ Map.Entry<Long, List<PropagationStatus>> create(
+ GroupTO groupTO, Map<Long, String> groupOwnerMap, Set<String> excludedResources);
+
+ Map.Entry<Long, List<PropagationStatus>> update(GroupMod subjectMod, Set<String> excludedResources);
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/RoleProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/RoleProvisioningManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/RoleProvisioningManager.java
deleted file mode 100644
index 595af54..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/RoleProvisioningManager.java
+++ /dev/null
@@ -1,37 +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.provisioning.api;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.PropagationStatus;
-import org.apache.syncope.common.lib.to.RoleTO;
-
-public interface RoleProvisioningManager extends ProvisioningManager<RoleTO, RoleMod> {
-
- Map.Entry<Long, List<PropagationStatus>> create(RoleTO roleTO, Set<String> excludedResources);
-
- Map.Entry<Long, List<PropagationStatus>> create(
- RoleTO roleTO, Map<Long, String> roleOwnerMap, Set<String> excludedResources);
-
- Map.Entry<Long, List<PropagationStatus>> update(RoleMod subjectMod, Set<String> excludedResources);
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/WorkflowResult.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/WorkflowResult.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/WorkflowResult.java
index e1964e5..1b3f2ab 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/WorkflowResult.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/WorkflowResult.java
@@ -32,19 +32,18 @@ public class WorkflowResult<T> {
private PropagationByResource propByRes;
- private Set<String> performedTasks;
+ private final Set<String> performedTasks = new HashSet<>();
public WorkflowResult(final T result, final PropagationByResource propByRes, final String performedTask) {
this.result = result;
this.propByRes = propByRes;
- this.performedTasks = new HashSet<>();
this.performedTasks.add(performedTask);
}
public WorkflowResult(final T result, final PropagationByResource propByRes, final Set<String> performedTasks) {
this.result = result;
this.propByRes = propByRes;
- this.performedTasks = new HashSet<>(performedTasks);
+ this.performedTasks.addAll(performedTasks);
}
public T getResult() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCache.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCache.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCache.java
index d9df1ef..45256e5 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCache.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCache.java
@@ -28,8 +28,8 @@ public interface VirAttrCache {
/**
* Force entry expiring.
*
- * @param type user or role
- * @param id user or role id
+ * @param type user or group
+ * @param id user or group id
* @param schemaName virtual attribute schema name
*/
void expire(AttributableType type, Long id, String schemaName);
@@ -37,8 +37,8 @@ public interface VirAttrCache {
/**
* Retrieve cached value. Return null in case of virtual attribute not cached.
*
- * @param type user or role
- * @param id user or role id
+ * @param type user or group
+ * @param id user or group id
* @param schemaName virtual attribute schema name.
* @return cached values or null if virtual attribute is not cached.
*/
@@ -55,8 +55,8 @@ public interface VirAttrCache {
/**
* Cache virtual attribute values.
*
- * @param type user or role
- * @param id user or role id
+ * @param type user or group
+ * @param id user or group id
* @param schemaName virtual attribute name
* @param value virtual attribute values
*/
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheValue.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheValue.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheValue.java
index 9d1bd84..0db95ac 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheValue.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheValue.java
@@ -47,11 +47,11 @@ public class VirAttrCacheValue {
public VirAttrCacheValue() {
this.creationDate = new Date();
this.lastAccessDate = new Date();
- values = new HashMap<>();
+ this.values = new HashMap<>();
}
- public void setResourceValues(final String resourceName, final Set<String> values) {
- this.values.put(resourceName, values);
+ public void setResourceValues(final String resourceName, final Set<String> cached) {
+ this.values.put(resourceName, cached);
}
public Date getCreationDate() {
@@ -80,7 +80,7 @@ public class VirAttrCacheValue {
return lastAccessDate;
}
- void setLastAccessDate(final Date lastAccessDate) {
+ public void setLastAccessDate(final Date lastAccessDate) {
this.lastAccessDate = lastAccessDate;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/GroupDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/GroupDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/GroupDataBinder.java
new file mode 100644
index 0000000..95df28a
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/GroupDataBinder.java
@@ -0,0 +1,36 @@
+/*
+ * 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.provisioning.api.data;
+
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.PropagationByResource;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+
+public interface GroupDataBinder {
+
+ GroupTO getGroupTO(Long key);
+
+ GroupTO getGroupTO(Group group);
+
+ Group create(Group group, GroupTO groupTO);
+
+ PropagationByResource update(Group group, GroupMod groupMod);
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RoleDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RoleDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RoleDataBinder.java
deleted file mode 100644
index b2da797..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RoleDataBinder.java
+++ /dev/null
@@ -1,36 +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.provisioning.api.data;
-
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-
-public interface RoleDataBinder {
-
- RoleTO getRoleTO(Long key);
-
- RoleTO getRoleTO(Role role);
-
- Role create(Role role, RoleTO roleTO);
-
- PropagationByResource update(Role role, RoleMod roleMod);
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/TaskJob.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/TaskJob.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/TaskJob.java
index 9820406..b6efd53 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/TaskJob.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/TaskJob.java
@@ -27,7 +27,7 @@ import org.quartz.Job;
@DisallowConcurrentExecution
public interface TaskJob extends Job {
- public static final String DRY_RUN_JOBDETAIL_KEY = "dryRun";
+ String DRY_RUN_JOBDETAIL_KEY = "dryRun";
/**
* Task execution status.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java
index 98281f2..391ab29 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java
@@ -40,9 +40,8 @@ public interface NotificationManager {
/**
* Create notification tasks for each notification matching the given user id and (some of) tasks performed.
*/
- void createTasks(final AuditElements.EventCategoryType type, final String category, final String subcategory,
- final String event, final AuditElements.Result condition, final Object before, final Object output,
- final Object... input);
+ void createTasks(AuditElements.EventCategoryType type, String category, String subcategory,
+ String event, AuditElements.Result condition, Object before, Object output, Object... input);
long getMaxRetries();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
index e11c5c8..277dfc9 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
@@ -36,102 +36,102 @@ import org.apache.syncope.core.provisioning.api.WorkflowResult;
public interface PropagationManager {
/**
- * Create the role on every associated resource.
+ * Create the group on every associated resource.
*
* @param wfResult user to be propagated (and info associated), as per result from workflow
* @param vAttrs virtual attributes to be set
* @return list of propagation tasks
*/
- List<PropagationTask> getRoleCreateTaskIds(WorkflowResult<Long> wfResult, List<AttrTO> vAttrs);
+ List<PropagationTask> getGroupCreateTaskIds(WorkflowResult<Long> wfResult, List<AttrTO> vAttrs);
/**
- * Create the role on every associated resource.
+ * Create the group on every associated resource.
*
- * @param wfResult role to be propagated (and info associated), as per result from workflow
+ * @param wfResult group to be propagated (and info associated), as per result from workflow
* @param vAttrs virtual attributes to be set
* @param noPropResourceNames external resources performing not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getRoleCreateTaskIds(
+ List<PropagationTask> getGroupCreateTaskIds(
WorkflowResult<Long> wfResult, Collection<AttrTO> vAttrs, Collection<String> noPropResourceNames);
/**
- * Create the role on every associated resource.
+ * Create the group on every associated resource.
*
- * @param key role id
+ * @param key group id
* @param vAttrs virtual attributes to be set
* @param propByRes operation to be performed per resource
* @param noPropResourceNames external resources performing not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getRoleCreateTaskIds(Long key, Collection<AttrTO> vAttrs, PropagationByResource propByRes,
+ List<PropagationTask> getGroupCreateTaskIds(Long key, Collection<AttrTO> vAttrs, PropagationByResource propByRes,
Collection<String> noPropResourceNames);
/**
- * Perform delete on each resource associated to the role. It is possible to ask for a mandatory provisioning for
+ * Perform delete on each resource associated to the group. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param roleId to be deleted
+ * @param groupId to be deleted
* @return list of propagation tasks
*/
- List<PropagationTask> getRoleDeleteTaskIds(Long roleId);
+ List<PropagationTask> getGroupDeleteTaskIds(Long groupId);
/**
- * Perform delete on each resource associated to the role. It is possible to ask for a mandatory provisioning for
+ * Perform delete on each resource associated to the group. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param roleId to be deleted
+ * @param groupId to be deleted
* @param noPropResourceName name of external resource not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getRoleDeleteTaskIds(Long roleId, String noPropResourceName);
+ List<PropagationTask> getGroupDeleteTaskIds(Long groupId, String noPropResourceName);
/**
* Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param roleId to be deleted
+ * @param groupId to be deleted
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getRoleDeleteTaskIds(Long roleId, Collection<String> noPropResourceNames);
+ List<PropagationTask> getGroupDeleteTaskIds(Long groupId, Collection<String> noPropResourceNames);
/**
* Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param roleId to be deleted
+ * @param groupId to be deleted
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getRoleDeleteTaskIds(
- Long roleId, Set<String> resourceNames, Collection<String> noPropResourceNames);
+ List<PropagationTask> getGroupDeleteTaskIds(
+ Long groupId, Set<String> resourceNames, Collection<String> noPropResourceNames);
/**
- * Performs update on each resource associated to the role.
+ * Performs update on each resource associated to the group.
*
- * @param wfResult role to be propagated (and info associated), as per result from workflow
+ * @param wfResult group to be propagated (and info associated), as per result from workflow
* @param vAttrsToBeRemoved virtual attributes to be removed
* @param vAttrsToBeUpdated virtual attributes to be added
* @return list of propagation tasks
*/
- List<PropagationTask> getRoleUpdateTaskIds(WorkflowResult<Long> wfResult, Set<String> vAttrsToBeRemoved,
+ List<PropagationTask> getGroupUpdateTaskIds(WorkflowResult<Long> wfResult, Set<String> vAttrsToBeRemoved,
Set<AttrMod> vAttrsToBeUpdated);
/**
- * Performs update on each resource associated to the role.
+ * Performs update on each resource associated to the group.
*
- * @param wfResult role to be propagated (and info associated), as per result from workflow
+ * @param wfResult group to be propagated (and info associated), as per result from workflow
* @param vAttrsToBeRemoved virtual attributes to be removed
* @param vAttrsToBeUpdated virtual attributes to be added
* @param noPropResourceNames external resource names not to be considered for propagation
* @return list of propagation tasks
*/
- List<PropagationTask> getRoleUpdateTaskIds(WorkflowResult<Long> wfResult, Set<String> vAttrsToBeRemoved,
+ List<PropagationTask> getGroupUpdateTaskIds(WorkflowResult<Long> wfResult, Set<String> vAttrsToBeRemoved,
Set<AttrMod> vAttrsToBeUpdated, Set<String> noPropResourceNames);
List<PropagationTask> getUpdateTaskIds(Subject<?, ?, ?> subject, String password, boolean changePwd,
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/GroupPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/GroupPushResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/GroupPushResultHandler.java
new file mode 100644
index 0000000..d22d4e7
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/GroupPushResultHandler.java
@@ -0,0 +1,23 @@
+/*
+ * 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.provisioning.api.sync;
+
+public interface GroupPushResultHandler extends SyncopePushResultHandler {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/GroupSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/GroupSyncResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/GroupSyncResultHandler.java
new file mode 100644
index 0000000..907c29c
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/GroupSyncResultHandler.java
@@ -0,0 +1,26 @@
+/*
+ * 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.provisioning.api.sync;
+
+import java.util.Map;
+
+public interface GroupSyncResultHandler extends SyncopeSyncResultHandler {
+
+ Map<Long, String> getGroupOwnerMap();
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningProfile.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningProfile.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningProfile.java
index 3f633a4..6bab515 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningProfile.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningProfile.java
@@ -40,7 +40,7 @@ public class ProvisioningProfile<T extends ProvisioningTask, A extends Provision
private ConflictResolutionAction resAct;
- private List<A> actions = new ArrayList<>();
+ private final List<A> actions = new ArrayList<>();
public ProvisioningProfile(final Connector connector, final T task) {
this.connector = connector;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningResult.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningResult.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningResult.java
index 8061dba..a1ccabe 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningResult.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningResult.java
@@ -133,7 +133,7 @@ public class ProvisioningResult {
public static String produceReport(final Collection<ProvisioningResult> results, final TraceLevel level) {
StringBuilder sb = new StringBuilder();
for (ProvisioningResult result : results) {
- sb.append(result.getReportString(level)).append("\n");
+ sb.append(result.getReportString(level)).append('\n');
}
return sb.toString();
}
[42/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
index 2c94b8b..643da62 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
@@ -54,8 +54,8 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.VirAttrDAO;
import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
@@ -86,9 +86,11 @@ import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema;
import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.core.provisioning.java.VirAttrHandler;
-import org.apache.syncope.core.misc.MappingUtil;
-import org.apache.syncope.core.misc.jexl.JexlUtil;
+import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -101,6 +103,9 @@ abstract class AbstractAttributableDataBinder {
protected static final Logger LOG = LoggerFactory.getLogger(AbstractAttributableDataBinder.class);
@Autowired
+ protected RealmDAO realmDAO;
+
+ @Autowired
protected GroupDAO groupDAO;
@Autowired
@@ -140,11 +145,22 @@ abstract class AbstractAttributableDataBinder {
protected EntityFactory entityFactory;
@Autowired
- protected AttributableUtilFactory attrUtilFactory;
+ protected AttributableUtilsFactory attrUtilsFactory;
@Autowired
protected VirAttrHandler virtAttrHander;
+ protected void setRealm(final Subject<?, ?, ?> subject, final AbstractSubjectMod subjectMod) {
+ if (StringUtils.isNotBlank(subjectMod.getRealm())) {
+ Realm newRealm = realmDAO.find(subjectMod.getRealm());
+ if (newRealm == null) {
+ LOG.warn("Invalid realm specified: {}, ignoring", subjectMod.getRealm());
+ } else {
+ subject.setRealm(newRealm);
+ }
+ }
+ }
+
@SuppressWarnings("unchecked")
protected <T extends Schema> T getSchema(final String schemaName, final Class<T> reference) {
T result = null;
@@ -190,7 +206,7 @@ abstract class AbstractAttributableDataBinder {
return derivedSchema;
}
- protected void fillAttribute(final List<String> values, final AttributableUtil attributableUtil,
+ protected void fillAttribute(final List<String> values, final AttributableUtils attributableUtil,
final PlainSchema schema, final PlainAttr attr, final SyncopeClientException invalidValues) {
// if schema is multivalue, all values are considered for addition;
@@ -216,22 +232,22 @@ abstract class AbstractAttributableDataBinder {
}
}
- private boolean evaluateMandatoryCondition(final AttributableUtil attrUtil, final ExternalResource resource,
+ private boolean evaluateMandatoryCondition(final AttributableUtils attrUtils, final ExternalResource resource,
final Attributable<?, ?, ?> attributable, final String intAttrName, final IntMappingType intMappingType) {
boolean result = false;
- final List<MappingItem> mappings = MappingUtil.getMatchingMappingItems(
- attrUtil.getMappingItems(resource, MappingPurpose.PROPAGATION), intAttrName, intMappingType);
+ Collection<MappingItem> mappings = MappingUtils.getMatchingMappingItems(
+ attrUtils.getMappingItems(resource, MappingPurpose.PROPAGATION), intAttrName, intMappingType);
for (Iterator<MappingItem> itor = mappings.iterator(); itor.hasNext() && !result;) {
final MappingItem mapping = itor.next();
- result |= JexlUtil.evaluateMandatoryCondition(mapping.getMandatoryCondition(), attributable);
+ result |= JexlUtils.evaluateMandatoryCondition(mapping.getMandatoryCondition(), attributable);
}
return result;
}
- private boolean evaluateMandatoryCondition(final AttributableUtil attrUtil,
+ private boolean evaluateMandatoryCondition(final AttributableUtils attrUtils,
final Attributable<?, ?, ?> attributable, final String intAttrName, final IntMappingType intMappingType) {
boolean result = false;
@@ -242,7 +258,7 @@ abstract class AbstractAttributableDataBinder {
final ExternalResource resource = itor.next();
if (resource.isEnforceMandatoryCondition()) {
- result |= evaluateMandatoryCondition(attrUtil, resource, attributable, intAttrName, intMappingType);
+ result |= evaluateMandatoryCondition(attrUtils, resource, attributable, intAttrName, intMappingType);
}
}
}
@@ -250,14 +266,14 @@ abstract class AbstractAttributableDataBinder {
return result;
}
- private SyncopeClientException checkMandatory(final AttributableUtil attrUtil,
+ private SyncopeClientException checkMandatory(final AttributableUtils attrUtils,
final Attributable<?, ?, ?> attributable) {
SyncopeClientException reqValMissing = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
// Check if there is some mandatory schema defined for which no value has been provided
List<? extends PlainSchema> plainSchemas;
- switch (attrUtil.getType()) {
+ switch (attrUtils.getType()) {
case GROUP:
plainSchemas = ((Group) attributable).getAttrTemplateSchemas(GPlainAttrTemplate.class);
break;
@@ -268,14 +284,14 @@ abstract class AbstractAttributableDataBinder {
case USER:
default:
- plainSchemas = plainSchemaDAO.findAll(attrUtil.plainSchemaClass());
+ plainSchemas = plainSchemaDAO.findAll(attrUtils.plainSchemaClass());
}
for (PlainSchema schema : plainSchemas) {
if (attributable.getPlainAttr(schema.getKey()) == null
&& !schema.isReadonly()
- && (JexlUtil.evaluateMandatoryCondition(schema.getMandatoryCondition(), attributable)
- || evaluateMandatoryCondition(attrUtil, attributable, schema.getKey(),
- attrUtil.plainIntMappingType()))) {
+ && (JexlUtils.evaluateMandatoryCondition(schema.getMandatoryCondition(), attributable)
+ || evaluateMandatoryCondition(attrUtils, attributable, schema.getKey(),
+ attrUtils.plainIntMappingType()))) {
LOG.error("Mandatory schema " + schema.getKey() + " not provided with values");
@@ -284,7 +300,7 @@ abstract class AbstractAttributableDataBinder {
}
List<? extends DerSchema> derSchemas;
- switch (attrUtil.getType()) {
+ switch (attrUtils.getType()) {
case GROUP:
derSchemas = ((Group) attributable).getAttrTemplateSchemas(GDerAttrTemplate.class);
break;
@@ -295,12 +311,12 @@ abstract class AbstractAttributableDataBinder {
case USER:
default:
- derSchemas = derSchemaDAO.findAll(attrUtil.derSchemaClass());
+ derSchemas = derSchemaDAO.findAll(attrUtils.derSchemaClass());
}
for (DerSchema derSchema : derSchemas) {
if (attributable.getDerAttr(derSchema.getKey()) == null
- && evaluateMandatoryCondition(attrUtil, attributable, derSchema.getKey(),
- attrUtil.derIntMappingType())) {
+ && evaluateMandatoryCondition(attrUtils, attributable, derSchema.getKey(),
+ attrUtils.derIntMappingType())) {
LOG.error("Mandatory derived schema " + derSchema.getKey() + " does not evaluate to any value");
@@ -309,7 +325,7 @@ abstract class AbstractAttributableDataBinder {
}
List<? extends VirSchema> virSchemas;
- switch (attrUtil.getType()) {
+ switch (attrUtils.getType()) {
case GROUP:
virSchemas = ((Group) attributable).getAttrTemplateSchemas(GVirAttrTemplate.class);
break;
@@ -320,13 +336,13 @@ abstract class AbstractAttributableDataBinder {
case USER:
default:
- virSchemas = virSchemaDAO.findAll(attrUtil.virSchemaClass());
+ virSchemas = virSchemaDAO.findAll(attrUtils.virSchemaClass());
}
for (VirSchema virSchema : virSchemas) {
if (attributable.getVirAttr(virSchema.getKey()) == null
&& !virSchema.isReadonly()
- && evaluateMandatoryCondition(attrUtil, attributable, virSchema.getKey(),
- attrUtil.virIntMappingType())) {
+ && evaluateMandatoryCondition(attrUtils, attributable, virSchema.getKey(),
+ attrUtils.virIntMappingType())) {
LOG.error("Mandatory virtual schema " + virSchema.getKey() + " not provided with values");
@@ -379,7 +395,7 @@ abstract class AbstractAttributableDataBinder {
@SuppressWarnings({ "unchecked", "rawtypes" })
protected PropagationByResource fill(final Attributable attributable,
- final AbstractAttributableMod attributableMod, final AttributableUtil attrUtil,
+ final AbstractAttributableMod attributableMod, final AttributableUtils attrUtils,
final SyncopeClientCompositeException scce) {
PropagationByResource propByRes = new PropagationByResource();
@@ -420,7 +436,7 @@ abstract class AbstractAttributableDataBinder {
// 3. attributes to be removed
for (String attributeToBeRemoved : attributableMod.getPlainAttrsToRemove()) {
- PlainSchema schema = getPlainSchema(attributeToBeRemoved, attrUtil.plainSchemaClass());
+ PlainSchema schema = getPlainSchema(attributeToBeRemoved, attrUtils.plainSchemaClass());
if (schema != null) {
PlainAttr attr = attributable.getPlainAttr(schema.getKey());
if (attr == null) {
@@ -437,15 +453,15 @@ abstract class AbstractAttributableDataBinder {
|| (!attr.getUniqueValue().getStringValue().equals(newValue))) {
attributable.removePlainAttr(attr);
- plainAttrDAO.delete(attr.getKey(), attrUtil.plainAttrClass());
+ plainAttrDAO.delete(attr.getKey(), attrUtils.plainAttrClass());
}
}
if (attributable instanceof Subject) {
for (ExternalResource resource : externalResources) {
- for (MappingItem mapItem : attrUtil.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
+ for (MappingItem mapItem : attrUtils.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
if (schema.getKey().equals(mapItem.getIntAttrName())
- && mapItem.getIntMappingType() == attrUtil.plainIntMappingType()) {
+ && mapItem.getIntMappingType() == attrUtils.plainIntMappingType()) {
propByRes.add(ResourceOperation.UPDATE, resource.getKey());
@@ -463,12 +479,12 @@ abstract class AbstractAttributableDataBinder {
// 4. attributes to be updated
for (AttrMod attributeMod : attributableMod.getPlainAttrsToUpdate()) {
- PlainSchema schema = getPlainSchema(attributeMod.getSchema(), attrUtil.plainSchemaClass());
+ PlainSchema schema = getPlainSchema(attributeMod.getSchema(), attrUtils.plainSchemaClass());
PlainAttr attr = null;
if (schema != null) {
attr = attributable.getPlainAttr(schema.getKey());
if (attr == null) {
- attr = attrUtil.newPlainAttr();
+ attr = attrUtils.newPlainAttr();
setPlainAttrSchema(attributable, attr, schema);
if (attr.getSchema() == null) {
LOG.debug("Ignoring {} because no valid schema or template was found", attributeMod);
@@ -481,10 +497,10 @@ abstract class AbstractAttributableDataBinder {
if (schema != null && attr != null && attr.getSchema() != null) {
if (attributable instanceof Subject) {
- virtAttrHander.updateOnResourcesIfMappingMatches(attrUtil, schema.getKey(),
- externalResources, attrUtil.plainIntMappingType(), propByRes);
+ virtAttrHander.updateOnResourcesIfMappingMatches(attrUtils, schema.getKey(),
+ externalResources, attrUtils.plainIntMappingType(), propByRes);
} else if (attributable instanceof Membership) {
- virtAttrHander.updateOnResourcesIfMappingMatches(attrUtil, schema.getKey(),
+ virtAttrHander.updateOnResourcesIfMappingMatches(attrUtils, schema.getKey(),
externalResources, IntMappingType.MembershipPlainSchema, propByRes);
}
@@ -506,7 +522,7 @@ abstract class AbstractAttributableDataBinder {
}
}
for (Long attributeValueId : valuesToBeRemoved) {
- plainAttrValueDAO.delete(attributeValueId, attrUtil.plainAttrValueClass());
+ plainAttrValueDAO.delete(attributeValueId, attrUtils.plainAttrValueClass());
}
// 1.2 add values
@@ -515,7 +531,7 @@ abstract class AbstractAttributableDataBinder {
&& (!schema.isUniqueConstraint() || attr.getUniqueValue() == null
|| !valuesToBeAdded.iterator().next().equals(attr.getUniqueValue().getValueAsString()))) {
- fillAttribute(attributeMod.getValuesToBeAdded(), attrUtil, schema, attr, invalidValues);
+ fillAttribute(attributeMod.getValuesToBeAdded(), attrUtils, schema, attr, invalidValues);
}
// if no values are in, the attribute can be safely removed
@@ -533,7 +549,7 @@ abstract class AbstractAttributableDataBinder {
// 5. derived attributes to be removed
for (String derAttrToBeRemoved : attributableMod.getDerAttrsToRemove()) {
- DerSchema derSchema = getDerSchema(derAttrToBeRemoved, attrUtil.derSchemaClass());
+ DerSchema derSchema = getDerSchema(derAttrToBeRemoved, attrUtils.derSchemaClass());
if (derSchema != null) {
DerAttr derAttr = attributable.getDerAttr(derSchema.getKey());
if (derAttr == null) {
@@ -544,9 +560,9 @@ abstract class AbstractAttributableDataBinder {
if (attributable instanceof Subject) {
for (ExternalResource resource : externalResources) {
- for (MappingItem mapItem : attrUtil.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
+ for (MappingItem mapItem : attrUtils.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
if (derSchema.getKey().equals(mapItem.getIntAttrName())
- && mapItem.getIntMappingType() == attrUtil.derIntMappingType()) {
+ && mapItem.getIntMappingType() == attrUtils.derIntMappingType()) {
propByRes.add(ResourceOperation.UPDATE, resource.getKey());
@@ -567,17 +583,17 @@ abstract class AbstractAttributableDataBinder {
// 6. derived attributes to be added
for (String derAttrToBeAdded : attributableMod.getDerAttrsToAdd()) {
- DerSchema derSchema = getDerSchema(derAttrToBeAdded, attrUtil.derSchemaClass());
+ DerSchema derSchema = getDerSchema(derAttrToBeAdded, attrUtils.derSchemaClass());
if (derSchema != null) {
if (attributable instanceof Subject) {
- virtAttrHander.updateOnResourcesIfMappingMatches(attrUtil, derSchema.getKey(),
- externalResources, attrUtil.derIntMappingType(), propByRes);
+ virtAttrHander.updateOnResourcesIfMappingMatches(attrUtils, derSchema.getKey(),
+ externalResources, attrUtils.derIntMappingType(), propByRes);
} else if (attributable instanceof Membership) {
- virtAttrHander.updateOnResourcesIfMappingMatches(attrUtil, derSchema.getKey(),
+ virtAttrHander.updateOnResourcesIfMappingMatches(attrUtils, derSchema.getKey(),
externalResources, IntMappingType.MembershipDerivedSchema, propByRes);
}
- DerAttr derAttr = attrUtil.newDerAttr();
+ DerAttr derAttr = attrUtils.newDerAttr();
setDerAttrSchema(attributable, derAttr, derSchema);
if (derAttr.getSchema() == null) {
LOG.debug("Ignoring {} because no valid schema or template was found", derAttrToBeAdded);
@@ -591,13 +607,13 @@ abstract class AbstractAttributableDataBinder {
LOG.debug("Derived attributes to be added:\n{}", propByRes);
// 7. virtual attributes: for users and groups this is delegated to PropagationManager
- if (AttributableType.USER != attrUtil.getType() && AttributableType.GROUP != attrUtil.getType()) {
+ if (AttributableType.USER != attrUtils.getType() && AttributableType.GROUP != attrUtils.getType()) {
virtAttrHander.fillVirtual(attributable, attributableMod.getVirAttrsToRemove(),
- attributableMod.getVirAttrsToUpdate(), attrUtil);
+ attributableMod.getVirAttrsToUpdate(), attrUtils);
}
// Finally, check if mandatory values are missing
- SyncopeClientException requiredValuesMissing = checkMandatory(attrUtil, attributable);
+ SyncopeClientException requiredValuesMissing = checkMandatory(attrUtils, attributable);
if (!requiredValuesMissing.isEmpty()) {
scce.addException(requiredValuesMissing);
}
@@ -612,7 +628,7 @@ abstract class AbstractAttributableDataBinder {
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void fill(final Attributable attributable, final AbstractAttributableTO attributableTO,
- final AttributableUtil attrUtil, final SyncopeClientCompositeException scce) {
+ final AttributableUtils attrUtils, final SyncopeClientCompositeException scce) {
// 1. attributes
SyncopeClientException invalidValues = SyncopeClientException.build(ClientExceptionType.InvalidValues);
@@ -620,18 +636,18 @@ abstract class AbstractAttributableDataBinder {
// Only consider attributeTO with values
for (AttrTO attributeTO : attributableTO.getPlainAttrs()) {
if (attributeTO.getValues() != null && !attributeTO.getValues().isEmpty()) {
- PlainSchema schema = getPlainSchema(attributeTO.getSchema(), attrUtil.plainSchemaClass());
+ PlainSchema schema = getPlainSchema(attributeTO.getSchema(), attrUtils.plainSchemaClass());
if (schema != null) {
PlainAttr attr = attributable.getPlainAttr(schema.getKey());
if (attr == null) {
- attr = attrUtil.newPlainAttr();
+ attr = attrUtils.newPlainAttr();
setPlainAttrSchema(attributable, attr, schema);
}
if (attr.getSchema() == null) {
LOG.debug("Ignoring {} because no valid schema or template was found", attributeTO);
} else {
- fillAttribute(attributeTO.getValues(), attrUtil, schema, attr, invalidValues);
+ fillAttribute(attributeTO.getValues(), attrUtils, schema, attr, invalidValues);
if (!attr.getValuesAsStrings().isEmpty()) {
attributable.addPlainAttr(attr);
@@ -648,10 +664,10 @@ abstract class AbstractAttributableDataBinder {
// 2. derived attributes
for (AttrTO attributeTO : attributableTO.getDerAttrs()) {
- DerSchema derSchema = getDerSchema(attributeTO.getSchema(), attrUtil.derSchemaClass());
+ DerSchema derSchema = getDerSchema(attributeTO.getSchema(), attrUtils.derSchemaClass());
if (derSchema != null) {
- DerAttr derAttr = attrUtil.newDerAttr();
+ DerAttr derAttr = attrUtils.newDerAttr();
setDerAttrSchema(attributable, derAttr, derSchema);
if (derAttr.getSchema() == null) {
LOG.debug("Ignoring {} because no valid schema or template was found", attributeTO);
@@ -663,12 +679,12 @@ abstract class AbstractAttributableDataBinder {
}
// 3. user and group virtual attributes will be evaluated by the propagation manager only (if needed).
- if (AttributableType.USER == attrUtil.getType() || AttributableType.GROUP == attrUtil.getType()) {
+ if (AttributableType.USER == attrUtils.getType() || AttributableType.GROUP == attrUtils.getType()) {
for (AttrTO vattrTO : attributableTO.getVirAttrs()) {
- VirSchema virSchema = virtAttrHander.getVirSchema(vattrTO.getSchema(), attrUtil.virSchemaClass());
+ VirSchema virSchema = virtAttrHander.getVirSchema(vattrTO.getSchema(), attrUtils.virSchemaClass());
if (virSchema != null) {
- VirAttr virAttr = attrUtil.newVirAttr();
+ VirAttr virAttr = attrUtils.newVirAttr();
virtAttrHander.setVirAttrSchema(attributable, virAttr, virSchema);
if (virAttr.getSchema() == null) {
LOG.debug("Ignoring {} because no valid schema or template was found", vattrTO);
@@ -680,10 +696,19 @@ abstract class AbstractAttributableDataBinder {
}
}
- virtAttrHander.fillVirtual(attributable, attributableTO.getVirAttrs(), attrUtil);
+ virtAttrHander.fillVirtual(attributable, attributableTO.getVirAttrs(), attrUtils);
- // 4. resources
+ // 4. realm & resources
if (attributable instanceof Subject && attributableTO instanceof AbstractSubjectTO) {
+ Realm realm = realmDAO.find(((AbstractSubjectTO) attributableTO).getRealm());
+ if (realm == null) {
+ SyncopeClientException noRealm = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
+ noRealm.getElements().add(
+ "Invalid or null realm specified: " + ((AbstractSubjectTO) attributableTO).getRealm());
+ scce.addException(noRealm);
+ }
+ ((Subject<?, ?, ?>) attributable).setRealm(realm);
+
for (String resourceName : ((AbstractSubjectTO) attributableTO).getResources()) {
ExternalResource resource = resourceDAO.find(resourceName);
@@ -693,7 +718,7 @@ abstract class AbstractAttributableDataBinder {
}
}
- SyncopeClientException requiredValuesMissing = checkMandatory(attrUtil, attributable);
+ SyncopeClientException requiredValuesMissing = checkMandatory(attrUtils, attributable);
if (!requiredValuesMissing.isEmpty()) {
scce.addException(requiredValuesMissing);
}
@@ -705,6 +730,7 @@ abstract class AbstractAttributableDataBinder {
}
protected void fillTO(final AbstractAttributableTO attributableTO,
+ final String realmFullPath,
final Collection<? extends PlainAttr> attrs,
final Collection<? extends DerAttr> derAttrs,
final Collection<? extends VirAttr> virAttrs,
@@ -739,8 +765,10 @@ abstract class AbstractAttributableDataBinder {
}
if (attributableTO instanceof AbstractSubjectTO) {
+ AbstractSubjectTO subjectTO = AbstractSubjectTO.class.cast(attributableTO);
+ subjectTO.setRealm(realmFullPath);
for (ExternalResource resource : resources) {
- ((AbstractSubjectTO) attributableTO).getResources().add(resource.getKey());
+ subjectTO.getResources().add(resource.getKey());
}
}
}
@@ -752,14 +780,14 @@ abstract class AbstractAttributableDataBinder {
if ((type == AttributableType.USER && resource.getUmapping() != null)
|| (type == AttributableType.GROUP && resource.getGmapping() != null)) {
- MappingItem accountIdItem = attrUtilFactory.getInstance(type).getAccountIdItem(resource);
+ MappingItem accountIdItem = attrUtilsFactory.getInstance(type).getAccountIdItem(resource);
if (accountIdItem == null) {
throw new NotFoundException(
"AccountId mapping for " + type + " " + subject.getKey()
+ " on resource '" + resource.getKey() + "'");
}
- accountIds.put(resource.getKey(), MappingUtil.getAccountIdValue(subject, resource, accountIdItem));
+ accountIds.put(resource.getKey(), MappingUtils.getAccountIdValue(subject, resource, accountIdItem));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConfigurationDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConfigurationDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConfigurationDataBinderImpl.java
index f1d9020..5e2dc1b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConfigurationDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConfigurationDataBinderImpl.java
@@ -40,7 +40,7 @@ public class ConfigurationDataBinderImpl extends AbstractAttributableDataBinder
final ConfTO confTO = new ConfTO();
confTO.setKey(conf.getKey());
- fillTO(confTO, conf.getPlainAttrs(),
+ fillTO(confTO, null, conf.getPlainAttrs(),
conf.getDerAttrs(), conf.getVirAttrs(), Collections.<ExternalResource>emptySet());
return confTO;
@@ -66,7 +66,7 @@ public class ConfigurationDataBinderImpl extends AbstractAttributableDataBinder
CPlainAttr attr = entityFactory.newEntity(CPlainAttr.class);
attr.setSchema(schema);
- fillAttribute(attributeTO.getValues(), attrUtilFactory.getInstance(AttributableType.CONFIGURATION),
+ fillAttribute(attributeTO.getValues(), attrUtilsFactory.getInstance(AttributableType.CONFIGURATION),
schema, attr, invalidValues);
if (!invalidValues.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
index fbb687e..3666d8f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
@@ -22,8 +22,9 @@ import org.apache.syncope.core.provisioning.api.data.ConnInstanceDataBinder;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.to.ConnPoolConfTO;
@@ -34,7 +35,7 @@ import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
-import org.apache.syncope.core.provisioning.api.ConnPoolConfUtil;
+import org.apache.syncope.core.provisioning.api.ConnPoolConfUtils;
import org.identityconnectors.framework.api.ConfigurationProperties;
import org.identityconnectors.framework.api.ConfigurationProperty;
import org.identityconnectors.framework.impl.api.ConfigurationPropertyImpl;
@@ -116,7 +117,7 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
}
if (connInstanceTO.getPoolConf() != null) {
connInstance.setPoolConf(
- ConnPoolConfUtil.getConnPoolConf(connInstanceTO.getPoolConf(), entityFactory.newConnPoolConf()));
+ ConnPoolConfUtils.getConnPoolConf(connInstanceTO.getPoolConf(), entityFactory.newConnPoolConf()));
}
// Throw exception if there is at least one element set
@@ -171,7 +172,7 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
connInstance.setPoolConf(null);
} else {
connInstance.setPoolConf(
- ConnPoolConfUtil.getConnPoolConf(connInstanceTO.getPoolConf(), entityFactory.newConnPoolConf()));
+ ConnPoolConfUtils.getConnPoolConf(connInstanceTO.getPoolConf(), entityFactory.newConnPoolConf()));
}
if (!sce.isEmpty()) {
@@ -211,29 +212,31 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
ConnInstanceTO connInstanceTO = new ConnInstanceTO();
connInstanceTO.setKey(connInstance.getKey() == null ? 0L : connInstance.getKey());
- // retrieve the ConfigurationProperties
- ConfigurationProperties properties = connIdBundleManager.getConfigurationProperties(
- connIdBundleManager.getConnectorInfo(connInstance.getLocation(),
- connInstance.getBundleName(), connInstance.getVersion(), connInstance.getConnectorName()));
-
BeanUtils.copyProperties(connInstance, connInstanceTO, IGNORE_PROPERTIES);
- final Map<String, ConnConfProperty> connInstanceToConfMap = connInstanceTO.getConfigurationMap();
-
- for (String propName : properties.getPropertyNames()) {
+ // refresh stored properties in the given connInstance with direct information from underlying connector
+ ConfigurationProperties properties =
+ connIdBundleManager.getConfigurationProperties(connIdBundleManager.getConnectorInfo(connInstance));
+ for (final String propName : properties.getPropertyNames()) {
ConnConfPropSchema schema = buildConnConfPropSchema(properties.getProperty(propName));
- ConnConfProperty property;
- if (connInstanceToConfMap.containsKey(propName)) {
- property = connInstanceToConfMap.get(propName);
- } else {
+ ConnConfProperty property = CollectionUtils.find(connInstanceTO.getConfiguration(),
+ new Predicate<ConnConfProperty>() {
+
+ @Override
+ public boolean evaluate(final ConnConfProperty candidate) {
+ return propName.equals(candidate.getSchema().getName());
+ }
+ });
+ if (property == null) {
property = new ConnConfProperty();
connInstanceTO.getConfiguration().add(property);
}
-
+
property.setSchema(schema);
}
+ // pool configuration
if (connInstance.getPoolConf() != null) {
ConnPoolConfTO poolConf = new ConnPoolConfTO();
BeanUtils.copyProperties(connInstance.getPoolConf(), poolConf);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/GroupDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/GroupDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/GroupDataBinderImpl.java
index 4a5ed5f..6cadc9d 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/GroupDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/GroupDataBinderImpl.java
@@ -18,6 +18,8 @@
*/
package org.apache.syncope.core.provisioning.java.data;
+import static org.apache.syncope.core.provisioning.java.data.AbstractAttributableDataBinder.LOG;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -28,11 +30,7 @@ import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Schema;
import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
@@ -40,20 +38,17 @@ import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTempl
import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
-import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
-import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
-import org.apache.syncope.core.misc.ConnObjectUtil;
+import org.apache.syncope.core.misc.ConnObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -63,10 +58,7 @@ import org.springframework.transaction.annotation.Transactional;
public class GroupDataBinderImpl extends AbstractAttributableDataBinder implements GroupDataBinder {
@Autowired
- private ConnObjectUtil connObjectUtil;
-
- @Autowired
- private EntitlementDAO entitlementDAO;
+ private ConnObjectUtils connObjectUtils;
private <T extends AttrTemplate<S>, S extends Schema> void setAttrTemplates(
final Group group, final List<String> schemaNames,
@@ -99,20 +91,9 @@ public class GroupDataBinderImpl extends AbstractAttributableDataBinder implemen
@Override
public Group create(final Group group, final GroupTO groupTO) {
- group.setInheritOwner(groupTO.isInheritOwner());
-
- group.setInheritPlainAttrs(groupTO.isInheritPlainAttrs());
- group.setInheritDerAttrs(groupTO.isInheritDerAttrs());
- group.setInheritVirAttrs(groupTO.isInheritVirAttrs());
-
- group.setInheritTemplates(groupTO.isInheritTemplates());
-
- group.setInheritPasswordPolicy(groupTO.isInheritPasswordPolicy());
- group.setInheritAccountPolicy(groupTO.isInheritAccountPolicy());
-
SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
- // name and parent
+ // name
SyncopeClientException invalidGroups = SyncopeClientException.build(ClientExceptionType.InvalidGroups);
if (groupTO.getName() == null) {
LOG.error("No name specified for this group");
@@ -121,26 +102,6 @@ public class GroupDataBinderImpl extends AbstractAttributableDataBinder implemen
} else {
group.setName(groupTO.getName());
}
- Long parentGroupKey = null;
- if (groupTO.getParent() != 0) {
- Group parentGroup = groupDAO.find(groupTO.getParent());
- if (parentGroup == null) {
- LOG.error("Could not find group with id " + groupTO.getParent());
-
- invalidGroups.getElements().add(String.valueOf(groupTO.getParent()));
- scce.addException(invalidGroups);
- } else {
- group.setParent(parentGroup);
- parentGroupKey = group.getParent().getKey();
- }
- }
-
- Group otherGroup = groupDAO.find(groupTO.getName(), parentGroupKey);
- if (otherGroup != null) {
- LOG.error("Another group exists with the same name and the same parent group: " + otherGroup);
-
- invalidGroups.getElements().add(groupTO.getName());
- }
// attribute templates
setAttrTemplates(group, groupTO.getGPlainAttrTemplates(), GPlainAttrTemplate.class, GPlainSchema.class);
@@ -151,17 +112,7 @@ public class GroupDataBinderImpl extends AbstractAttributableDataBinder implemen
setAttrTemplates(group, groupTO.getMVirAttrTemplates(), MVirAttrTemplate.class, MVirSchema.class);
// attributes, derived attributes, virtual attributes and resources
- fill(group, groupTO, attrUtilFactory.getInstance(AttributableType.GROUP), scce);
-
- // entitlements
- for (String entitlementName : groupTO.getEntitlements()) {
- Entitlement entitlement = entitlementDAO.find(entitlementName);
- if (entitlement == null) {
- LOG.warn("Ignoring invalid entitlement {}", entitlementName);
- } else {
- group.addEntitlement(entitlement);
- }
- }
+ fill(group, groupTO, attrUtilsFactory.getInstance(AttributableType.GROUP), scce);
// owner
if (groupTO.getUserOwner() != null) {
@@ -181,19 +132,14 @@ public class GroupDataBinderImpl extends AbstractAttributableDataBinder implemen
}
}
- // policies
- if (groupTO.getPasswordPolicy() != null) {
- group.setPasswordPolicy((PasswordPolicy) policyDAO.find(groupTO.getPasswordPolicy()));
- }
- if (groupTO.getAccountPolicy() != null) {
- group.setAccountPolicy((AccountPolicy) policyDAO.find(groupTO.getAccountPolicy()));
- }
-
return group;
}
@Override
- public PropagationByResource update(final Group group, final GroupMod groupMod) {
+ public PropagationByResource update(final Group toBeUpdated, final GroupMod groupMod) {
+ // Re-merge any pending change from workflow tasks
+ Group group = groupDAO.save(toBeUpdated);
+
PropagationByResource propByRes = new PropagationByResource();
SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
@@ -201,72 +147,24 @@ public class GroupDataBinderImpl extends AbstractAttributableDataBinder implemen
// fetch account ids before update
Map<String, String> oldAccountIds = getAccountIds(group, AttributableType.GROUP);
+ // realm
+ setRealm(group, groupMod);
// name
- SyncopeClientException invalidGroups = SyncopeClientException.build(ClientExceptionType.InvalidGroups);
- if (groupMod.getName() != null) {
- Group otherGroup = groupDAO.find(groupMod.getName(),
- group.getParent() == null ? null : group.getParent().getKey());
- if (otherGroup == null || group.equals(otherGroup)) {
- if (!groupMod.getName().equals(group.getName())) {
- propByRes.addAll(ResourceOperation.UPDATE, group.getResourceNames());
-
- group.setName(groupMod.getName());
- }
- } else {
- LOG.error("Another group exists with the same name and the same parent group: " + otherGroup);
-
- invalidGroups.getElements().add(groupMod.getName());
- scce.addException(invalidGroups);
- }
- }
-
- if (groupMod.getInheritOwner() != null) {
- group.setInheritOwner(groupMod.getInheritOwner());
- }
-
- if (groupMod.getInheritTemplates() != null) {
- group.setInheritTemplates(groupMod.getInheritTemplates());
- }
-
- if (groupMod.getInheritPlainAttrs() != null) {
- group.setInheritPlainAttrs(groupMod.getInheritPlainAttrs());
- }
- if (groupMod.getInheritDerAttrs() != null) {
- group.setInheritDerAttrs(groupMod.getInheritDerAttrs());
- }
- if (groupMod.getInheritVirAttrs() != null) {
- group.setInheritVirAttrs(groupMod.getInheritVirAttrs());
- }
+ if (groupMod.getName() != null && !groupMod.getName().equals(group.getName())) {
+ propByRes.addAll(ResourceOperation.UPDATE, group.getResourceNames());
- if (groupMod.getInheritPasswordPolicy() != null) {
- group.setInheritPasswordPolicy(groupMod.getInheritPasswordPolicy());
- }
- if (groupMod.getInheritAccountPolicy() != null) {
- group.setInheritAccountPolicy(groupMod.getInheritAccountPolicy());
- }
-
- // entitlements
- if (groupMod.isModEntitlements()) {
- group.getEntitlements().clear();
- for (String entitlementName : groupMod.getEntitlements()) {
- Entitlement entitlement = entitlementDAO.find(entitlementName);
- if (entitlement == null) {
- LOG.warn("Ignoring invalid entitlement {}", entitlementName);
- } else {
- group.addEntitlement(entitlement);
- }
- }
+ group.setName(groupMod.getName());
}
// attribute templates
- if (groupMod.isModRAttrTemplates()) {
- setAttrTemplates(group, groupMod.getRPlainAttrTemplates(), GPlainAttrTemplate.class, GPlainSchema.class);
+ if (groupMod.isModGAttrTemplates()) {
+ setAttrTemplates(group, groupMod.getGPlainAttrTemplates(), GPlainAttrTemplate.class, GPlainSchema.class);
}
- if (groupMod.isModRDerAttrTemplates()) {
- setAttrTemplates(group, groupMod.getRDerAttrTemplates(), GDerAttrTemplate.class, GDerSchema.class);
+ if (groupMod.isModGDerAttrTemplates()) {
+ setAttrTemplates(group, groupMod.getGDerAttrTemplates(), GDerAttrTemplate.class, GDerSchema.class);
}
- if (groupMod.isModRVirAttrTemplates()) {
- setAttrTemplates(group, groupMod.getRVirAttrTemplates(), GVirAttrTemplate.class, GVirSchema.class);
+ if (groupMod.isModGVirAttrTemplates()) {
+ setAttrTemplates(group, groupMod.getGVirAttrTemplates(), GVirAttrTemplate.class, GVirSchema.class);
}
if (groupMod.isModMAttrTemplates()) {
setAttrTemplates(group, groupMod.getMPlainAttrTemplates(), MPlainAttrTemplate.class, MPlainSchema.class);
@@ -278,18 +176,6 @@ public class GroupDataBinderImpl extends AbstractAttributableDataBinder implemen
setAttrTemplates(group, groupMod.getMVirAttrTemplates(), MVirAttrTemplate.class, MVirSchema.class);
}
- // policies
- if (groupMod.getPasswordPolicy() != null) {
- group.setPasswordPolicy(groupMod.getPasswordPolicy().getKey() == null
- ? null
- : (PasswordPolicy) policyDAO.find(groupMod.getPasswordPolicy().getKey()));
- }
- if (groupMod.getAccountPolicy() != null) {
- group.setAccountPolicy(groupMod.getAccountPolicy().getKey() == null
- ? null
- : (AccountPolicy) policyDAO.find(groupMod.getAccountPolicy().getKey()));
- }
-
// owner
if (groupMod.getUserOwner() != null) {
group.setUserOwner(groupMod.getUserOwner().getKey() == null
@@ -303,7 +189,7 @@ public class GroupDataBinderImpl extends AbstractAttributableDataBinder implemen
}
// attributes, derived attributes, virtual attributes and resources
- propByRes.merge(fill(group, groupMod, attrUtilFactory.getInstance(AttributableType.GROUP), scce));
+ propByRes.merge(fill(group, groupMod, attrUtilsFactory.getInstance(AttributableType.GROUP), scce));
// check if some account id was changed by the update above
Map<String, String> newAccountIds = getAccountIds(group, AttributableType.GROUP);
@@ -323,7 +209,7 @@ public class GroupDataBinderImpl extends AbstractAttributableDataBinder implemen
@Transactional(readOnly = true)
@Override
public GroupTO getGroupTO(final Group group) {
- connObjectUtil.retrieveVirAttrValues(group, attrUtilFactory.getInstance(AttributableType.GROUP));
+ connObjectUtils.retrieveVirAttrValues(group, attrUtilsFactory.getInstance(AttributableType.GROUP));
GroupTO groupTO = new GroupTO();
@@ -336,21 +222,6 @@ public class GroupDataBinderImpl extends AbstractAttributableDataBinder implemen
groupTO.setKey(group.getKey());
groupTO.setName(group.getName());
- groupTO.setInheritOwner(group.isInheritOwner());
-
- groupTO.setInheritTemplates(group.isInheritTemplates());
-
- groupTO.setInheritPlainAttrs(group.isInheritPlainAttrs());
- groupTO.setInheritDerAttrs(group.isInheritDerAttrs());
- groupTO.setInheritVirAttrs(group.isInheritVirAttrs());
-
- groupTO.setInheritPasswordPolicy(group.isInheritPasswordPolicy());
- groupTO.setInheritAccountPolicy(group.isInheritAccountPolicy());
-
- if (group.getParent() != null) {
- groupTO.setParent(group.getParent().getKey());
- }
-
if (group.getUserOwner() != null) {
groupTO.setUserOwner(group.getUserOwner().getKey());
}
@@ -358,48 +229,28 @@ public class GroupDataBinderImpl extends AbstractAttributableDataBinder implemen
groupTO.setGroupOwner(group.getGroupOwner().getKey());
}
- // -------------------------
- // Retrieve all [derived/virtual] attributes (inherited and not)
- // -------------------------
- final List<? extends GPlainAttr> allAttributes = group.findLastInheritedAncestorPlainAttrs();
-
- final List<? extends GDerAttr> allDerAttributes = group.findLastInheritedAncestorDerAttrs();
-
- final List<? extends GVirAttr> allVirAttributes = group.findLastInheritedAncestorVirAttrs();
- // -------------------------
-
- fillTO(groupTO, allAttributes, allDerAttributes, allVirAttributes, group.getResources());
+ fillTO(groupTO, group.getRealm().getFullPath(),
+ group.getPlainAttrs(), group.getDerAttrs(), group.getVirAttrs(), group.getResources());
- for (Entitlement entitlement : group.getEntitlements()) {
- groupTO.getEntitlements().add(entitlement.getKey());
- }
-
- for (GPlainAttrTemplate template : group.findInheritedTemplates(GPlainAttrTemplate.class)) {
+ for (GPlainAttrTemplate template : group.getAttrTemplates(GPlainAttrTemplate.class)) {
groupTO.getGPlainAttrTemplates().add(template.getSchema().getKey());
}
- for (GDerAttrTemplate template : group.findInheritedTemplates(GDerAttrTemplate.class)) {
+ for (GDerAttrTemplate template : group.getAttrTemplates(GDerAttrTemplate.class)) {
groupTO.getGDerAttrTemplates().add(template.getSchema().getKey());
}
- for (GVirAttrTemplate template : group.findInheritedTemplates(GVirAttrTemplate.class)) {
+ for (GVirAttrTemplate template : group.getAttrTemplates(GVirAttrTemplate.class)) {
groupTO.getGVirAttrTemplates().add(template.getSchema().getKey());
}
- for (MPlainAttrTemplate template : group.findInheritedTemplates(MPlainAttrTemplate.class)) {
+ for (MPlainAttrTemplate template : group.getAttrTemplates(MPlainAttrTemplate.class)) {
groupTO.getMPlainAttrTemplates().add(template.getSchema().getKey());
}
- for (MDerAttrTemplate template : group.findInheritedTemplates(MDerAttrTemplate.class)) {
+ for (MDerAttrTemplate template : group.getAttrTemplates(MDerAttrTemplate.class)) {
groupTO.getMDerAttrTemplates().add(template.getSchema().getKey());
}
- for (MVirAttrTemplate template : group.findInheritedTemplates(MVirAttrTemplate.class)) {
+ for (MVirAttrTemplate template : group.getAttrTemplates(MVirAttrTemplate.class)) {
groupTO.getMVirAttrTemplates().add(template.getSchema().getKey());
}
- groupTO.setPasswordPolicy(group.getPasswordPolicy() == null
- ? null
- : group.getPasswordPolicy().getKey());
- groupTO.setAccountPolicy(group.getAccountPolicy() == null
- ? null
- : group.getAccountPolicy().getKey());
-
return groupTO;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
index 1f0e308..3800adb 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
@@ -29,14 +29,14 @@ import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.PasswordPolicySpec;
import org.apache.syncope.common.lib.types.SyncPolicySpec;
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.RealmDAO;
import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Policy;
+import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -54,40 +54,31 @@ public class PolicyDataBinderImpl implements PolicyDataBinder {
private ExternalResourceDAO resourceDAO;
@Autowired
- private GroupDAO groupDAO;
+ private RealmDAO realmDAO;
@Autowired
private EntityFactory entityFactory;
- /**
- * Get policy TO from policy bean.
- *
- * @param policy bean.
- * @return policy TO.
- */
@SuppressWarnings("unchecked")
@Override
public <T extends AbstractPolicyTO> T getPolicyTO(final Policy policy) {
final T policyTO;
switch (policy.getType()) {
- case GLOBAL_PASSWORD:
case PASSWORD:
- policyTO = (T) new PasswordPolicyTO(policy.getType().isGlobal());
+ policyTO = (T) new PasswordPolicyTO();
((PasswordPolicyTO) policyTO).setSpecification(policy.getSpecification(PasswordPolicySpec.class));
break;
- case GLOBAL_ACCOUNT:
case ACCOUNT:
- policyTO = (T) new AccountPolicyTO(policy.getType().isGlobal());
+ policyTO = (T) new AccountPolicyTO();
((AccountPolicyTO) policyTO).setSpecification(policy.getSpecification(AccountPolicySpec.class));
((AccountPolicyTO) policyTO).getResources().addAll(((AccountPolicy) policy).getResourceNames());
break;
- case GLOBAL_SYNC:
case SYNC:
default:
- policyTO = (T) new SyncPolicyTO(policy.getType().isGlobal());
+ policyTO = (T) new SyncPolicyTO();
((SyncPolicyTO) policyTO).setSpecification(policy.getSpecification(SyncPolicySpec.class));
}
@@ -97,18 +88,8 @@ public class PolicyDataBinderImpl implements PolicyDataBinder {
for (ExternalResource resource : resourceDAO.findByPolicy(policy)) {
policyTO.getUsedByResources().add(resource.getKey());
}
- if (policy.getType().isGlobal()) {
- for (ExternalResource resource : resourceDAO.findWithoutPolicy(policy.getType())) {
- policyTO.getUsedByResources().add(resource.getKey());
- }
- }
- for (Group group : groupDAO.findByPolicy(policy)) {
- policyTO.getUsedByGroups().add(group.getKey());
- }
- if (policy.getType().isGlobal()) {
- for (Group group : groupDAO.findWithoutPolicy(policy.getType())) {
- policyTO.getUsedByGroups().add(group.getKey());
- }
+ for (Realm realm : realmDAO.findByPolicy(policy)) {
+ policyTO.getUsedByRealms().add(realm.getFullPath());
}
return policyTO;
@@ -133,26 +114,24 @@ public class PolicyDataBinderImpl implements PolicyDataBinder {
}
switch (policyTO.getType()) {
- case GLOBAL_PASSWORD:
case PASSWORD:
if (!(policyTO instanceof PasswordPolicyTO)) {
throw new ClassCastException("Expected " + PasswordPolicyTO.class.getName()
+ ", found " + policyTO.getClass().getName());
}
if (policy == null) {
- policy = (T) entityFactory.newPolicy(PasswordPolicy.class, policyTO.getType().isGlobal());
+ policy = (T) entityFactory.newEntity(PasswordPolicy.class);
}
policy.setSpecification(((PasswordPolicyTO) policyTO).getSpecification());
break;
- case GLOBAL_ACCOUNT:
case ACCOUNT:
if (!(policyTO instanceof AccountPolicyTO)) {
throw new ClassCastException("Expected " + AccountPolicyTO.class.getName()
+ ", found " + policyTO.getClass().getName());
}
if (policy == null) {
- policy = (T) entityFactory.newPolicy(AccountPolicy.class, policyTO.getType().isGlobal());
+ policy = (T) entityFactory.newEntity(AccountPolicy.class);
}
policy.setSpecification(((AccountPolicyTO) policyTO).getSpecification());
@@ -169,7 +148,6 @@ public class PolicyDataBinderImpl implements PolicyDataBinder {
}
break;
- case GLOBAL_SYNC:
case SYNC:
default:
if (!(policyTO instanceof SyncPolicyTO)) {
@@ -177,7 +155,7 @@ public class PolicyDataBinderImpl implements PolicyDataBinder {
+ ", found " + policyTO.getClass().getName());
}
if (policy == null) {
- policy = (T) entityFactory.newPolicy(SyncPolicy.class, policyTO.getType().isGlobal());
+ policy = (T) entityFactory.newEntity(SyncPolicy.class);
}
policy.setSpecification(((SyncPolicyTO) policyTO).getSpecification());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
index 05a0648..cf1339e 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
@@ -46,7 +46,7 @@ import org.apache.syncope.core.persistence.api.entity.group.GMappingItem;
import org.apache.syncope.core.persistence.api.entity.user.UMapping;
import org.apache.syncope.core.persistence.api.entity.user.UMappingItem;
import org.apache.syncope.core.provisioning.api.ConnectorRegistry;
-import org.apache.syncope.core.misc.jexl.JexlUtil;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.syncope.core.misc.spring.BeanUtils;
@@ -204,13 +204,12 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
}
// no mandatory condition implies mandatory condition false
- if (!JexlUtil.isExpressionValid(itemTO.getMandatoryCondition() == null
+ if (!JexlUtils.isExpressionValid(itemTO.getMandatoryCondition() == null
? "false" : itemTO.getMandatoryCondition())) {
SyncopeClientException invalidMandatoryCondition = SyncopeClientException.build(
ClientExceptionType.InvalidValues);
invalidMandatoryCondition.getElements().add(itemTO.getMandatoryCondition());
-
scce.addException(invalidMandatoryCondition);
}
@@ -234,6 +233,24 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
return connRegistry.getOverriddenConnInstance(connInstanceClone, resourceTO.getConnConfProperties());
}
+ private void populateMappingTO(final Mapping<?> mapping, final MappingTO mappingTO) {
+ mappingTO.setAccountLink(mapping.getAccountLink());
+
+ for (MappingItem item : mapping.getItems()) {
+ MappingItemTO itemTO = new MappingItemTO();
+ itemTO.setKey(item.getKey());
+ BeanUtils.copyProperties(item, itemTO, MAPPINGITEM_IGNORE_PROPERTIES);
+
+ if (itemTO.isAccountid()) {
+ mappingTO.setAccountIdItem(itemTO);
+ } else if (itemTO.isPassword()) {
+ mappingTO.setPasswordItem(itemTO);
+ } else {
+ mappingTO.addItem(itemTO);
+ }
+ }
+ }
+
@Override
public ResourceTO getResourceTO(final ExternalResource resource) {
if (resource == null) {
@@ -302,48 +319,4 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
return resourceTO;
}
-
- private void populateMappingTO(final Mapping<?> mapping, final MappingTO mappingTO) {
- mappingTO.setAccountLink(mapping.getAccountLink());
-
- for (MappingItemTO itemTO : getMappingItemTOs(mapping.getItems())) {
- if (itemTO.isAccountid()) {
- mappingTO.setAccountIdItem(itemTO);
- } else if (itemTO.isPassword()) {
- mappingTO.setPasswordItem(itemTO);
- } else {
- mappingTO.addItem(itemTO);
- }
- }
- }
-
- private Set<MappingItemTO> getMappingItemTOs(final Collection<? extends MappingItem> items) {
- Set<MappingItemTO> mappingTOs = new HashSet<>();
- for (MappingItem item : items) {
- LOG.debug("Asking for TO for {}", item);
- mappingTOs.add(getMappingItemTO(item));
- }
-
- LOG.debug("Collected TOs: {}", mappingTOs);
-
- return mappingTOs;
- }
-
- private MappingItemTO getMappingItemTO(final MappingItem item) {
- if (item == null) {
- LOG.error("Provided null mapping");
-
- return null;
- }
-
- MappingItemTO itemTO = new MappingItemTO();
-
- BeanUtils.copyProperties(item, itemTO, MAPPINGITEM_IGNORE_PROPERTIES);
-
- itemTO.setKey(item.getKey());
-
- LOG.debug("Obtained SchemaMappingTO {}", itemTO);
-
- return itemTO;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java
index 842bf35..de07e3b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java
@@ -18,7 +18,6 @@
*/
package org.apache.syncope.core.provisioning.java.data;
-import org.apache.commons.collections4.Closure;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.to.RoleTO;
@@ -53,24 +52,19 @@ public class RoleDataBinderImpl implements RoleDataBinder {
@Override
public void update(final Role role, final RoleTO roleTO) {
role.setName(roleTO.getName());
- role.setCriteria(roleTO.getCriteria());
role.getEntitlements().clear();
role.getEntitlements().addAll(roleTO.getEntitlements());
role.getRealms().clear();
- CollectionUtils.forAllDo(roleTO.getRealms(), new Closure<String>() {
-
- @Override
- public void execute(final String realmFullPath) {
- Realm realm = realmDAO.find(realmFullPath);
- if (realm == null) {
- LOG.warn("Invalid realm full path {}, ignoring", realmFullPath);
- } else {
- role.addRealm(realm);
- }
+ for (String realmFullPath : roleTO.getRealms()) {
+ Realm realm = realmDAO.find(realmFullPath);
+ if (realm == null) {
+ LOG.warn("Invalid realm full path {}, ignoring", realmFullPath);
+ } else {
+ role.addRealm(realm);
}
- });
+ }
}
@Override
@@ -79,7 +73,6 @@ public class RoleDataBinderImpl implements RoleDataBinder {
roleTO.setKey(role.getKey());
roleTO.setName(role.getName());
- roleTO.setCriteria(role.getCriteria());
roleTO.getEntitlements().addAll(role.getEntitlements());
CollectionUtils.collect(role.getRealms(), new Transformer<Realm, String>() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
index 7167922..0a34e61 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
@@ -28,13 +28,13 @@ import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.to.VirSchemaTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
import org.apache.syncope.core.misc.spring.BeanUtils;
-import org.apache.syncope.core.misc.jexl.JexlUtil;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -46,7 +46,7 @@ public class SchemaDataBinderImpl implements SchemaDataBinder {
// --------------- PLAIN -----------------
private <T extends PlainSchema> void fill(final T schema, final PlainSchemaTO schemaTO) {
- if (!JexlUtil.isExpressionValid(schemaTO.getMandatoryCondition())) {
+ if (!JexlUtils.isExpressionValid(schemaTO.getMandatoryCondition())) {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidValues);
sce.getElements().add(schemaTO.getMandatoryCondition());
throw sce;
@@ -62,7 +62,7 @@ public class SchemaDataBinderImpl implements SchemaDataBinder {
@Override
public <T extends PlainSchema> void update(final PlainSchemaTO schemaTO, final T schema,
- final AttributableUtil attributableUtil) {
+ final AttributableUtils attributableUtil) {
SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
@@ -91,7 +91,7 @@ public class SchemaDataBinderImpl implements SchemaDataBinder {
@Override
public <T extends PlainSchema> PlainSchemaTO getPlainSchemaTO(
- final T schema, final AttributableUtil attributableUtil) {
+ final T schema, final AttributableUtils attributableUtil) {
PlainSchemaTO schemaTO = new PlainSchemaTO();
BeanUtils.copyProperties(schema, schemaTO);
@@ -109,7 +109,7 @@ public class SchemaDataBinderImpl implements SchemaDataBinder {
requiredValuesMissing.getElements().add("expression");
scce.addException(requiredValuesMissing);
- } else if (!JexlUtil.isExpressionValid(derSchemaTO.getExpression())) {
+ } else if (!JexlUtils.isExpressionValid(derSchemaTO.getExpression())) {
SyncopeClientException e = SyncopeClientException.build(ClientExceptionType.InvalidValues);
e.getElements().add(derSchemaTO.getExpression());
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
index 8a1076b..9fe733e 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
@@ -49,10 +49,11 @@ import org.apache.syncope.core.persistence.api.entity.task.SchedTask;
import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
import org.apache.syncope.core.persistence.api.entity.task.Task;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
-import org.apache.syncope.core.persistence.api.entity.task.TaskUtil;
+import org.apache.syncope.core.persistence.api.entity.task.TaskUtils;
import org.apache.syncope.core.provisioning.api.job.JobNamer;
import org.apache.syncope.core.misc.spring.BeanUtils;
-import org.apache.syncope.core.misc.jexl.JexlUtil;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.Trigger;
@@ -72,11 +73,14 @@ public class TaskDataBinderImpl implements TaskDataBinder {
private static final Logger LOG = LoggerFactory.getLogger(TaskDataBinder.class);
private static final String[] IGNORE_TASK_PROPERTIES = {
- "executions", "resource", "matchingRule", "unmatchingRule" };
+ "destinationRealm", "executions", "resource", "matchingRule", "unmatchingRule" };
private static final String[] IGNORE_TASK_EXECUTION_PROPERTIES = { "key", "task" };
@Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
private ExternalResourceDAO resourceDAO;
@Autowired
@@ -87,21 +91,19 @@ public class TaskDataBinderImpl implements TaskDataBinder {
private void checkJexl(final AbstractAttributableTO attributableTO, final SyncopeClientException sce) {
for (AttrTO attrTO : attributableTO.getPlainAttrs()) {
- if (!attrTO.getValues().isEmpty() && !JexlUtil.isExpressionValid(attrTO.getValues().get(0))) {
+ if (!attrTO.getValues().isEmpty() && !JexlUtils.isExpressionValid(attrTO.getValues().get(0))) {
sce.getElements().add("Invalid JEXL: " + attrTO.getValues().get(0));
}
}
for (AttrTO attrTO : attributableTO.getVirAttrs()) {
- if (!attrTO.getValues().isEmpty() && !JexlUtil.isExpressionValid(attrTO.getValues().get(0))) {
+ if (!attrTO.getValues().isEmpty() && !JexlUtils.isExpressionValid(attrTO.getValues().get(0))) {
sce.getElements().add("Invalid JEXL: " + attrTO.getValues().get(0));
}
}
}
private void fill(final ProvisioningTask task, final AbstractProvisioningTaskTO taskTO) {
- SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSyncTask);
-
if (task instanceof PushTask && taskTO instanceof PushTaskTO) {
final PushTask pushTask = (PushTask) task;
final PushTaskTO pushTaskTO = (PushTaskTO) taskTO;
@@ -119,23 +121,26 @@ public class TaskDataBinderImpl implements TaskDataBinder {
final SyncTask syncTask = (SyncTask) task;
final SyncTaskTO syncTaskTO = (SyncTaskTO) taskTO;
+ syncTask.setDestinationRealm(realmDAO.find(syncTaskTO.getDestinationRealm()));
+
syncTask.setMatchingRule(syncTaskTO.getMatchingRule() == null
? MatchingRule.UPDATE : syncTaskTO.getMatchingRule());
syncTask.setUnmatchingRule(syncTaskTO.getUnmatchingRule() == null
? UnmatchingRule.PROVISION : syncTaskTO.getUnmatchingRule());
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSyncTask);
// 1. validate JEXL expressions in user and group templates
if (syncTaskTO.getUserTemplate() != null) {
UserTO template = syncTaskTO.getUserTemplate();
if (StringUtils.isNotBlank(template.getUsername())
- && !JexlUtil.isExpressionValid(template.getUsername())) {
+ && !JexlUtils.isExpressionValid(template.getUsername())) {
sce.getElements().add("Invalid JEXL: " + template.getUsername());
}
if (StringUtils.isNotBlank(template.getPassword())
- && !JexlUtil.isExpressionValid(template.getPassword())) {
+ && !JexlUtils.isExpressionValid(template.getPassword())) {
sce.getElements().add("Invalid JEXL: " + template.getPassword());
}
@@ -149,7 +154,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
if (syncTaskTO.getGroupTemplate() != null) {
GroupTO template = syncTaskTO.getGroupTemplate();
- if (StringUtils.isNotBlank(template.getName()) && !JexlUtil.isExpressionValid(template.getName())) {
+ if (StringUtils.isNotBlank(template.getName()) && !JexlUtils.isExpressionValid(template.getName())) {
sce.getElements().add("Invalid JEXL: " + template.getName());
}
@@ -176,20 +181,20 @@ public class TaskDataBinderImpl implements TaskDataBinder {
}
@Override
- public SchedTask createSchedTask(final SchedTaskTO taskTO, final TaskUtil taskUtil) {
- final Class<? extends AbstractTaskTO> taskTOClass = taskUtil.taskTOClass();
+ public SchedTask createSchedTask(final SchedTaskTO taskTO, final TaskUtils taskUtils) {
+ final Class<? extends AbstractTaskTO> taskTOClass = taskUtils.taskTOClass();
if (taskTOClass == null || !taskTOClass.equals(taskTO.getClass())) {
throw new IllegalArgumentException(
- String.format("taskUtil is type %s but task is not: %s", taskTOClass, taskTO.getClass()));
+ String.format("taskUtils is type %s but task is not: %s", taskTOClass, taskTO.getClass()));
}
- SchedTask task = taskUtil.newTask();
+ SchedTask task = taskUtils.newTask();
task.setCronExpression(taskTO.getCronExpression());
task.setName(taskTO.getName());
task.setDescription(taskTO.getDescription());
- if (taskUtil.getType() == TaskType.SCHEDULED) {
+ if (taskUtils.getType() == TaskType.SCHEDULED) {
task.setJobClassName(taskTO.getJobClassName());
} else if (taskTO instanceof AbstractProvisioningTaskTO) {
final AbstractProvisioningTaskTO provisioningTaskTO = (AbstractProvisioningTaskTO) taskTO;
@@ -207,18 +212,18 @@ public class TaskDataBinderImpl implements TaskDataBinder {
}
@Override
- public void updateSchedTask(final SchedTask task, final SchedTaskTO taskTO, final TaskUtil taskUtil) {
- Class<? extends Task> taskClass = taskUtil.taskClass();
- Class<? extends AbstractTaskTO> taskTOClass = taskUtil.taskTOClass();
+ public void updateSchedTask(final SchedTask task, final SchedTaskTO taskTO, final TaskUtils taskUtils) {
+ Class<? extends Task> taskClass = taskUtils.taskClass();
+ Class<? extends AbstractTaskTO> taskTOClass = taskUtils.taskTOClass();
if (taskClass == null || !taskClass.isAssignableFrom(task.getClass())) {
throw new IllegalArgumentException(
- String.format("taskUtil is type %s but task is not: %s", taskClass, task.getClass()));
+ String.format("taskUtils is type %s but task is not: %s", taskClass, task.getClass()));
}
if (taskTOClass == null || !taskTOClass.equals(taskTO.getClass())) {
throw new IllegalArgumentException(
- String.format("taskUtil is type %s but task is not: %s", taskTOClass, taskTO.getClass()));
+ String.format("taskUtils is type %s but task is not: %s", taskTOClass, taskTO.getClass()));
}
task.setCronExpression(taskTO.getCronExpression());
@@ -267,12 +272,12 @@ public class TaskDataBinderImpl implements TaskDataBinder {
}
@Override
- public <T extends AbstractTaskTO> T getTaskTO(final Task task, final TaskUtil taskUtil) {
- T taskTO = taskUtil.newTaskTO();
+ public <T extends AbstractTaskTO> T getTaskTO(final Task task, final TaskUtils taskUtils) {
+ T taskTO = taskUtils.newTaskTO();
BeanUtils.copyProperties(task, taskTO, IGNORE_TASK_PROPERTIES);
TaskExec latestExec = taskExecDAO.findLatestStarted(task);
- taskTO.setLatestExecStatus(latestExec == null ? "" : latestExec.getStatus());
+ taskTO.setLatestExecStatus(latestExec == null ? StringUtils.EMPTY : latestExec.getStatus());
taskTO.setStartDate(latestExec == null ? null : latestExec.getStartDate());
taskTO.setEndDate(latestExec == null ? null : latestExec.getEndDate());
@@ -280,10 +285,10 @@ public class TaskDataBinderImpl implements TaskDataBinder {
taskTO.getExecutions().add(getTaskExecTO(execution));
}
- switch (taskUtil.getType()) {
+ switch (taskUtils.getType()) {
case PROPAGATION:
if (!(task instanceof PropagationTask)) {
- throw new IllegalArgumentException("taskUtil is type Propagation but task is not PropagationTask: "
+ throw new IllegalArgumentException("taskUtils is type Propagation but task is not PropagationTask: "
+ task.getClass().getName());
}
((PropagationTaskTO) taskTO).setResource(((PropagationTask) task).getResource().getKey());
@@ -291,7 +296,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
case SCHEDULED:
if (!(task instanceof SchedTask)) {
- throw new IllegalArgumentException("taskUtil is type Sched but task is not SchedTask: "
+ throw new IllegalArgumentException("taskUtils is type Sched but task is not SchedTask: "
+ task.getClass().getName());
}
setExecTime((SchedTaskTO) taskTO, task);
@@ -301,12 +306,13 @@ public class TaskDataBinderImpl implements TaskDataBinder {
case SYNCHRONIZATION:
if (!(task instanceof SyncTask)) {
- throw new IllegalArgumentException("taskUtil is type Sync but task is not SyncTask: "
+ throw new IllegalArgumentException("taskUtils is type Sync but task is not SyncTask: "
+ task.getClass().getName());
}
setExecTime((SchedTaskTO) taskTO, task);
((SyncTaskTO) taskTO).setName(((SyncTask) task).getName());
((SyncTaskTO) taskTO).setDescription(((SyncTask) task).getDescription());
+ ((SyncTaskTO) taskTO).setDestinationRealm(((SyncTask) task).getDestinatioRealm().getFullPath());
((SyncTaskTO) taskTO).setResource(((SyncTask) task).getResource().getKey());
((SyncTaskTO) taskTO).setMatchingRule(((SyncTask) task).getMatchingRule() == null
? MatchingRule.UPDATE : ((SyncTask) task).getMatchingRule());
@@ -316,7 +322,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
case PUSH:
if (!(task instanceof PushTask)) {
- throw new IllegalArgumentException("taskUtil is type Push but task is not PushTask: "
+ throw new IllegalArgumentException("taskUtils is type Push but task is not PushTask: "
+ task.getClass().getName());
}
setExecTime((SchedTaskTO) taskTO, task);
[51/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index b67f543..4929d62 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@ -18,7 +18,6 @@
*/
package org.apache.syncope.core.logic;
-import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
import java.lang.reflect.Method;
import java.security.AccessControlException;
import java.util.ArrayList;
@@ -30,19 +29,17 @@ import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.mod.AttrMod;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
-import org.apache.syncope.common.lib.to.BulkActionResult.Status;
-import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
@@ -57,7 +54,9 @@ import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
import org.apache.syncope.core.provisioning.java.VirAttrHandler;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
+import org.apache.syncope.core.misc.security.AuthContextUtils;
+import org.apache.syncope.core.misc.security.UnauthorizedException;
+import org.apache.syncope.core.misc.serialization.POJOHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
@@ -114,25 +113,20 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
@PreAuthorize("hasRole('USER_LIST')")
@Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
- public int count() {
- return userDAO.count(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames()));
+ public int count(final List<String> realms) {
+ return userDAO.count(
+ getEffectiveRealms(AuthContextUtils.getAuthorizations().get(Entitlement.USER_LIST), realms));
}
@PreAuthorize("hasRole('USER_LIST')")
@Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
- public int searchCount(final SearchCond searchCondition) {
- return searchDAO.count(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames()),
- searchCondition, SubjectType.USER);
- }
-
- @PreAuthorize("hasRole('USER_LIST')")
- @Transactional(readOnly = true, rollbackFor = { Throwable.class })
- @Override
- public List<UserTO> list(final int page, final int size, final List<OrderByClause> orderBy) {
- final Set<Long> adminGroupKeys = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+ public List<UserTO> list(
+ final int page, final int size, final List<OrderByClause> orderBy, final List<String> realms) {
- return CollectionUtils.collect(userDAO.findAll(adminGroupKeys, page, size, orderBy),
+ return CollectionUtils.collect(userDAO.findAll(
+ getEffectiveRealms(AuthContextUtils.getAuthorizations().get(Entitlement.USER_LIST), realms),
+ page, size, orderBy),
new Transformer<User, UserTO>() {
@Override
@@ -142,11 +136,12 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
}, new ArrayList<UserTO>());
}
- @PreAuthorize("isAuthenticated() "
- + "and not(hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT))")
+ @PreAuthorize("isAuthenticated()")
@Transactional(readOnly = true)
- public UserTO readSelf() {
- return binder.getAuthenticatedUserTO();
+ public Pair<String, UserTO> readSelf() {
+ return ImmutablePair.of(
+ POJOHelper.serialize(AuthContextUtils.getAuthorizations()),
+ binder.getAuthenticatedUserTO());
}
@PreAuthorize("hasRole('USER_READ')")
@@ -156,14 +151,23 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
return binder.getUserTO(key);
}
- @PreAuthorize("hasRole('USER_LIST')")
- @Transactional(readOnly = true)
+ @PreAuthorize("hasRole('USER_SEARCH')")
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
+ @Override
+ public int searchCount(final SearchCond searchCondition, final List<String> realms) {
+ return searchDAO.count(
+ getEffectiveRealms(AuthContextUtils.getAuthorizations().get(Entitlement.USER_SEARCH), realms),
+ searchCondition, SubjectType.USER);
+ }
+
+ @PreAuthorize("hasRole('USER_SEARCH')")
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
public List<UserTO> search(final SearchCond searchCondition, final int page, final int size,
- final List<OrderByClause> orderBy) {
+ final List<OrderByClause> orderBy, final List<String> realms) {
- final List<User> matchingUsers = searchDAO.search(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.
- getOwnedEntitlementNames()),
+ final List<User> matchingUsers = searchDAO.search(
+ getEffectiveRealms(AuthContextUtils.getAuthorizations().get(Entitlement.USER_SEARCH), realms),
searchCondition, page, size, orderBy, SubjectType.USER);
return CollectionUtils.collect(matchingUsers, new Transformer<User, UserTO>() {
@@ -174,24 +178,22 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
}, new ArrayList<UserTO>());
}
- @PreAuthorize("isAnonymous() or hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT)")
+ @PreAuthorize("isAnonymous() or hasRole('ANONYMOUS')")
public UserTO createSelf(final UserTO userTO, final boolean storePassword) {
return doCreate(userTO, storePassword);
}
@PreAuthorize("hasRole('USER_CREATE')")
public UserTO create(final UserTO userTO, final boolean storePassword) {
- Collection<Long> requestGroupIds = CollectionUtils.removeAll(
- CollectionUtils.collect(userTO.getMemberships(), new Transformer<MembershipTO, Long>() {
-
- @Override
- public Long transform(final MembershipTO membership) {
- return membership.getGroupId();
- }
- }, new ArrayList<Long>()),
- GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames()));
- if (!requestGroupIds.isEmpty()) {
- throw new UnauthorizedGroupException(requestGroupIds);
+ if (userTO.getRealm() == null) {
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
+ throw sce;
+ }
+ Set<String> effectiveRealms = getEffectiveRealms(
+ AuthContextUtils.getAuthorizations().get(Entitlement.USER_CREATE),
+ Collections.singleton(userTO.getRealm()));
+ if (effectiveRealms.isEmpty()) {
+ throw new UnauthorizedException(SubjectType.USER, null);
}
return doCreate(userTO, storePassword);
@@ -209,8 +211,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
return savedTO;
}
- @PreAuthorize("isAuthenticated() "
- + "and not(hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT))")
+ @PreAuthorize("isAuthenticated() and not(hasRole('ANONYMOUS'))")
public UserTO updateSelf(final UserMod userMod) {
UserTO userTO = binder.getAuthenticatedUserTO();
@@ -284,7 +285,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
return savedTO;
}
- @PreAuthorize("isAnonymous() or hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT)")
+ @PreAuthorize("isAnonymous() or hasRole('ANONYMOUS')")
@Transactional
public void requestPasswordReset(final String username, final String securityAnswer) {
if (username == null) {
@@ -305,7 +306,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
provisioningManager.requestPasswordReset(user.getKey());
}
- @PreAuthorize("isAnonymous() or hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT)")
+ @PreAuthorize("isAnonymous() or hasRole('ANONYMOUS')")
@Transactional
public void confirmPasswordReset(final String token, final String password) {
User user = userDAO.findByToken(token);
@@ -315,8 +316,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
provisioningManager.confirmPasswordReset(user, token, password);
}
- @PreAuthorize("isAuthenticated() "
- + "and not(hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT))")
+ @PreAuthorize("isAuthenticated() and not(hasRole('ANONYMOUS'))")
public UserTO deleteSelf() {
UserTO userTO = binder.getAuthenticatedUserTO();
@@ -354,59 +354,6 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
return deletedTO;
}
- @PreAuthorize("(hasRole('USER_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE) or "
- + "(hasRole('USER_UPDATE') and "
- + "(#bulkAction.operation == #bulkAction.operation.REACTIVATE or "
- + "#bulkAction.operation == #bulkAction.operation.SUSPEND))")
- public BulkActionResult bulk(final BulkAction bulkAction) {
- BulkActionResult res = new BulkActionResult();
-
- switch (bulkAction.getOperation()) {
- case DELETE:
- for (String key : bulkAction.getTargets()) {
- try {
- res.add(delete(Long.valueOf(key)).getKey(), Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing delete for user {}", key, e);
- res.add(key, Status.FAILURE);
- }
- }
- break;
-
- case SUSPEND:
- for (String key : bulkAction.getTargets()) {
- StatusMod statusMod = new StatusMod();
- statusMod.setKey(Long.valueOf(key));
- statusMod.setType(StatusMod.ModType.SUSPEND);
- try {
- res.add(status(statusMod).getKey(), Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing suspend for user {}", key, e);
- res.add(key, Status.FAILURE);
- }
- }
- break;
-
- case REACTIVATE:
- for (String key : bulkAction.getTargets()) {
- StatusMod statusMod = new StatusMod();
- statusMod.setKey(Long.valueOf(key));
- statusMod.setType(StatusMod.ModType.REACTIVATE);
- try {
- res.add(status(statusMod).getKey(), Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing reactivate for user {}", key, e);
- res.add(key, Status.FAILURE);
- }
- }
- break;
-
- default:
- }
-
- return res;
- }
-
@PreAuthorize("hasRole('USER_UPDATE')")
@Transactional(rollbackFor = { Throwable.class })
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/UserWorkflowLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserWorkflowLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserWorkflowLogic.java
index d15eef9..69c95f0 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserWorkflowLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserWorkflowLogic.java
@@ -19,9 +19,9 @@
package org.apache.syncope.core.logic;
import java.lang.reflect.Method;
-import java.util.AbstractMap;
import java.util.List;
-import java.util.Map;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.AbstractAttributableMod;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.UserTO;
@@ -70,9 +70,9 @@ public class UserWorkflowLogic extends AbstractTransactionalLogic<WorkflowFormTO
UserMod userMod = new UserMod();
userMod.setKey(userTO.getKey());
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
- new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new AbstractMap.SimpleEntry<UserMod, Boolean>(userMod, null),
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(
+ new WorkflowResult<Pair<UserMod, Boolean>>(
+ new ImmutablePair<UserMod, Boolean>(userMod, null),
updated.getPropByRes(), updated.getPerformedTasks()));
taskExecutor.execute(tasks);
@@ -110,9 +110,9 @@ public class UserWorkflowLogic extends AbstractTransactionalLogic<WorkflowFormTO
if (updated.getResult() instanceof UserMod
&& updated.getPropByRes() != null && !updated.getPropByRes().isEmpty()) {
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
- new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new AbstractMap.SimpleEntry<>((UserMod) updated.getResult(), Boolean.TRUE),
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(
+ new WorkflowResult<Pair<UserMod, Boolean>>(
+ new ImmutablePair<>((UserMod) updated.getResult(), Boolean.TRUE),
updated.getPropByRes(),
updated.getPerformedTasks()));
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/notification/NotificationJob.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/notification/NotificationJob.java b/core/logic/src/main/java/org/apache/syncope/core/logic/notification/NotificationJob.java
index 88d42fd..9e40ff1 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/notification/NotificationJob.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/notification/NotificationJob.java
@@ -31,7 +31,7 @@ import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
import org.apache.syncope.core.misc.AuditManager;
-import org.apache.syncope.core.misc.ExceptionUtil;
+import org.apache.syncope.core.misc.ExceptionUtils2;
import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
@@ -186,7 +186,7 @@ public class NotificationJob implements Job {
execution.setStatus(Status.NOT_SENT.name());
if (task.getTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) {
- execution.setMessage(ExceptionUtil.getFullStackTrace(e));
+ execution.setMessage(ExceptionUtils2.getFullStackTrace(e));
}
auditManager.audit(
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
index 38c96c6..d564335 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
@@ -22,8 +22,8 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.report.GroupReportletConf;
import org.apache.syncope.common.lib.report.GroupReportletConf.Feature;
import org.apache.syncope.common.lib.to.AbstractAttributableTO;
@@ -31,8 +31,6 @@ import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
@@ -51,9 +49,6 @@ public class GroupReportlet extends AbstractReportlet<GroupReportletConf> {
private static final int PAGE_SIZE = 10;
@Autowired
- private EntitlementDAO entitlementDAO;
-
- @Autowired
private GroupDAO groupDAO;
@Autowired
@@ -62,13 +57,14 @@ public class GroupReportlet extends AbstractReportlet<GroupReportletConf> {
@Autowired
private GroupDataBinder groupDataBinder;
- private List<Group> getPagedgroups(final int page) {
- final Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
- final List<Group> result;
+ private List<Group> getPagedGroups(final int page) {
+ List<Group> result;
+
if (StringUtils.isBlank(conf.getMatchingCond())) {
- result = groupDAO.findAll();
+ result = groupDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, page, PAGE_SIZE);
} else {
- result = searchDAO.search(adminGroupIds, SearchCondConverter.convert(conf.getMatchingCond()),
+ result = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
+ SearchCondConverter.convert(conf.getMatchingCond()),
page, PAGE_SIZE, Collections.<OrderByClause>emptyList(), SubjectType.GROUP);
}
@@ -76,11 +72,9 @@ public class GroupReportlet extends AbstractReportlet<GroupReportletConf> {
}
private int count() {
- Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
-
return StringUtils.isBlank(conf.getMatchingCond())
- ? groupDAO.findAll().size()
- : searchDAO.count(adminGroupIds,
+ ? groupDAO.count(SyncopeConstants.FULL_ADMIN_REALMS)
+ : searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS,
SearchCondConverter.convert(conf.getMatchingCond()), SubjectType.GROUP);
}
@@ -236,20 +230,6 @@ public class GroupReportlet extends AbstractReportlet<GroupReportletConf> {
doExtractAttributes(handler, groupTO, conf.getPlainAttrs(), conf.getDerAttrs(), conf.getVirAttrs());
- if (conf.getFeatures().contains(Feature.entitlements)) {
- handler.startElement("", "", "entitlements", null);
-
- for (String ent : groupTO.getEntitlements()) {
- atts.clear();
-
- atts.addAttribute("", "", "id", ReportXMLConst.XSD_STRING, String.valueOf(ent));
-
- handler.startElement("", "", "entitlement", atts);
- handler.endElement("", "", "entitlement");
- }
-
- handler.endElement("", "", "entitlements");
- }
// to get resources associated to a group
if (conf.getFeatures().contains(Feature.resources)) {
doExtractResources(handler, groupTO);
@@ -322,7 +302,7 @@ public class GroupReportlet extends AbstractReportlet<GroupReportletConf> {
protected void doExtract(final ContentHandler handler) throws SAXException, ReportException {
doExtractConf(handler);
for (int i = 1; i <= (count() / PAGE_SIZE) + 1; i++) {
- doExtract(handler, getPagedgroups(i));
+ doExtract(handler, getPagedGroups(i));
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReportJob.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReportJob.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReportJob.java
index 7d03b61..e07612a 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReportJob.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReportJob.java
@@ -40,7 +40,7 @@ import org.apache.syncope.core.persistence.api.entity.Report;
import org.apache.syncope.core.persistence.api.entity.ReportExec;
import org.apache.syncope.core.logic.ReportLogic;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.misc.ExceptionUtil;
+import org.apache.syncope.core.misc.ExceptionUtils2;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
@@ -167,7 +167,7 @@ public class ReportJob implements Job {
? e.getCause()
: e;
reportExecutionMessage.
- append(ExceptionUtil.getFullStackTrace(t)).
+ append(ExceptionUtils2.getFullStackTrace(t)).
append("\n==================\n");
}
}
@@ -182,7 +182,7 @@ public class ReportJob implements Job {
}
} catch (Exception e) {
execution.setStatus(ReportExecStatus.FAILURE);
- reportExecutionMessage.append(ExceptionUtil.getFullStackTrace(e));
+ reportExecutionMessage.append(ExceptionUtils2.getFullStackTrace(e));
throw new JobExecutionException(e, true);
} finally {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
index f0023fc..02976f6 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
@@ -22,8 +22,8 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.report.UserReportletConf;
import org.apache.syncope.common.lib.report.UserReportletConf.Feature;
import org.apache.syncope.common.lib.to.AbstractAttributableTO;
@@ -32,8 +32,6 @@ import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
@@ -54,9 +52,6 @@ public class UserReportlet extends AbstractReportlet<UserReportletConf> {
private static final int PAGE_SIZE = 10;
@Autowired
- private EntitlementDAO entitlementDAO;
-
- @Autowired
private UserDAO userDAO;
@Autowired
@@ -69,13 +64,13 @@ public class UserReportlet extends AbstractReportlet<UserReportletConf> {
private GroupDataBinder groupDataBinder;
private List<User> getPagedUsers(final int page) {
- final Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
+ List<User> result;
- final List<User> result;
if (StringUtils.isBlank(conf.getMatchingCond())) {
- result = userDAO.findAll(adminGroupIds, page, PAGE_SIZE);
+ result = userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, page, PAGE_SIZE);
} else {
- result = searchDAO.search(adminGroupIds, SearchCondConverter.convert(conf.getMatchingCond()),
+ result = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
+ SearchCondConverter.convert(conf.getMatchingCond()),
page, PAGE_SIZE, Collections.<OrderByClause>emptyList(), SubjectType.USER);
}
@@ -83,11 +78,10 @@ public class UserReportlet extends AbstractReportlet<UserReportletConf> {
}
private int count() {
- Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
-
return StringUtils.isBlank(conf.getMatchingCond())
- ? userDAO.count(adminGroupIds)
- : searchDAO.count(adminGroupIds, SearchCondConverter.convert(conf.getMatchingCond()), SubjectType.USER);
+ ? userDAO.count(SyncopeConstants.FULL_ADMIN_REALMS)
+ : searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS,
+ SearchCondConverter.convert(conf.getMatchingCond()), SubjectType.USER);
}
private void doExtractResources(final ContentHandler handler, final AbstractSubjectTO subjectTO)
@@ -280,17 +274,18 @@ public class UserReportlet extends AbstractReportlet<UserReportletConf> {
atts.clear();
atts.addAttribute("", "", "id", ReportXMLConst.XSD_LONG, String.valueOf(memb.getKey()));
- atts.addAttribute("", "", "groupId", ReportXMLConst.XSD_LONG, String.valueOf(memb.getGroupId()));
- atts.addAttribute("", "", "groupName", ReportXMLConst.XSD_STRING, String.valueOf(memb.getGroupName()));
+ atts.addAttribute("", "", "groupId", ReportXMLConst.XSD_LONG, String.valueOf(memb.getGroupKey()));
+ atts.addAttribute("", "", "groupName", ReportXMLConst.XSD_STRING, String.
+ valueOf(memb.getGroupName()));
handler.startElement("", "", "membership", atts);
doExtractAttributes(handler, memb, memb.getPlainAttrMap().keySet(), memb.getDerAttrMap()
.keySet(), memb.getVirAttrMap().keySet());
if (conf.getFeatures().contains(Feature.resources)) {
- Membership actualMemb = user.getMembership(memb.getGroupId());
+ Membership actualMemb = user.getMembership(memb.getGroupKey());
if (actualMemb == null) {
- LOG.warn("Unexpected: cannot find membership for group {} for user {}", memb.getGroupId(),
+ LOG.warn("Unexpected: cannot find membership for group {} for user {}", memb.getGroupKey(),
user);
} else {
doExtractResources(handler, groupDataBinder.getGroupTO(actualMemb.getGroup()));
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/resources/report/groupReportlet2csv.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/groupReportlet2csv.xsl b/core/logic/src/main/resources/report/groupReportlet2csv.xsl
index 06730dc..86fe635 100644
--- a/core/logic/src/main/resources/report/groupReportlet2csv.xsl
+++ b/core/logic/src/main/resources/report/groupReportlet2csv.xsl
@@ -62,18 +62,6 @@ under the License.
<xsl:value-of select="$groupAttr/."/>
<xsl:text>"</xsl:text>
</xsl:when>
- <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='entitlement'])
- and count($attrs/*[name(.)=$nameAttr]/node()) > 0">
- <xsl:text>"</xsl:text>
- <xsl:for-each select="$attrs/*/entitlement">
- <xsl:variable name="value" select="@id"/>
- <xsl:value-of select="$value"/>
- <xsl:if test="position() != last()">
- <xsl:value-of select="$delimiter"/>
- </xsl:if>
- </xsl:for-each>
- <xsl:text>"</xsl:text>
- </xsl:when>
<xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='resource'])
and count($attrs/*[name(.)=$nameAttr]/node()) > 0">
<xsl:text>"</xsl:text>
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/resources/report/groupReportlet2fo.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/groupReportlet2fo.xsl b/core/logic/src/main/resources/report/groupReportlet2fo.xsl
index c83eb31..e95d170 100644
--- a/core/logic/src/main/resources/report/groupReportlet2fo.xsl
+++ b/core/logic/src/main/resources/report/groupReportlet2fo.xsl
@@ -102,19 +102,6 @@ under the License.
</xsl:otherwise>
</xsl:choose>
- <!--entitlements-->
- <xsl:choose>
- <xsl:when test="entitlements/entitlement">
- <xsl:call-template name="entitlements">
- <xsl:with-param name="label">Entitlements</xsl:with-param>
- <xsl:with-param name="node" select="entitlements/entitlement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <fo:block color="red" font-size="9pt" space-after="3mm">THIS GROUP HASN'T ANY ENTITLEMENT</fo:block>
- </xsl:otherwise>
- </xsl:choose>
-
<xsl:choose>
<xsl:when test="users/user">
<fo:block font-size="11pt" font-weight="bold">Users</fo:block>
@@ -184,36 +171,6 @@ under the License.
</fo:table-body>
</fo:table>
</xsl:template>
- <!--entitlements template-->
- <xsl:template name="entitlements">
- <xsl:param name="label"/>
- <xsl:param name="node"/>
- <fo:block font-size="11pt" font-weight="bold" space-after="2mm" space-before="5mm">
- <xsl:value-of select="$label"/>
- </fo:block>
- <fo:table table-layout="fixed" space-after="7mm">
- <fo:table-column/>
- <!--<fo:table-column/>-->
- <fo:table-header>
- <fo:table-row height="7mm" background-color="(#ccccba)">
- <fo:table-cell>
- <fo:block font-weight="bold">Name</fo:block>
- </fo:table-cell>
- </fo:table-row>
- </fo:table-header>
- <fo:table-body>
- <xsl:for-each select="$node">
- <fo:table-row height="4mm" background-color="(#ccccff)">
- <fo:table-cell>
- <fo:block>
- <xsl:value-of select="@id"/>
- </fo:block>
- </fo:table-cell>
- </fo:table-row>
- </xsl:for-each>
- </fo:table-body>
- </fo:table>
- </xsl:template>
<xsl:template name="groupResources">
<xsl:param name="node"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/resources/report/groupReportlet2html.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/groupReportlet2html.xsl b/core/logic/src/main/resources/report/groupReportlet2html.xsl
index ce36c6b..7e2a52f 100644
--- a/core/logic/src/main/resources/report/groupReportlet2html.xsl
+++ b/core/logic/src/main/resources/report/groupReportlet2html.xsl
@@ -88,18 +88,6 @@ under the License.
</xsl:choose>
<xsl:choose>
- <xsl:when test="entitlements/entitlement">
- <xsl:call-template name="entitlements">
- <xsl:with-param name="label">Entitlements: </xsl:with-param>
- <xsl:with-param name="node" select="entitlements/entitlement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <h5>THIS GROUP HASN'T ANY ENTITLEMENT</h5>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:choose>
<xsl:when test="users/user">
<h4>Users</h4>
<xsl:for-each select="users/user">
@@ -118,30 +106,6 @@ under the License.
</xsl:for-each>
</xsl:template>
-
- <!--entitlement template-->
- <xsl:template name="entitlements">
- <xsl:param name="label"/>
- <xsl:param name="node"/>
-
- <h4>
- <xsl:value-of select="$label"/>
- </h4>
-
- <table>
-
- <tbody>
- <xsl:for-each select="$node">
- <tr>
- <td>
- <xsl:value-of select="@id"/>
- </td>
- </tr>
- </xsl:for-each>
- </tbody>
- </table>
- </xsl:template>
-
<xsl:template name="attributes">
<xsl:param name="label"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
----------------------------------------------------------------------
diff --git a/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java b/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
index 4555189..47ea2a9 100644
--- a/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
+++ b/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java
@@ -26,6 +26,7 @@ import com.icegreen.greenmail.util.GreenMail;
import com.icegreen.greenmail.util.ServerSetup;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Random;
@@ -37,6 +38,8 @@ import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Store;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder;
@@ -47,22 +50,23 @@ import org.apache.syncope.common.lib.to.NotificationTaskTO;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.common.lib.types.TraceLevel;
import org.apache.syncope.core.persistence.api.dao.ConfDAO;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.NotificationDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.TaskDAO;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.Notification;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainSchema;
import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
import org.apache.syncope.core.logic.notification.NotificationJob;
+import org.apache.syncope.core.misc.security.SyncopeGrantedAuthority;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
import org.junit.AfterClass;
import org.junit.Before;
@@ -77,7 +81,6 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
@@ -119,10 +122,10 @@ public class NotificationTest {
private String adminUser;
@Autowired
- private EntitlementDAO entitlementDAO;
+ private NotificationDAO notificationDAO;
@Autowired
- private NotificationDAO notificationDAO;
+ private RealmDAO realmDAO;
@Autowired
private TaskDAO taskDAO;
@@ -155,7 +158,7 @@ public class NotificationTest {
private EntityFactory entityFactory;
@Autowired
- private AttributableUtilFactory attrUtilFactory;
+ private AttributableUtilsFactory attrUtilsFactory;
@BeforeClass
public static void startGreenMail() {
@@ -190,6 +193,7 @@ public class NotificationTest {
UserTO userTO = new UserTO();
userTO.setPassword("password123");
userTO.setUsername(uid);
+ userTO.setRealm("/even/two");
userTO.getPlainAttrs().add(attributeTO("fullname", uid));
userTO.getPlainAttrs().add(attributeTO("firstname", uid));
@@ -205,12 +209,16 @@ public class NotificationTest {
@Before
public void setupSecurity() {
- List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
- for (Entitlement entitlement : entitlementDAO.findAll()) {
- authorities.add(new SimpleGrantedAuthority(entitlement.getKey()));
- }
+ List<GrantedAuthority> authorities = CollectionUtils.collect(Arrays.asList(Entitlement.values()),
+ new Transformer<Entitlement, GrantedAuthority>() {
+
+ @Override
+ public GrantedAuthority transform(final Entitlement entitlement) {
+ return new SyncopeGrantedAuthority(entitlement, SyncopeConstants.ROOT_REALM);
+ }
+ }, new ArrayList<GrantedAuthority>());
- UserDetails userDetails = new User(adminUser, "FAKE_PASSWORD", true, true, true, true, authorities);
+ UserDetails userDetails = new User(adminUser, "FAKE_PASSWORD", authorities);
Authentication authentication = new TestingAuthenticationToken(userDetails, "FAKE_PASSWORD", authorities);
SecurityContextHolder.getContext().setAuthentication(authentication);
}
@@ -279,7 +287,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7);
+ membershipTO.setGroupKey(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -336,7 +344,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7);
+ membershipTO.setGroupKey(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -389,7 +397,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7);
+ membershipTO.setGroupKey(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -439,7 +447,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7);
+ membershipTO.setGroupKey(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -447,7 +455,7 @@ public class NotificationTest {
// 3. Set number of retries
CPlainAttr maxRetries = entityFactory.newEntity(CPlainAttr.class);
maxRetries.setSchema(plainSchemaDAO.find("notification.maxRetries", CPlainSchema.class));
- maxRetries.addValue("5", attrUtilFactory.getInstance(AttributableType.CONFIGURATION));
+ maxRetries.addValue("5", attrUtilsFactory.getInstance(AttributableType.CONFIGURATION));
confDAO.save(maxRetries);
confDAO.flush();
@@ -476,7 +484,7 @@ public class NotificationTest {
// 8. reset number of retries
maxRetries = entityFactory.newEntity(CPlainAttr.class);
maxRetries.setSchema(plainSchemaDAO.find("notification.maxRetries", CPlainSchema.class));
- maxRetries.addValue("0", attrUtilFactory.getInstance(AttributableType.CONFIGURATION));
+ maxRetries.addValue("0", attrUtilsFactory.getInstance(AttributableType.CONFIGURATION));
confDAO.save(maxRetries);
confDAO.flush();
}
@@ -510,7 +518,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7);
+ membershipTO.setGroupKey(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -571,7 +579,7 @@ public class NotificationTest {
// 2. create user
UserTO userTO = getUniqueSampleTO(MAIL_ADDRESS);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7);
+ membershipTO.setGroupKey(7);
userTO.getMemberships().add(membershipTO);
userLogic.create(userTO, true);
@@ -612,7 +620,7 @@ public class NotificationTest {
// 2. create group
GroupTO groupTO = new GroupTO();
groupTO.setName("group446");
- groupTO.setParent(1L);
+ groupTO.setRealm("/even/two");
GroupTO createdGroup = groupLogic.create(groupTO);
assertNotNull(createdGroup);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java
deleted file mode 100644
index 182e2c7..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java
+++ /dev/null
@@ -1,763 +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.misc;
-
-import org.apache.syncope.core.misc.policy.InvalidPasswordPolicySpecException;
-import org.apache.syncope.core.misc.security.PasswordGenerator;
-import org.apache.syncope.core.misc.security.SecureRandomUtil;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.AttributableOperations;
-import org.apache.syncope.common.lib.mod.AbstractAttributableMod;
-import org.apache.syncope.common.lib.to.AbstractAttributableTO;
-import org.apache.syncope.common.lib.to.AbstractSubjectTO;
-import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.ConnObjectTO;
-import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.common.lib.types.PasswordPolicySpec;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
-import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
-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.Attributable;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.Subject;
-import org.apache.syncope.core.persistence.api.entity.VirAttr;
-import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.provisioning.api.Connector;
-import org.apache.syncope.core.provisioning.api.ConnectorFactory;
-import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
-import org.apache.syncope.core.provisioning.api.cache.VirAttrCacheValue;
-import org.apache.syncope.core.misc.security.Encryptor;
-import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.misc.jexl.JexlUtil;
-import org.identityconnectors.common.Base64;
-import org.identityconnectors.common.security.GuardedByteArray;
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.OperationOptions;
-import org.identityconnectors.framework.common.objects.Uid;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-@Component
-public class ConnObjectUtil {
-
- /**
- * Logger.
- */
- private static final Logger LOG = LoggerFactory.getLogger(ConnObjectUtil.class);
-
- @Autowired
- private PolicyDAO policyDAO;
-
- @Autowired
- private UserDAO userDAO;
-
- @Autowired
- private GroupDAO groupDAO;
-
- @Autowired
- private ExternalResourceDAO resourceDAO;
-
- @Autowired
- private PlainSchemaDAO plainSchemaDAO;
-
- @Autowired
- private PasswordGenerator pwdGen;
-
- private final Encryptor encryptor = Encryptor.getInstance();
-
- /**
- * Virtual attribute cache.
- */
- @Autowired
- private VirAttrCache virAttrCache;
-
- public ObjectClass fromSubject(final Subject<?, ?, ?> subject) {
- if (subject == null) {
- throw new IllegalArgumentException("No ObjectClass could be provided for " + subject);
- }
-
- ObjectClass result = null;
- if (subject instanceof User) {
- result = ObjectClass.ACCOUNT;
- }
- if (subject instanceof Group) {
- result = ObjectClass.GROUP;
- }
-
- return result;
- }
-
- /**
- * Build a UserTO / GroupTO out of connector object attributes and schema mapping.
- *
- * @param obj connector object
- * @param syncTask synchronization task
- * @param attrUtil AttributableUtil
- * @param <T> user/group
- * @return UserTO for the user to be created
- */
- @Transactional(readOnly = true)
- public <T extends AbstractSubjectTO> T getSubjectTO(final ConnectorObject obj, final SyncTask syncTask,
- final AttributableUtil attrUtil) {
-
- T subjectTO = getSubjectTOFromConnObject(obj, syncTask, attrUtil);
-
- // (for users) if password was not set above, generate
- if (subjectTO instanceof UserTO && StringUtils.isBlank(((UserTO) subjectTO).getPassword())) {
- final UserTO userTO = (UserTO) subjectTO;
-
- List<PasswordPolicySpec> ppSpecs = new ArrayList<>();
-
- PasswordPolicy globalPP = policyDAO.getGlobalPasswordPolicy();
- if (globalPP != null && globalPP.getSpecification(PasswordPolicySpec.class) != null) {
- ppSpecs.add(globalPP.getSpecification(PasswordPolicySpec.class));
- }
-
- for (MembershipTO memb : userTO.getMemberships()) {
- Group group = groupDAO.find(memb.getGroupId());
- if (group != null && group.getPasswordPolicy() != null
- && group.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
-
- ppSpecs.add(group.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
- }
- }
-
- for (String resName : userTO.getResources()) {
- ExternalResource resource = resourceDAO.find(resName);
- if (resource != null && resource.getPasswordPolicy() != null
- && resource.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
-
- ppSpecs.add(resource.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
- }
- }
-
- String password;
- try {
- password = pwdGen.generate(ppSpecs);
- } catch (InvalidPasswordPolicySpecException e) {
- LOG.error("Could not generate policy-compliant random password for {}", userTO, e);
-
- password = SecureRandomUtil.generateRandomPassword(16);
- }
- userTO.setPassword(password);
- }
-
- return subjectTO;
- }
-
- /**
- * Build an UserMod out of connector object attributes and schema mapping.
- *
- * @param key user to be updated
- * @param obj connector object
- * @param original subject to get diff from
- * @param syncTask synchronization task
- * @param attrUtil AttributableUtil
- * @param <T> user/group
- * @return modifications for the user/group to be updated
- */
- @SuppressWarnings("unchecked")
- @Transactional(readOnly = true)
- public <T extends AbstractAttributableMod> T getAttributableMod(final Long key, final ConnectorObject obj,
- final AbstractAttributableTO original, final SyncTask syncTask, final AttributableUtil attrUtil) {
-
- final AbstractAttributableTO updated = getSubjectTOFromConnObject(obj, syncTask, attrUtil);
- updated.setKey(key);
-
- if (AttributableType.USER == attrUtil.getType()) {
- // update password if and only if password is really changed
- final User user = userDAO.authFetch(key);
- if (StringUtils.isBlank(((UserTO) updated).getPassword())
- || encryptor.verify(((UserTO) updated).getPassword(),
- user.getCipherAlgorithm(), user.getPassword())) {
-
- ((UserTO) updated).setPassword(null);
- }
-
- for (MembershipTO membTO : ((UserTO) updated).getMemberships()) {
- Membership memb = user.getMembership(membTO.getGroupId());
- if (memb != null) {
- membTO.setKey(memb.getKey());
- }
- }
-
- return (T) AttributableOperations.diff(((UserTO) updated), ((UserTO) original), true);
- }
- if (AttributableType.GROUP == attrUtil.getType()) {
- // reading from connector object cannot change entitlements
- ((GroupTO) updated).getEntitlements().addAll(((GroupTO) original).getEntitlements());
- return (T) AttributableOperations.diff(((GroupTO) updated), ((GroupTO) original), true);
- }
-
- return null;
- }
-
- private <T extends AbstractSubjectTO> T getSubjectTOFromConnObject(final ConnectorObject obj,
- final SyncTask syncTask, final AttributableUtil attrUtil) {
-
- final T subjectTO = attrUtil.newSubjectTO();
-
- // 1. fill with data from connector object
- for (MappingItem item : attrUtil.getUidToMappingItems(
- syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)) {
-
- Attribute attribute = obj.getAttributeByName(item.getExtAttrName());
-
- AttrTO attributeTO;
- switch (item.getIntMappingType()) {
- case UserId:
- case GroupId:
- break;
-
- case Password:
- if (subjectTO instanceof UserTO && attribute != null && attribute.getValue() != null
- && !attribute.getValue().isEmpty()) {
-
- ((UserTO) subjectTO).setPassword(getPassword(attribute.getValue().get(0)));
- }
- break;
-
- case Username:
- if (subjectTO instanceof UserTO) {
- ((UserTO) subjectTO).setUsername(attribute == null || attribute.getValue().isEmpty()
- || attribute.getValue().get(0) == null
- ? null
- : attribute.getValue().get(0).toString());
- }
- break;
-
- case GroupName:
- if (subjectTO instanceof GroupTO) {
- ((GroupTO) subjectTO).setName(attribute == null || attribute.getValue().isEmpty()
- || attribute.getValue().get(0) == null
- ? null
- : attribute.getValue().get(0).toString());
- }
- break;
-
- case GroupOwnerSchema:
- if (subjectTO instanceof GroupTO && attribute != null) {
- // using a special attribute (with schema "", that will be ignored) for carrying the
- // GroupOwnerSchema value
- attributeTO = new AttrTO();
- attributeTO.setSchema(StringUtils.EMPTY);
- if (attribute.getValue().isEmpty() || attribute.getValue().get(0) == null) {
- attributeTO.getValues().add(StringUtils.EMPTY);
- } else {
- attributeTO.getValues().add(attribute.getValue().get(0).toString());
- }
-
- ((GroupTO) subjectTO).getPlainAttrs().add(attributeTO);
- }
- break;
-
- case UserPlainSchema:
- case GroupPlainSchema:
- attributeTO = new AttrTO();
- attributeTO.setSchema(item.getIntAttrName());
-
- PlainSchema schema = plainSchemaDAO.find(item.getIntAttrName(), attrUtil.plainSchemaClass());
-
- for (Object value : attribute == null || attribute.getValue() == null
- ? Collections.emptyList()
- : attribute.getValue()) {
-
- AttrSchemaType schemaType = schema == null ? AttrSchemaType.String : schema.getType();
- if (value != null) {
- final PlainAttrValue attrValue = attrUtil.newPlainAttrValue();
- switch (schemaType) {
- case String:
- attrValue.setStringValue(value.toString());
- break;
-
- case Binary:
- attrValue.setBinaryValue((byte[]) value);
- break;
-
- default:
- try {
- attrValue.parseValue(schema, value.toString());
- } catch (ParsingValidationException e) {
- LOG.error("While parsing provided value {}", value, e);
- attrValue.setStringValue(value.toString());
- schemaType = AttrSchemaType.String;
- }
- break;
- }
- attributeTO.getValues().add(attrValue.getValueAsString(schemaType));
- }
- }
-
- subjectTO.getPlainAttrs().add(attributeTO);
- break;
-
- case UserDerivedSchema:
- case GroupDerivedSchema:
- attributeTO = new AttrTO();
- attributeTO.setSchema(item.getIntAttrName());
- subjectTO.getDerAttrs().add(attributeTO);
- break;
-
- case UserVirtualSchema:
- case GroupVirtualSchema:
- attributeTO = new AttrTO();
- attributeTO.setSchema(item.getIntAttrName());
-
- for (Object value : attribute == null || attribute.getValue() == null
- ? Collections.emptyList()
- : attribute.getValue()) {
-
- if (value != null) {
- attributeTO.getValues().add(value.toString());
- }
- }
-
- subjectTO.getVirAttrs().add(attributeTO);
- break;
-
- default:
- }
- }
-
- // 2. add data from defined template (if any)
- AbstractSubjectTO template = AttributableType.USER == attrUtil.getType()
- ? syncTask.getUserTemplate() : syncTask.getGroupTemplate();
-
- if (template != null) {
- if (template instanceof UserTO) {
- if (StringUtils.isNotBlank(((UserTO) template).getUsername())) {
- String evaluated = JexlUtil.evaluate(((UserTO) template).getUsername(), subjectTO);
- if (StringUtils.isNotBlank(evaluated)) {
- ((UserTO) subjectTO).setUsername(evaluated);
- }
- }
-
- if (StringUtils.isNotBlank(((UserTO) template).getPassword())) {
- String evaluated = JexlUtil.evaluate(((UserTO) template).getPassword(), subjectTO);
- if (StringUtils.isNotBlank(evaluated)) {
- ((UserTO) subjectTO).setPassword(evaluated);
- }
- }
-
- Map<Long, MembershipTO> currentMembs = ((UserTO) subjectTO).getMembershipMap();
- for (MembershipTO membTO : ((UserTO) template).getMemberships()) {
- MembershipTO membTBU;
- if (currentMembs.containsKey(membTO.getGroupId())) {
- membTBU = currentMembs.get(membTO.getGroupId());
- } else {
- membTBU = new MembershipTO();
- membTBU.setGroupId(membTO.getGroupId());
- ((UserTO) subjectTO).getMemberships().add(membTBU);
- }
- fillFromTemplate(membTBU, membTO);
- }
- }
- if (template instanceof GroupTO) {
- if (StringUtils.isNotBlank(((GroupTO) template).getName())) {
- String evaluated = JexlUtil.evaluate(((GroupTO) template).getName(), subjectTO);
- if (StringUtils.isNotBlank(evaluated)) {
- ((GroupTO) subjectTO).setName(evaluated);
- }
- }
-
- if (((GroupTO) template).getParent() != 0) {
- final Group parentGroup = groupDAO.find(((GroupTO) template).getParent());
- if (parentGroup != null) {
- ((GroupTO) subjectTO).setParent(parentGroup.getKey());
- }
- }
-
- if (((GroupTO) template).getUserOwner() != null) {
- final User userOwner = userDAO.find(((GroupTO) template).getUserOwner());
- if (userOwner != null) {
- ((GroupTO) subjectTO).setUserOwner(userOwner.getKey());
- }
- }
- if (((GroupTO) template).getGroupOwner() != null) {
- final Group groupOwner = groupDAO.find(((GroupTO) template).getGroupOwner());
- if (groupOwner != null) {
- ((GroupTO) subjectTO).setGroupOwner(groupOwner.getKey());
- }
- }
-
- ((GroupTO) subjectTO).getEntitlements().addAll(((GroupTO) template).getEntitlements());
-
- ((GroupTO) subjectTO).getGPlainAttrTemplates().addAll(((GroupTO) template).getGPlainAttrTemplates());
- ((GroupTO) subjectTO).getGDerAttrTemplates().addAll(((GroupTO) template).getGDerAttrTemplates());
- ((GroupTO) subjectTO).getGVirAttrTemplates().addAll(((GroupTO) template).getGVirAttrTemplates());
- ((GroupTO) subjectTO).getMPlainAttrTemplates().addAll(((GroupTO) template).getMPlainAttrTemplates());
- ((GroupTO) subjectTO).getMDerAttrTemplates().addAll(((GroupTO) template).getMDerAttrTemplates());
- ((GroupTO) subjectTO).getMVirAttrTemplates().addAll(((GroupTO) template).getMVirAttrTemplates());
-
- ((GroupTO) subjectTO).setAccountPolicy(((GroupTO) template).getAccountPolicy());
- ((GroupTO) subjectTO).setPasswordPolicy(((GroupTO) template).getPasswordPolicy());
-
- ((GroupTO) subjectTO).setInheritOwner(((GroupTO) template).isInheritOwner());
- ((GroupTO) subjectTO).setInheritTemplates(((GroupTO) template).isInheritTemplates());
- ((GroupTO) subjectTO).setInheritPlainAttrs(((GroupTO) template).isInheritPlainAttrs());
- ((GroupTO) subjectTO).setInheritDerAttrs(((GroupTO) template).isInheritDerAttrs());
- ((GroupTO) subjectTO).setInheritVirAttrs(((GroupTO) template).isInheritVirAttrs());
- ((GroupTO) subjectTO).setInheritPasswordPolicy(((GroupTO) template).isInheritPasswordPolicy());
- ((GroupTO) subjectTO).setInheritAccountPolicy(((GroupTO) template).isInheritAccountPolicy());
- }
-
- fillFromTemplate(subjectTO, template);
-
- for (String resource : template.getResources()) {
- subjectTO.getResources().add(resource);
- }
- }
-
- return subjectTO;
- }
-
- /**
- * Extract password value from passed value (if instance of GuardedString or GuardedByteArray).
- *
- * @param pwd received from the underlying connector
- * @return password value
- */
- public String getPassword(final Object pwd) {
- final StringBuilder result = new StringBuilder();
-
- if (pwd instanceof GuardedString) {
- ((GuardedString) pwd).access(new GuardedString.Accessor() {
-
- @Override
- public void access(final char[] clearChars) {
- result.append(clearChars);
- }
- });
- } else if (pwd instanceof GuardedByteArray) {
- ((GuardedByteArray) pwd).access(new GuardedByteArray.Accessor() {
-
- @Override
- public void access(final byte[] clearBytes) {
- result.append(new String(clearBytes));
- }
- });
- } else if (pwd instanceof String) {
- result.append((String) pwd);
- } else {
- result.append(pwd.toString());
- }
-
- return result.toString();
- }
-
- /**
- * Get connector object TO from a connector object.
- *
- * @param connObject connector object.
- * @return connector object TO.
- */
- public ConnObjectTO getConnObjectTO(final ConnectorObject connObject) {
- final ConnObjectTO connObjectTO = new ConnObjectTO();
-
- for (Attribute attr : connObject.getAttributes()) {
- AttrTO attrTO = new AttrTO();
- attrTO.setSchema(attr.getName());
-
- if (attr.getValue() != null) {
- for (Object value : attr.getValue()) {
- if (value != null) {
- if (value instanceof GuardedString || value instanceof GuardedByteArray) {
- attrTO.getValues().add(getPassword(value));
- } else if (value instanceof byte[]) {
- attrTO.getValues().add(Base64.encode((byte[]) value));
- } else {
- attrTO.getValues().add(value.toString());
- }
- }
- }
- }
-
- connObjectTO.getPlainAttrs().add(attrTO);
- }
-
- return connObjectTO;
- }
-
- /**
- * Query connected external resources for values to populated virtual attributes associated with the given owner.
- *
- * @param owner user or group
- * @param attrUtil attributable util
- */
- public void retrieveVirAttrValues(final Attributable<?, ?, ?> owner, final AttributableUtil attrUtil) {
- final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
- final ConnectorFactory connFactory = context.getBean(ConnectorFactory.class);
-
- final IntMappingType type = attrUtil.getType() == AttributableType.USER
- ? IntMappingType.UserVirtualSchema : attrUtil.getType() == AttributableType.GROUP
- ? IntMappingType.GroupVirtualSchema : IntMappingType.MembershipVirtualSchema;
-
- final Map<String, ConnectorObject> externalResources = new HashMap<>();
-
- // -----------------------
- // Retrieve virtual attribute values if and only if they have not been retrieved yet
- // -----------------------
- for (VirAttr virAttr : owner.getVirAttrs()) {
- // reset value set
- if (virAttr.getValues().isEmpty()) {
- retrieveVirAttrValue(owner, virAttr, attrUtil, type, externalResources, connFactory);
- }
- }
- // -----------------------
- }
-
- private void retrieveVirAttrValue(
- final Attributable<?, ?, ?> owner,
- final VirAttr virAttr,
- final AttributableUtil attrUtil,
- final IntMappingType type,
- final Map<String, ConnectorObject> externalResources,
- final ConnectorFactory connFactory) {
-
- final String schemaName = virAttr.getSchema().getKey();
- final VirAttrCacheValue virAttrCacheValue = virAttrCache.get(attrUtil.getType(), owner.getKey(), schemaName);
-
- LOG.debug("Retrieve values for virtual attribute {} ({})", schemaName, type);
-
- if (virAttrCache.isValidEntry(virAttrCacheValue)) {
- // cached ...
- LOG.debug("Values found in cache {}", virAttrCacheValue);
- virAttr.getValues().clear();
- virAttr.getValues().addAll(new ArrayList<>(virAttrCacheValue.getValues()));
- } else {
- // not cached ...
- LOG.debug("Need one or more remote connections");
-
- final VirAttrCacheValue toBeCached = new VirAttrCacheValue();
-
- // SYNCOPE-458 if virattr owner is a Membership, owner must become user involved in membership because
- // membership mapping is contained in user mapping
- final Subject<?, ?, ?> realOwner = owner instanceof Membership
- ? ((Membership) owner).getUser()
- : (Subject) owner;
-
- final Set<ExternalResource> targetResources = owner instanceof Membership
- ? getTargetResource(virAttr, type, attrUtil, realOwner.getResources())
- : getTargetResource(virAttr, type, attrUtil);
-
- for (ExternalResource resource : targetResources) {
- LOG.debug("Search values into {}", resource.getKey());
- try {
- final List<MappingItem> mappings = attrUtil.getMappingItems(resource, MappingPurpose.BOTH);
-
- final ConnectorObject connectorObject;
-
- if (externalResources.containsKey(resource.getKey())) {
- connectorObject = externalResources.get(resource.getKey());
- } else {
- LOG.debug("Perform connection to {}", resource.getKey());
- final String accountId = attrUtil.getAccountIdItem(resource) == null
- ? null
- : MappingUtil.getAccountIdValue(
- realOwner, resource, attrUtil.getAccountIdItem(resource));
-
- if (StringUtils.isBlank(accountId)) {
- throw new IllegalArgumentException("No AccountId found for " + resource.getKey());
- }
-
- final Connector connector = connFactory.getConnector(resource);
-
- final OperationOptions oo =
- connector.getOperationOptions(MappingUtil.getMatchingMappingItems(mappings, type));
-
- connectorObject = connector.getObject(fromSubject(realOwner), new Uid(accountId), oo);
- externalResources.put(resource.getKey(), connectorObject);
- }
-
- if (connectorObject != null) {
- // ask for searched virtual attribute value
- final List<MappingItem> virAttrMappings =
- MappingUtil.getMatchingMappingItems(mappings, schemaName, type);
-
- // the same virtual attribute could be mapped with one or more external attribute
- for (MappingItem mapping : virAttrMappings) {
- final Attribute attribute = connectorObject.getAttributeByName(mapping.getExtAttrName());
-
- if (attribute != null && attribute.getValue() != null) {
- for (Object obj : attribute.getValue()) {
- if (obj != null) {
- virAttr.getValues().add(obj.toString());
- }
- }
- }
- }
-
- toBeCached.setResourceValues(resource.getKey(), new HashSet<String>(virAttr.getValues()));
-
- LOG.debug("Retrieved values {}", virAttr.getValues());
- }
- } catch (Exception e) {
- LOG.error("Error reading connector object from {}", resource.getKey(), e);
-
- if (virAttrCacheValue != null) {
- toBeCached.forceExpiring();
- LOG.debug("Search for a cached value (even expired!) ...");
- final Set<String> cachedValues = virAttrCacheValue.getValues(resource.getKey());
- if (cachedValues != null) {
- LOG.debug("Use cached value {}", cachedValues);
- virAttr.getValues().addAll(cachedValues);
- toBeCached.setResourceValues(resource.getKey(), new HashSet<>(cachedValues));
- }
- }
- }
- }
-
- virAttrCache.put(attrUtil.getType(), owner.getKey(), schemaName, toBeCached);
- }
- }
-
- private Set<ExternalResource> getTargetResource(
- final VirAttr attr, final IntMappingType type, final AttributableUtil attrUtil) {
-
- final Set<ExternalResource> resources = new HashSet<>();
-
- if (attr.getOwner() instanceof Subject) {
- for (ExternalResource res : ((Subject<?, ?, ?>) attr.getOwner()).getResources()) {
- if (!MappingUtil.getMatchingMappingItems(
- attrUtil.getMappingItems(res, MappingPurpose.BOTH),
- attr.getSchema().getKey(), type).isEmpty()) {
-
- resources.add(res);
- }
- }
- }
-
- return resources;
- }
-
- private Set<ExternalResource> getTargetResource(final VirAttr attr, final IntMappingType type,
- final AttributableUtil attrUtil, final Set<? extends ExternalResource> ownerResources) {
-
- final Set<ExternalResource> resources = new HashSet<>();
-
- for (ExternalResource res : ownerResources) {
- if (!MappingUtil.getMatchingMappingItems(
- attrUtil.getMappingItems(res, MappingPurpose.BOTH),
- attr.getSchema().getKey(), type).isEmpty()) {
-
- resources.add(res);
- }
- }
-
- return resources;
- }
-
- private void fillFromTemplate(final AbstractAttributableTO attributableTO, final AbstractAttributableTO template) {
- Map<String, AttrTO> currentAttrMap = attributableTO.getPlainAttrMap();
- for (AttrTO templateAttr : template.getPlainAttrs()) {
- if (templateAttr.getValues() != null && !templateAttr.getValues().isEmpty()
- && (!currentAttrMap.containsKey(templateAttr.getSchema())
- || currentAttrMap.get(templateAttr.getSchema()).getValues().isEmpty())) {
-
- attributableTO.getPlainAttrs().add(evaluateAttrTemplate(attributableTO, templateAttr));
- }
- }
-
- currentAttrMap = attributableTO.getDerAttrMap();
- for (AttrTO templateDerAttr : template.getDerAttrs()) {
- if (!currentAttrMap.containsKey(templateDerAttr.getSchema())) {
- attributableTO.getDerAttrs().add(templateDerAttr);
- }
- }
-
- currentAttrMap = attributableTO.getVirAttrMap();
- for (AttrTO templateVirAttr : template.getVirAttrs()) {
- if (templateVirAttr.getValues() != null && !templateVirAttr.getValues().isEmpty()
- && (!currentAttrMap.containsKey(templateVirAttr.getSchema())
- || currentAttrMap.get(templateVirAttr.getSchema()).getValues().isEmpty())) {
-
- attributableTO.getVirAttrs().add(evaluateAttrTemplate(attributableTO, templateVirAttr));
- }
- }
- }
-
- private AttrTO evaluateAttrTemplate(final AbstractAttributableTO attributableTO, final AttrTO template) {
- AttrTO result = new AttrTO();
- result.setSchema(template.getSchema());
-
- if (template.getValues() != null && !template.getValues().isEmpty()) {
- for (String value : template.getValues()) {
- String evaluated = JexlUtil.evaluate(value, attributableTO);
- if (StringUtils.isNotBlank(evaluated)) {
- result.getValues().add(evaluated);
- }
- }
- }
-
- return result;
- }
-
- /**
- * Transform a
- * <code>Collection</code> of {@link Attribute} instances into a {@link Map}. The key to each element in the map is
- * the <i>name</i> of an
- * <code>Attribute</code>. The value of each element in the map is the
- * <code>Attribute</code> instance with that name. <br/> Different from the original because: <ul> <li>map keys are
- * transformed toUpperCase()</li> <li>returned map is mutable</li> </ul>
- *
- * @param attributes set of attribute to transform to a map.
- * @return a map of string and attribute.
- *
- * @see org.identityconnectors.framework.common.objects.AttributeUtil#toMap(java.util.Collection)
- */
- public Map<String, Attribute> toMap(final Collection<? extends Attribute> attributes) {
- final Map<String, Attribute> map = new HashMap<>();
- for (Attribute attr : attributes) {
- map.put(attr.getName().toUpperCase(), attr);
- }
- return map;
- }
-}
[10/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttributableSearchTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttributableSearchTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttributableSearchTest.java
index 052143f..dc338b6 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttributableSearchTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttributableSearchTest.java
@@ -29,9 +29,9 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
@@ -40,7 +40,7 @@ import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.dao.search.ResourceCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.dao.search.SubjectCond;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+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.jpa.AbstractTest;
import org.junit.Test;
@@ -54,7 +54,7 @@ public class AttributableSearchTest extends AbstractTest {
private UserDAO userDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private SubjectSearchDAO searchDAO;
@@ -68,25 +68,25 @@ public class AttributableSearchTest extends AbstractTest {
assertNotNull(user);
MembershipCond membershipCond = new MembershipCond();
- membershipCond.setRoleId(5L);
+ membershipCond.setGroupId(5L);
assertFalse(searchDAO.matches(user, SearchCond.getLeafCond(membershipCond), SubjectType.USER));
- membershipCond.setRoleId(1L);
+ membershipCond.setGroupId(1L);
assertTrue(searchDAO.matches(user, SearchCond.getLeafCond(membershipCond), SubjectType.USER));
}
@Test
- public void roleMatch() {
- Role role = roleDAO.find(1L);
- assertNotNull(role);
+ public void groupMatch() {
+ Group group = groupDAO.find(1L);
+ assertNotNull(group);
AttributeCond attrCond = new AttributeCond();
attrCond.setSchema("show");
attrCond.setType(AttributeCond.Type.ISNOTNULL);
- assertTrue(searchDAO.matches(role, SearchCond.getLeafCond(attrCond), SubjectType.ROLE));
+ assertTrue(searchDAO.matches(group, SearchCond.getLeafCond(attrCond), SubjectType.GROUP));
}
@Test
@@ -96,7 +96,7 @@ public class AttributableSearchTest extends AbstractTest {
fullnameLeafCond.setExpression("%o%");
MembershipCond membershipCond = new MembershipCond();
- membershipCond.setRoleId(1L);
+ membershipCond.setGroupId(1L);
AttributeCond loginDateCond = new AttributeCond(AttributeCond.Type.EQ);
loginDateCond.setSchema("loginDate");
@@ -112,7 +112,7 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(cond.isValid());
List<User> users =
- searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
+ searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
}
@@ -127,7 +127,7 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(cond.isValid());
List<User> users =
- searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
+ searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
assertNotNull(users);
assertEquals(4, users.size());
@@ -149,7 +149,7 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(cond.isValid());
List<User> users =
- searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
+ searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
@@ -163,7 +163,7 @@ public class AttributableSearchTest extends AbstractTest {
fullnameLeafCond.setExpression("%o%");
MembershipCond membershipCond = new MembershipCond();
- membershipCond.setRoleId(1L);
+ membershipCond.setGroupId(1L);
AttributeCond loginDateCond = new AttributeCond(AttributeCond.Type.EQ);
loginDateCond.setSchema("loginDate");
@@ -178,13 +178,13 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(cond.isValid());
- List<User> users = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
+ List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
cond, 1, 2, Collections.<OrderByClause>emptyList(),
SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
- users = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
+ users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
cond, 2, 2, Collections.<OrderByClause>emptyList(),
SubjectType.USER);
assertNotNull(users);
@@ -194,19 +194,17 @@ public class AttributableSearchTest extends AbstractTest {
@Test
public void searchByMembership() {
MembershipCond membershipCond = new MembershipCond();
- membershipCond.setRoleId(1L);
+ membershipCond.setGroupId(1L);
- List<User> users = searchDAO.search(
- RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), SearchCond.getLeafCond(membershipCond),
+ List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), SearchCond.getLeafCond(membershipCond),
SubjectType.USER);
assertNotNull(users);
assertEquals(2, users.size());
membershipCond = new MembershipCond();
- membershipCond.setRoleId(5L);
+ membershipCond.setGroupId(5L);
- users = searchDAO.search(
- RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), SearchCond.getNotLeafCond(membershipCond),
+ users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), SearchCond.getNotLeafCond(membershipCond),
SubjectType.USER);
assertNotNull(users);
assertEquals(5, users.size());
@@ -217,8 +215,7 @@ public class AttributableSearchTest extends AbstractTest {
AttributeCond coolLeafCond = new AttributeCond(AttributeCond.Type.ISNULL);
coolLeafCond.setSchema("cool");
- List<User> users = searchDAO.search(
- RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), SearchCond.getLeafCond(coolLeafCond),
+ List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), SearchCond.getLeafCond(coolLeafCond),
SubjectType.USER);
assertNotNull(users);
assertEquals(4, users.size());
@@ -226,8 +223,7 @@ public class AttributableSearchTest extends AbstractTest {
coolLeafCond = new AttributeCond(AttributeCond.Type.ISNOTNULL);
coolLeafCond.setSchema("cool");
- users = searchDAO.search(
- RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), SearchCond.getLeafCond(coolLeafCond),
+ users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), SearchCond.getLeafCond(coolLeafCond),
SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
@@ -245,8 +241,7 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(searchCondition.isValid());
- List<User> users = searchDAO.search(
- RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), searchCondition,
+ List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), searchCondition,
SubjectType.USER);
assertNotNull(users);
@@ -261,10 +256,10 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond searchCondition = SearchCond.getLeafCond(booleanCond);
- List<Role> matchingRoles = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
- searchCondition, SubjectType.ROLE);
- assertNotNull(matchingRoles);
- assertFalse(matchingRoles.isEmpty());
+ List<Group> matchingGroups = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ searchCondition, SubjectType.GROUP);
+ assertNotNull(matchingGroups);
+ assertFalse(matchingGroups.isEmpty());
}
@Test
@@ -280,7 +275,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond searchCondition = SearchCond.getAndCond(SearchCond.getLeafCond(usernameLeafCond),
SearchCond.getLeafCond(idRightCond));
- List<User> matchingUsers = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
+ List<User> matchingUsers = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
searchCondition, SubjectType.USER);
assertNotNull(matchingUsers);
@@ -290,27 +285,27 @@ public class AttributableSearchTest extends AbstractTest {
}
@Test
- public void searchByRolenameAndKey() {
- SubjectCond rolenameLeafCond = new SubjectCond(SubjectCond.Type.EQ);
- rolenameLeafCond.setSchema("name");
- rolenameLeafCond.setExpression("root");
+ public void searchByGroupNameAndKey() {
+ SubjectCond groupNameLeafCond = new SubjectCond(SubjectCond.Type.EQ);
+ groupNameLeafCond.setSchema("name");
+ groupNameLeafCond.setExpression("root");
SubjectCond idRightCond = new SubjectCond(SubjectCond.Type.LT);
idRightCond.setSchema("key");
idRightCond.setExpression("2");
- SearchCond searchCondition = SearchCond.getAndCond(SearchCond.getLeafCond(rolenameLeafCond),
+ SearchCond searchCondition = SearchCond.getAndCond(SearchCond.getLeafCond(groupNameLeafCond),
SearchCond.getLeafCond(idRightCond));
assertTrue(searchCondition.isValid());
- List<Role> matchingRoles = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
- searchCondition, SubjectType.ROLE);
+ List<Group> matchingGroups = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ searchCondition, SubjectType.GROUP);
- assertNotNull(matchingRoles);
- assertEquals(1, matchingRoles.size());
- assertEquals("root", matchingRoles.iterator().next().getName());
- assertEquals(1L, matchingRoles.iterator().next().getKey().longValue());
+ assertNotNull(matchingGroups);
+ assertEquals(1, matchingGroups.size());
+ assertEquals("root", matchingGroups.iterator().next().getName());
+ assertEquals(1L, matchingGroups.iterator().next().getKey().longValue());
}
@Test
@@ -327,7 +322,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond.getLeafCond(idRightCond));
List<User> matchingUsers =
- searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), searchCondition,
+ searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), searchCondition,
SubjectType.USER);
assertNotNull(matchingUsers);
@@ -344,7 +339,7 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(searchCondition.isValid());
List<User> users =
- searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), searchCondition,
+ searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), searchCondition,
SubjectType.USER);
assertNotNull(users);
@@ -358,7 +353,7 @@ public class AttributableSearchTest extends AbstractTest {
searchCondition = SearchCond.getNotLeafCond(idLeafCond);
assertTrue(searchCondition.isValid());
- users = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), searchCondition,
+ users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), searchCondition,
SubjectType.USER);
assertNotNull(users);
@@ -393,16 +388,16 @@ public class AttributableSearchTest extends AbstractTest {
orderByClause.setDirection(OrderByClause.Direction.ASC);
orderByClauses.add(orderByClause);
- List<User> users = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
+ List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
searchCondition, Collections.singletonList(orderByClause),
SubjectType.USER);
- assertEquals(searchDAO.count(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
+ assertEquals(searchDAO.count(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
searchCondition, SubjectType.USER),
users.size());
}
@Test
- public void roleOrderBy() {
+ public void groupOrderBy() {
SubjectCond idLeafCond = new SubjectCond(SubjectCond.Type.LIKE);
idLeafCond.setSchema("name");
idLeafCond.setExpression("%r");
@@ -412,11 +407,11 @@ public class AttributableSearchTest extends AbstractTest {
OrderByClause orderByClause = new OrderByClause();
orderByClause.setField("name");
- List<Role> roles = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
- searchCondition, Collections.singletonList(orderByClause), SubjectType.ROLE);
- assertEquals(searchDAO.count(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
- searchCondition, SubjectType.ROLE),
- roles.size());
+ List<Group> groups = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ searchCondition, Collections.singletonList(orderByClause), SubjectType.GROUP);
+ assertEquals(searchDAO.count(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ searchCondition, SubjectType.GROUP),
+ groups.size());
}
@Test
@@ -431,7 +426,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond.getAndCond(SearchCond.getNotLeafCond(ws2), SearchCond.getNotLeafCond(ws1));
assertTrue(searchCondition.isValid());
- List<User> users = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
+ List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
searchCondition, SubjectType.USER);
assertNotNull(users);
assertEquals(2, users.size());
@@ -453,7 +448,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond searchCondition = SearchCond.getLeafCond(cond);
assertTrue(searchCondition.isValid());
- List<User> users = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
+ List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
searchCondition, SubjectType.USER);
assertNotNull(users);
assertTrue(users.isEmpty());
@@ -468,7 +463,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond searchCondition = SearchCond.getLeafCond(cond);
assertTrue(searchCondition.isValid());
- List<User> users = searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
+ List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
searchCondition, SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
@@ -486,7 +481,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond searchCond = SearchCond.getOrCond(
SearchCond.getLeafCond(isNullCond), SearchCond.getLeafCond(likeCond));
- Integer count = searchDAO.count(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), searchCond,
+ Integer count = searchDAO.count(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), searchCond,
SubjectType.USER);
assertNotNull(count);
assertTrue(count > 0);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerAttrTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerAttrTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerAttrTest.java
index b1c6c91..67765b1 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerAttrTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerAttrTest.java
@@ -28,18 +28,18 @@ import java.util.List;
import org.apache.syncope.core.persistence.api.dao.DerAttrDAO;
import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.MembershipDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.membership.MDerAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
@@ -62,7 +62,7 @@ public class DerAttrTest extends AbstractTest {
private MembershipDAO membershipDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private DerSchemaDAO derSchemaDAO;
@@ -110,7 +110,7 @@ public class DerAttrTest extends AbstractTest {
MDerAttr derAttr = entityFactory.newEntity(MDerAttr.class);
derAttr.setOwner(owner);
- derAttr.setTemplate(owner.getRole().getAttrTemplate(MDerAttrTemplate.class, "mderiveddata"));
+ derAttr.setTemplate(owner.getGroup().getAttrTemplate(MDerAttrTemplate.class, "mderiveddata"));
derAttr = derAttrDAO.save(derAttr);
assertNotNull(derAttr.getTemplate());
@@ -127,22 +127,22 @@ public class DerAttrTest extends AbstractTest {
@Test
public void saveRDerAttribute() {
- Role owner = roleDAO.find(1L);
+ Group owner = groupDAO.find(1L);
assertNotNull("did not get expected user", owner);
- RDerAttr derAttr = entityFactory.newEntity(RDerAttr.class);
+ GDerAttr derAttr = entityFactory.newEntity(GDerAttr.class);
derAttr.setOwner(owner);
- derAttr.setTemplate(owner.getAttrTemplate(RDerAttrTemplate.class, "rderiveddata"));
+ derAttr.setTemplate(owner.getAttrTemplate(GDerAttrTemplate.class, "rderiveddata"));
derAttr = derAttrDAO.save(derAttr);
assertNotNull(derAttr.getTemplate());
- RDerAttr actual = derAttrDAO.find(derAttr.getKey(), RDerAttr.class);
+ GDerAttr actual = derAttrDAO.find(derAttr.getKey(), GDerAttr.class);
assertNotNull("expected save to work", actual);
assertEquals(derAttr, actual);
- RPlainAttrValue sx = owner.getPlainAttr("rderived_sx").getValues().iterator().next();
- RPlainAttrValue dx = owner.getPlainAttr("rderived_dx").getValues().iterator().next();
+ GPlainAttrValue sx = owner.getPlainAttr("rderived_sx").getValues().iterator().next();
+ GPlainAttrValue dx = owner.getPlainAttr("rderived_dx").getValues().iterator().next();
assertEquals(sx.getValue() + "-" + dx.getValue(), derAttr.getValue(owner.getPlainAttrs()));
}
@@ -195,34 +195,34 @@ public class DerAttrTest extends AbstractTest {
}
@Test
- public void issueSYNCOPE134Role() {
- RDerSchema sderived = entityFactory.newEntity(RDerSchema.class);
+ public void issueSYNCOPE134Group() {
+ GDerSchema sderived = entityFactory.newEntity(GDerSchema.class);
sderived.setKey("sderived");
sderived.setExpression("name");
sderived = derSchemaDAO.save(sderived);
derSchemaDAO.flush();
- RDerSchema actual = derSchemaDAO.find("sderived", RDerSchema.class);
+ GDerSchema actual = derSchemaDAO.find("sderived", GDerSchema.class);
assertNotNull("expected save to work", actual);
assertEquals(sderived, actual);
- Role owner = roleDAO.find(7L);
- assertNotNull("did not get expected role", owner);
+ Group owner = groupDAO.find(7L);
+ assertNotNull("did not get expected group", owner);
- RDerAttrTemplate template = entityFactory.newEntity(RDerAttrTemplate.class);
+ GDerAttrTemplate template = entityFactory.newEntity(GDerAttrTemplate.class);
template.setSchema(sderived);
- owner.getAttrTemplates(RDerAttrTemplate.class).add(template);
+ owner.getAttrTemplates(GDerAttrTemplate.class).add(template);
- RDerAttr derAttr = entityFactory.newEntity(RDerAttr.class);
+ GDerAttr derAttr = entityFactory.newEntity(GDerAttr.class);
derAttr.setOwner(owner);
- derAttr.setTemplate(owner.getAttrTemplate(RDerAttrTemplate.class, sderived.getKey()));
+ derAttr.setTemplate(owner.getAttrTemplate(GDerAttrTemplate.class, sderived.getKey()));
derAttr = derAttrDAO.save(derAttr);
assertNotNull(derAttr.getTemplate());
derAttrDAO.flush();
- derAttr = derAttrDAO.find(derAttr.getKey(), RDerAttr.class);
+ derAttr = derAttrDAO.find(derAttr.getKey(), GDerAttr.class);
assertNotNull("expected save to work", derAttr);
String value = derAttr.getValue(owner.getPlainAttrs());
@@ -249,13 +249,13 @@ public class DerAttrTest extends AbstractTest {
MDerAttrTemplate template = entityFactory.newEntity(MDerAttrTemplate.class);
template.setSchema(mderived);
- owner.getRole().getAttrTemplates(MDerAttrTemplate.class).add(template);
+ owner.getGroup().getAttrTemplates(MDerAttrTemplate.class).add(template);
derSchemaDAO.flush();
MDerAttr derAttr = entityFactory.newEntity(MDerAttr.class);
derAttr.setOwner(owner);
- derAttr.setTemplate(owner.getRole().getAttrTemplate(MDerAttrTemplate.class, mderived.getKey()));
+ derAttr.setTemplate(owner.getGroup().getAttrTemplate(MDerAttrTemplate.class, mderived.getKey()));
derAttr = derAttrDAO.save(derAttr);
assertNotNull(derAttr.getTemplate());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerSchemaTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerSchemaTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerSchemaTest.java
index 5a65f13..e7f7533 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerSchemaTest.java
@@ -30,7 +30,7 @@ import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
import org.junit.Test;
@@ -79,12 +79,12 @@ public class DerSchemaTest extends AbstractTest {
assertNull("delete did not work", actual);
// ------------- //
- RDerSchema rderiveddata = derSchemaDAO.find("rderiveddata", RDerSchema.class);
+ GDerSchema rderiveddata = derSchemaDAO.find("rderiveddata", GDerSchema.class);
assertNotNull(rderiveddata);
- derSchemaDAO.delete(rderiveddata.getKey(), attrUtilFactory.getInstance(AttributableType.ROLE));
+ derSchemaDAO.delete(rderiveddata.getKey(), attrUtilFactory.getInstance(AttributableType.GROUP));
- actual = derSchemaDAO.find("rderiveddata", RDerSchema.class);
+ actual = derSchemaDAO.find("rderiveddata", GDerSchema.class);
assertNull("delete did not work", actual);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/GroupTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/GroupTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/GroupTest.java
new file mode 100644
index 0000000..2d14abe
--- /dev/null
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/GroupTest.java
@@ -0,0 +1,141 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.List;
+import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.jpa.AbstractTest;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class GroupTest extends AbstractTest {
+
+ @Autowired
+ private GroupDAO groupDAO;
+
+ @Autowired
+ private PolicyDAO policyDAO;
+
+ @Test
+ public void findAll() {
+ List<Group> list = groupDAO.findAll();
+ assertEquals("did not get expected number of groups ", 14, list.size());
+ }
+
+ @Test
+ public void findChildren() {
+ assertEquals(3, groupDAO.findChildren(groupDAO.find(4L)).size());
+ }
+
+ @Test
+ public void find() {
+ Group group = groupDAO.find("root", null);
+ assertNotNull("did not find expected group", group);
+ group = groupDAO.find(null, null);
+ assertNull("found group but did not expect it", group);
+ }
+
+ @Test
+ public void inheritedAttributes() {
+ Group director = groupDAO.find(7L);
+
+ assertEquals(1, director.findLastInheritedAncestorPlainAttrs().size());
+ }
+
+ @Test
+ public void inheritedDerivedAttributes() {
+ Group director = groupDAO.find(7L);
+
+ assertEquals(1, director.findLastInheritedAncestorDerAttrs().size());
+ }
+
+ @Test
+ public void inheritedVirtualAttributes() {
+ Group director = groupDAO.find(7L);
+
+ assertEquals(1, director.findLastInheritedAncestorVirAttrs().size());
+ }
+
+ @Test
+ public void inheritedPolicy() {
+ Group group = groupDAO.find(7L);
+ assertNotNull(group);
+
+ assertNotNull(group.getAccountPolicy());
+ assertNotNull(group.getPasswordPolicy());
+
+ assertEquals(4, group.getPasswordPolicy().getKey(), 0);
+
+ group = groupDAO.find(5L);
+
+ assertNotNull(group);
+
+ assertNull(group.getAccountPolicy());
+ assertNull(group.getPasswordPolicy());
+ }
+
+ @Test
+ public void save() {
+ Group group = entityFactory.newEntity(Group.class);
+ group.setName("secondChild");
+
+ // verify inheritance password and account policies
+ group.setInheritAccountPolicy(false);
+ // not inherited so setter execution shouldn't be ignored
+ group.setAccountPolicy((AccountPolicy) policyDAO.find(6L));
+
+ group.setInheritPasswordPolicy(true);
+ // inherited so setter execution should be ignored
+ group.setPasswordPolicy((PasswordPolicy) policyDAO.find(4L));
+
+ Group rootGroup = groupDAO.find("root", null);
+ group.setParent(rootGroup);
+
+ group = groupDAO.save(group);
+
+ Group actual = groupDAO.find(group.getKey());
+ assertNotNull("expected save to work", actual);
+
+ assertNull(group.getPasswordPolicy());
+ assertNotNull(group.getAccountPolicy());
+ assertEquals(Long.valueOf(6), group.getAccountPolicy().getKey());
+ }
+
+ @Test
+ public void delete() {
+ Group group = groupDAO.find(4L);
+ groupDAO.delete(group.getKey());
+
+ Group actual = groupDAO.find(4L);
+ assertNull("delete did not work", actual);
+
+ Group children = groupDAO.find(7L);
+ assertNull("delete of successors did not work", children);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/MembershipTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/MembershipTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/MembershipTest.java
index c5693c8..a623b14 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/MembershipTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/MembershipTest.java
@@ -24,10 +24,10 @@ import static org.junit.Assert.assertNull;
import java.util.List;
import org.apache.syncope.core.persistence.api.dao.MembershipDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+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.jpa.AbstractTest;
import org.junit.Test;
@@ -44,7 +44,7 @@ public class MembershipTest extends AbstractTest {
private UserDAO userDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Test
public void findAll() {
@@ -61,11 +61,11 @@ public class MembershipTest extends AbstractTest {
@Test
public void save() {
User user = userDAO.find(4L);
- Role role = roleDAO.find(1L);
+ Group group = groupDAO.find(1L);
Membership membership = entityFactory.newEntity(Membership.class);
membership.setUser(user);
- membership.setRole(role);
+ membership.setGroup(group);
membership = membershipDAO.save(membership);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/NotificationTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/NotificationTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/NotificationTest.java
index 8da3c21..f162259 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/NotificationTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/NotificationTest.java
@@ -110,9 +110,9 @@ public class NotificationTest extends AbstractTest {
@Test
public void issueSYNCOPE446() {
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("[REST]:[RoleController]:[]:[create]:[SUCCESS]");
+ notification.addEvent("[REST]:[GroupLogic]:[]:[create]:[SUCCESS]");
- notification.setRoleAbout("fake search condition");
+ notification.setGroupAbout("fake search condition");
notification.setRecipientAttrName("email");
notification.setRecipientAttrType(IntMappingType.UserPlainSchema);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PlainSchemaTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PlainSchemaTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PlainSchemaTest.java
index ece0825..8fc29de 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PlainSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PlainSchemaTest.java
@@ -32,8 +32,8 @@ import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
import org.junit.Test;
@@ -51,8 +51,8 @@ public class PlainSchemaTest extends AbstractTest {
List<UPlainSchema> userList = plainSchemaDAO.findAll(UPlainSchema.class);
assertEquals(15, userList.size());
- List<RPlainSchema> roleList = plainSchemaDAO.findAll(RPlainSchema.class);
- assertEquals(5, roleList.size());
+ List<GPlainSchema> groupList = plainSchemaDAO.findAll(GPlainSchema.class);
+ assertEquals(5, groupList.size());
}
@Test
@@ -63,12 +63,12 @@ public class PlainSchemaTest extends AbstractTest {
@Test
public void findAttrs() {
- List<RPlainSchema> schemas = plainSchemaDAO.findAll(RPlainSchema.class);
+ List<GPlainSchema> schemas = plainSchemaDAO.findAll(GPlainSchema.class);
assertNotNull(schemas);
assertFalse(schemas.isEmpty());
- for (RPlainSchema schema : schemas) {
- List<RPlainAttr> attrs = plainSchemaDAO.findAttrs(schema, RPlainAttr.class);
+ for (GPlainSchema schema : schemas) {
+ List<GPlainAttr> attrs = plainSchemaDAO.findAttrs(schema, GPlainAttr.class);
assertNotNull(attrs);
assertFalse(attrs.isEmpty());
}
@@ -105,7 +105,7 @@ public class PlainSchemaTest extends AbstractTest {
@Test
public void checkForEnumType() {
- RPlainSchema schema = entityFactory.newEntity(RPlainSchema.class);
+ GPlainSchema schema = entityFactory.newEntity(GPlainSchema.class);
schema.setType(AttrSchemaType.Enum);
schema.setKey("color");
@@ -122,7 +122,7 @@ public class PlainSchemaTest extends AbstractTest {
plainSchemaDAO.save(schema);
- RPlainSchema actual = plainSchemaDAO.find(schema.getKey(), RPlainSchema.class);
+ GPlainSchema actual = plainSchemaDAO.find(schema.getKey(), GPlainSchema.class);
assertNotNull(actual);
assertNotNull(actual.getEnumerationKeys());
assertFalse(actual.getEnumerationKeys().isEmpty());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
index 304fde0..7c943bb 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
@@ -108,7 +108,7 @@ public class PolicyTest extends AbstractTest {
SyncPolicySpec syncPolicySpec = new SyncPolicySpec();
syncPolicySpec.setUserJavaRule(syncURuleName);
- syncPolicySpec.setRoleJavaRule(syncRRuleName);
+ syncPolicySpec.setGroupJavaRule(syncRRuleName);
policy.setSpecification(syncPolicySpec);
policy.setDescription("Sync policy");
@@ -118,7 +118,7 @@ public class PolicyTest extends AbstractTest {
assertNotNull(policy);
assertEquals(PolicyType.SYNC, policy.getType());
assertEquals(syncURuleName, (policy.getSpecification(SyncPolicySpec.class)).getUserJavaRule());
- assertEquals(syncRRuleName, (policy.getSpecification(SyncPolicySpec.class)).getRoleJavaRule());
+ assertEquals(syncRRuleName, (policy.getSpecification(SyncPolicySpec.class)).getGroupJavaRule());
}
@Test
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/ResourceTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/ResourceTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/ResourceTest.java
index 103b9bb..a9340c3 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/ResourceTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/ResourceTest.java
@@ -189,7 +189,7 @@ public class ResourceTest extends AbstractTest {
}
@Test
- public void saveWithRoleMappingType() {
+ public void saveWithGroupMappingType() {
ExternalResource resource = entityFactory.newEntity(ExternalResource.class);
resource.setKey("ws-target-resource-basic-save-invalid");
@@ -209,7 +209,7 @@ public class ResourceTest extends AbstractTest {
item = entityFactory.newEntity(UMappingItem.class);
item.setIntAttrName("icon");
item.setExtAttrName("icon");
- item.setIntMappingType(IntMappingType.RolePlainSchema);
+ item.setIntMappingType(IntMappingType.GroupPlainSchema);
item.setPurpose(MappingPurpose.BOTH);
mapping.addItem(item);
@@ -229,7 +229,7 @@ public class ResourceTest extends AbstractTest {
items++;
if ("icon".equals(mapItem.getIntAttrName())) {
- assertTrue(IntMappingType.contains(AttributableType.ROLE,
+ assertTrue(IntMappingType.contains(AttributableType.GROUP,
mapItem.getIntMappingType().toString()));
}
if ("mderiveddata".equals(mapItem.getIntAttrName())) {
@@ -278,7 +278,7 @@ public class ResourceTest extends AbstractTest {
final UMappingItem item = entityFactory.newEntity(UMappingItem.class);
item.setIntAttrName("icon");
item.setExtAttrName("icon");
- item.setIntMappingType(IntMappingType.RolePlainSchema);
+ item.setIntMappingType(IntMappingType.GroupPlainSchema);
item.setPurpose(MappingPurpose.BOTH);
mapping.setAccountIdItem(item);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java
deleted file mode 100644
index 7bab7d4..0000000
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RoleTest.java
+++ /dev/null
@@ -1,142 +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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.List;
-import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
-import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class RoleTest extends AbstractTest {
-
- @Autowired
- private RoleDAO roleDAO;
-
- @Autowired
- private PolicyDAO policyDAO;
-
- @Test
- public void findAll() {
- List<Role> list = roleDAO.findAll();
- assertEquals("did not get expected number of roles ", 14, list.size());
- }
-
- @Test
- public void findChildren() {
- assertEquals(3, roleDAO.findChildren(roleDAO.find(4L)).size());
- }
-
- @Test
- public void find() {
- Role role = roleDAO.find("root", null);
- assertNotNull("did not find expected role", role);
- role = roleDAO.find(null, null);
- assertNull("found role but did not expect it", role);
- }
-
- @Test
- public void inheritedAttributes() {
- Role director = roleDAO.find(7L);
-
- assertEquals(1, director.findLastInheritedAncestorPlainAttrs().size());
- }
-
- @Test
- public void inheritedDerivedAttributes() {
- Role director = roleDAO.find(7L);
-
- assertEquals(1, director.findLastInheritedAncestorDerAttrs().size());
- }
-
- @Test
- public void inheritedVirtualAttributes() {
- Role director = roleDAO.find(7L);
-
- assertEquals(1, director.findLastInheritedAncestorVirAttrs().size());
- }
-
- @Test
- public void inheritedPolicy() {
- Role role = roleDAO.find(7L);
-
- assertNotNull(role);
-
- assertNotNull(role.getAccountPolicy());
- assertNotNull(role.getPasswordPolicy());
-
- assertEquals(4, role.getPasswordPolicy().getKey(), 0);
-
- role = roleDAO.find(5L);
-
- assertNotNull(role);
-
- assertNull(role.getAccountPolicy());
- assertNull(role.getPasswordPolicy());
- }
-
- @Test
- public void save() {
- Role role = entityFactory.newEntity(Role.class);
- role.setName("secondChild");
-
- // verify inheritance password and account policies
- role.setInheritAccountPolicy(false);
- // not inherited so setter execution shouldn't be ignored
- role.setAccountPolicy((AccountPolicy) policyDAO.find(6L));
-
- role.setInheritPasswordPolicy(true);
- // inherited so setter execution should be ignored
- role.setPasswordPolicy((PasswordPolicy) policyDAO.find(4L));
-
- Role rootRole = roleDAO.find("root", null);
- role.setParent(rootRole);
-
- role = roleDAO.save(role);
-
- Role actual = roleDAO.find(role.getKey());
- assertNotNull("expected save to work", actual);
-
- assertNull(role.getPasswordPolicy());
- assertNotNull(role.getAccountPolicy());
- assertEquals(Long.valueOf(6), role.getAccountPolicy().getKey());
- }
-
- @Test
- public void delete() {
- Role role = roleDAO.find(4L);
- roleDAO.delete(role.getKey());
-
- Role actual = roleDAO.find(4L);
- assertNull("delete did not work", actual);
-
- Role children = roleDAO.find(7L);
- assertNull("delete of successors did not work", children);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
index 38be1ac..f4a8298 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
@@ -27,7 +27,7 @@ import java.util.Date;
import java.util.List;
import java.util.Set;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
@@ -54,35 +54,35 @@ public class UserTest extends AbstractTest {
@Test
public void findAll() {
- List<User> list = userDAO.findAll(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), 1, 100);
+ List<User> list = userDAO.findAll(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), 1, 100);
assertEquals("did not get expected number of users ", 5, list.size());
}
@Test
public void count() {
- Integer count = userDAO.count(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()));
+ Integer count = userDAO.count(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()));
assertNotNull(count);
assertEquals(5, count.intValue());
}
@Test
public void findAllByPageAndSize() {
- Set<Long> allRoleIds = RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll());
+ Set<Long> allGroupKeys = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
// get first page
- List<User> list = userDAO.findAll(allRoleIds, 1, 2);
+ List<User> list = userDAO.findAll(allGroupKeys, 1, 2);
assertEquals("did not get expected number of users ", 2, list.size());
// get second page
- list = userDAO.findAll(allRoleIds, 2, 2);
+ list = userDAO.findAll(allGroupKeys, 2, 2);
assertEquals("did not get expected number of users ", 2, list.size());
// get second page with uncomplete set
- list = userDAO.findAll(allRoleIds, 2, 3);
+ list = userDAO.findAll(allGroupKeys, 2, 3);
assertEquals("did not get expected number of users ", 2, list.size());
// get unexistent page
- list = userDAO.findAll(allRoleIds, 3, 2);
+ list = userDAO.findAll(allGroupKeys, 3, 2);
assertEquals("did not get expected number of users ", 1, list.size());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirAttrTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirAttrTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirAttrTest.java
index 72c5509..9537d5e 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirAttrTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirAttrTest.java
@@ -24,16 +24,16 @@ import static org.junit.Assert.assertNull;
import java.util.List;
import org.apache.syncope.core.persistence.api.dao.MembershipDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.dao.VirAttrDAO;
import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
import org.apache.syncope.core.persistence.api.entity.user.UVirSchema;
import org.apache.syncope.core.persistence.api.entity.user.User;
@@ -52,7 +52,7 @@ public class VirAttrTest extends AbstractTest {
private UserDAO userDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private MembershipDAO membershipDAO;
@@ -98,7 +98,7 @@ public class VirAttrTest extends AbstractTest {
MVirAttr virAttr = entityFactory.newEntity(MVirAttr.class);
virAttr.setOwner(owner);
- virAttr.setTemplate(owner.getRole().getAttrTemplate(MVirAttrTemplate.class, "mvirtualdata"));
+ virAttr.setTemplate(owner.getGroup().getAttrTemplate(MVirAttrTemplate.class, "mvirtualdata"));
virAttr = virAttrDAO.save(virAttr);
assertNotNull(virAttr.getTemplate());
@@ -110,17 +110,17 @@ public class VirAttrTest extends AbstractTest {
@Test
public void saveRVirAttribute() {
- Role owner = roleDAO.find(3L);
+ Group owner = groupDAO.find(3L);
assertNotNull("did not get expected membership", owner);
- RVirAttr virAttr = entityFactory.newEntity(RVirAttr.class);
+ GVirAttr virAttr = entityFactory.newEntity(GVirAttr.class);
virAttr.setOwner(owner);
- virAttr.setTemplate(owner.getAttrTemplate(RVirAttrTemplate.class, "rvirtualdata"));
+ virAttr.setTemplate(owner.getAttrTemplate(GVirAttrTemplate.class, "rvirtualdata"));
virAttr = virAttrDAO.save(virAttr);
assertNotNull(virAttr.getTemplate());
- RVirAttr actual = virAttrDAO.find(virAttr.getKey(), RVirAttr.class);
+ GVirAttr actual = virAttrDAO.find(virAttr.getKey(), GVirAttr.class);
assertNotNull("expected save to work", actual);
assertEquals(virAttr, actual);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirSchemaTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirSchemaTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirSchemaTest.java
index b6738d4..f52e064 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/VirSchemaTest.java
@@ -30,7 +30,7 @@ import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
import org.apache.syncope.core.persistence.api.entity.user.UVirSchema;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
import org.junit.Test;
@@ -78,12 +78,12 @@ public class VirSchemaTest extends AbstractTest {
assertNull("delete did not work", actual);
// ------------- //
- RVirSchema rvirtualdata = virSchemaDAO.find("rvirtualdata", RVirSchema.class);
+ GVirSchema rvirtualdata = virSchemaDAO.find("rvirtualdata", GVirSchema.class);
assertNotNull(rvirtualdata);
- virSchemaDAO.delete(rvirtualdata.getKey(), attrUtilFactory.getInstance(AttributableType.ROLE));
+ virSchemaDAO.delete(rvirtualdata.getKey(), attrUtilFactory.getInstance(AttributableType.GROUP));
- actual = virSchemaDAO.find("rvirtualdata", RVirSchema.class);
+ actual = virSchemaDAO.find("rvirtualdata", GVirSchema.class);
assertNull("delete did not work", actual);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttrTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttrTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttrTest.java
index bc1e4cd..7cb2196 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttrTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttrTest.java
@@ -33,14 +33,14 @@ import org.apache.syncope.core.persistence.api.dao.MembershipDAO;
import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
import org.apache.syncope.core.persistence.api.dao.PlainAttrValueDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.membership.MPlainAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
@@ -73,7 +73,7 @@ public class AttrTest extends AbstractTest {
private MembershipDAO membershipDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private UserDAO userDAO;
@@ -119,7 +119,7 @@ public class AttrTest extends AbstractTest {
MPlainAttrTemplate template = entityFactory.newEntity(MPlainAttrTemplate.class);
template.setSchema(actualSchema);
- membership.getRole().getAttrTemplates(MPlainAttrTemplate.class).add(template);
+ membership.getGroup().getAttrTemplates(MPlainAttrTemplate.class).add(template);
MPlainAttr attr = entityFactory.newEntity(MPlainAttr.class);
attr.setTemplate(template);
@@ -172,20 +172,20 @@ public class AttrTest extends AbstractTest {
}
@Test
- public void unmatchedRoleAttr() {
- Role role = roleDAO.find(1L);
- assertNotNull(role);
+ public void unmatchedGroupAttr() {
+ Group group = groupDAO.find(1L);
+ assertNotNull(group);
- assertNotNull(role.getAttrTemplate(RPlainAttrTemplate.class, "icon"));
- assertNotNull(role.getPlainAttr("icon"));
+ assertNotNull(group.getAttrTemplate(GPlainAttrTemplate.class, "icon"));
+ assertNotNull(group.getPlainAttr("icon"));
- assertTrue(role.getAttrTemplates(RPlainAttrTemplate.class).
- remove(role.getAttrTemplate(RPlainAttrTemplate.class, "icon")));
+ assertTrue(group.getAttrTemplates(GPlainAttrTemplate.class).
+ remove(group.getAttrTemplate(GPlainAttrTemplate.class, "icon")));
- role = roleDAO.save(role);
- roleDAO.flush();
+ group = groupDAO.save(group);
+ groupDAO.flush();
- assertNull(role.getAttrTemplate(RPlainAttrTemplate.class, "icon"));
- assertNull(role.getPlainAttr("icon"));
+ assertNull(group.getAttrTemplate(GPlainAttrTemplate.class, "icon"));
+ assertNull(group.getPlainAttr("icon"));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttributableSearchTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttributableSearchTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttributableSearchTest.java
index ba67807..34338ce 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttributableSearchTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/AttributableSearchTest.java
@@ -26,13 +26,13 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+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.jpa.AbstractTest;
import org.junit.Test;
@@ -43,7 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
public class AttributableSearchTest extends AbstractTest {
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private SubjectSearchDAO searchDAO;
@@ -53,11 +53,11 @@ public class AttributableSearchTest extends AbstractTest {
@Test
public void issueSYNCOPE95() {
- Set<Role> roles = new HashSet<>(roleDAO.findAll());
- for (Role role : roles) {
- roleDAO.delete(role.getKey());
+ Set<Group> groups = new HashSet<>(groupDAO.findAll());
+ for (Group group : groups) {
+ groupDAO.delete(group.getKey());
}
- roleDAO.flush();
+ groupDAO.flush();
final AttributeCond coolLeafCond = new AttributeCond(AttributeCond.Type.EQ);
coolLeafCond.setSchema("cool");
@@ -67,7 +67,7 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(cond.isValid());
final List<User> users =
- searchDAO.search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
+ searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/EntitlementTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/EntitlementTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/EntitlementTest.java
index 0e2321d..b1f2eb1 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/EntitlementTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/EntitlementTest.java
@@ -24,9 +24,9 @@ import static org.junit.Assert.assertTrue;
import java.util.List;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,19 +39,19 @@ public class EntitlementTest extends AbstractTest {
private EntitlementDAO entitlementDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Test
public void delete() {
Entitlement entitlement = entitlementDAO.find("base");
assertNotNull("did not find expected entitlement", entitlement);
- List<Role> roles = roleDAO.findByEntitlement(entitlement);
- assertEquals("expected two roles", 2, roles.size());
+ List<Group> groups = groupDAO.findByEntitlement(entitlement);
+ assertEquals("expected two groups", 2, groups.size());
entitlementDAO.delete("base");
- roles = roleDAO.findByEntitlement(entitlement);
- assertTrue(roles.isEmpty());
+ groups = groupDAO.findByEntitlement(entitlement);
+ assertTrue(groups.isEmpty());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/GroupTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/GroupTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/GroupTest.java
new file mode 100644
index 0000000..80a6f7e
--- /dev/null
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/GroupTest.java
@@ -0,0 +1,145 @@
+/*
+ * 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.relationship;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
+import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
+import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
+import org.apache.syncope.core.persistence.api.dao.PlainAttrValueDAO;
+import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
+import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+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.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+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.jpa.AbstractTest;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class GroupTest extends AbstractTest {
+
+ @Autowired
+ private UserDAO userDAO;
+
+ @Autowired
+ private GroupDAO groupDAO;
+
+ @Autowired
+ private PlainSchemaDAO plainSchemaDAO;
+
+ @Autowired
+ private PlainAttrDAO plainAttrDAO;
+
+ @Autowired
+ private PlainAttrValueDAO plainAttrValueDAO;
+
+ @Autowired
+ private EntitlementDAO entitlementDAO;
+
+ @Autowired
+ private PolicyDAO policyDAO;
+
+ @Test(expected = InvalidEntityException.class)
+ public void saveWithTwoOwners() {
+ Group root = groupDAO.find("root", null);
+ assertNotNull("did not find expected group", root);
+
+ User user = userDAO.find(1L);
+ assertNotNull("did not find expected user", user);
+
+ Group group = entityFactory.newEntity(Group.class);
+ group.setName("error");
+ group.setUserOwner(user);
+ group.setGroupOwner(root);
+
+ groupDAO.save(group);
+ }
+
+ @Test
+ public void findByOwner() {
+ Group group = groupDAO.find(6L);
+ assertNotNull("did not find expected group", group);
+
+ User user = userDAO.find(5L);
+ assertNotNull("did not find expected user", user);
+
+ assertEquals(user, group.getUserOwner());
+
+ Group child1 = groupDAO.find(7L);
+ assertNotNull(child1);
+ assertEquals(group, child1.getParent());
+
+ Group child2 = groupDAO.find(10L);
+ assertNotNull(child2);
+ assertEquals(group, child2.getParent());
+
+ List<Group> ownedGroups = groupDAO.findOwnedByUser(user.getKey());
+ assertFalse(ownedGroups.isEmpty());
+ assertEquals(2, ownedGroups.size());
+ assertTrue(ownedGroups.contains(group));
+ assertTrue(ownedGroups.contains(child1));
+ assertFalse(ownedGroups.contains(child2));
+ }
+
+ public void createWithPasswordPolicy() {
+ PasswordPolicy policy = (PasswordPolicy) policyDAO.find(4L);
+ Group group = entityFactory.newEntity(Group.class);
+ group.setName("groupWithPasswordPolicy");
+ group.setPasswordPolicy(policy);
+
+ Group actual = groupDAO.save(group);
+ assertNotNull(actual);
+
+ actual = groupDAO.find(actual.getKey());
+ assertNotNull(actual);
+ assertNotNull(actual.getPasswordPolicy());
+
+ groupDAO.delete(actual.getKey());
+ assertNull(groupDAO.find(actual.getKey()));
+
+ assertNotNull(policyDAO.find(4L));
+ }
+
+ @Test
+ public void delete() {
+ groupDAO.delete(2L);
+
+ groupDAO.flush();
+
+ assertNull(groupDAO.find(2L));
+ assertEquals(1, groupDAO.findByEntitlement(entitlementDAO.find("base")).size());
+ assertEquals(userDAO.find(2L).getGroups().size(), 2);
+ assertNull(plainAttrDAO.find(700L, GPlainAttr.class));
+ assertNull(plainAttrValueDAO.find(41L, GPlainAttrValue.class));
+ assertNotNull(plainSchemaDAO.find("icon", GPlainSchema.class));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/MembershipTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/MembershipTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/MembershipTest.java
index 3a73d02..18fa39b 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/MembershipTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/MembershipTest.java
@@ -21,9 +21,9 @@ package org.apache.syncope.core.persistence.jpa.relationship;
import static org.junit.Assert.assertTrue;
import org.apache.syncope.core.persistence.api.dao.MembershipDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+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.jpa.AbstractTest;
import org.junit.Test;
@@ -37,13 +37,13 @@ public class MembershipTest extends AbstractTest {
private MembershipDAO membershipDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Test
public void delete() {
Membership membership = membershipDAO.find(4L);
User user = membership.getUser();
- Role role = membership.getRole();
+ Group group = membership.getGroup();
membershipDAO.delete(4L);
@@ -52,7 +52,7 @@ public class MembershipTest extends AbstractTest {
for (Membership m : user.getMemberships()) {
assertTrue(m.getKey() != 4L);
}
- for (Membership m : roleDAO.findMemberships(role)) {
+ for (Membership m : groupDAO.findMemberships(group)) {
assertTrue(m.getKey() != 4L);
}
}
@@ -61,7 +61,7 @@ public class MembershipTest extends AbstractTest {
public void deleteAndCreate() {
Membership membership = membershipDAO.find(3L);
User user = membership.getUser();
- Role role = membership.getRole();
+ Group group = membership.getGroup();
// 1. delete that membership
membershipDAO.delete(membership.getKey());
@@ -71,10 +71,10 @@ public class MembershipTest extends AbstractTest {
membershipDAO.flush();
// 2. (in the same transaction) create new membership with same user
- // and role (in order to check the UNIQE constraint on Membership)
+ // and group (in order to check the UNIQE constraint on Membership)
membership = entityFactory.newEntity(Membership.class);
membership.setUser(user);
- membership.setRole(role);
+ membership.setGroup(group);
membership = membershipDAO.save(membership);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/ResourceTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/ResourceTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/ResourceTest.java
index 9139804..89fe371 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/ResourceTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/ResourceTest.java
@@ -40,13 +40,13 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.role.RMappingItem;
+import org.apache.syncope.core.persistence.api.entity.group.GMappingItem;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.persistence.api.entity.user.UMapping;
import org.apache.syncope.core.persistence.api.entity.user.UMappingItem;
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.entity.role.JPARMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@@ -252,17 +252,17 @@ public class ResourceTest extends AbstractTest {
ExternalResource ldap = resourceDAO.find("resource-ldap");
assertNotNull(ldap);
assertNotNull(ldap.getUmapping());
- assertNotNull(ldap.getRmapping());
+ assertNotNull(ldap.getGmapping());
- List<? extends RMappingItem> items = ldap.getRmapping().getItems();
+ List<? extends GMappingItem> items = ldap.getGmapping().getItems();
assertNotNull(items);
assertFalse(items.isEmpty());
List<Long> itemIds = new ArrayList<>(items.size());
- for (RMappingItem item : items) {
+ for (GMappingItem item : items) {
itemIds.add(item.getKey());
}
- ldap.setRmapping(null);
+ ldap.setGmapping(null);
// need to avoid any class not defined in this Maven module
ldap.getPropagationActionsClassNames().clear();
@@ -271,7 +271,7 @@ public class ResourceTest extends AbstractTest {
resourceDAO.flush();
for (Long itemId : itemIds) {
- assertNull(entityManager.find(JPARMappingItem.class, itemId));
+ assertNull(entityManager.find(JPAGMappingItem.class, itemId));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/RoleTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/RoleTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/RoleTest.java
deleted file mode 100644
index db6bdb8..0000000
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/RoleTest.java
+++ /dev/null
@@ -1,145 +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.relationship;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
-import org.apache.syncope.core.persistence.api.dao.PlainAttrValueDAO;
-import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
-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.entity.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class RoleTest extends AbstractTest {
-
- @Autowired
- private UserDAO userDAO;
-
- @Autowired
- private RoleDAO roleDAO;
-
- @Autowired
- private PlainSchemaDAO plainSchemaDAO;
-
- @Autowired
- private PlainAttrDAO plainAttrDAO;
-
- @Autowired
- private PlainAttrValueDAO plainAttrValueDAO;
-
- @Autowired
- private EntitlementDAO entitlementDAO;
-
- @Autowired
- private PolicyDAO policyDAO;
-
- @Test(expected = InvalidEntityException.class)
- public void saveWithTwoOwners() {
- Role root = roleDAO.find("root", null);
- assertNotNull("did not find expected role", root);
-
- User user = userDAO.find(1L);
- assertNotNull("did not find expected user", user);
-
- Role role = entityFactory.newEntity(Role.class);
- role.setName("error");
- role.setUserOwner(user);
- role.setRoleOwner(root);
-
- roleDAO.save(role);
- }
-
- @Test
- public void findByOwner() {
- Role role = roleDAO.find(6L);
- assertNotNull("did not find expected role", role);
-
- User user = userDAO.find(5L);
- assertNotNull("did not find expected user", user);
-
- assertEquals(user, role.getUserOwner());
-
- Role child1 = roleDAO.find(7L);
- assertNotNull(child1);
- assertEquals(role, child1.getParent());
-
- Role child2 = roleDAO.find(10L);
- assertNotNull(child2);
- assertEquals(role, child2.getParent());
-
- List<Role> ownedRoles = roleDAO.findOwnedByUser(user.getKey());
- assertFalse(ownedRoles.isEmpty());
- assertEquals(2, ownedRoles.size());
- assertTrue(ownedRoles.contains(role));
- assertTrue(ownedRoles.contains(child1));
- assertFalse(ownedRoles.contains(child2));
- }
-
- public void createWithPasswordPolicy() {
- PasswordPolicy policy = (PasswordPolicy) policyDAO.find(4L);
- Role role = entityFactory.newEntity(Role.class);
- role.setName("roleWithPasswordPolicy");
- role.setPasswordPolicy(policy);
-
- Role actual = roleDAO.save(role);
- assertNotNull(actual);
-
- actual = roleDAO.find(actual.getKey());
- assertNotNull(actual);
- assertNotNull(actual.getPasswordPolicy());
-
- roleDAO.delete(actual.getKey());
- assertNull(roleDAO.find(actual.getKey()));
-
- assertNotNull(policyDAO.find(4L));
- }
-
- @Test
- public void delete() {
- roleDAO.delete(2L);
-
- roleDAO.flush();
-
- assertNull(roleDAO.find(2L));
- assertEquals(1, roleDAO.findByEntitlement(entitlementDAO.find("base")).size());
- assertEquals(userDAO.find(2L).getRoles().size(), 2);
- assertNull(plainAttrDAO.find(700L, RPlainAttr.class));
- assertNull(plainAttrValueDAO.find(41L, RPlainAttrValue.class));
- assertNotNull(plainSchemaDAO.find("icon", RPlainSchema.class));
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/UserTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/UserTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/UserTest.java
index e95f5c3..ccfa33d 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/UserTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/relationship/UserTest.java
@@ -26,7 +26,7 @@ import java.util.List;
import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
import org.apache.syncope.core.persistence.api.dao.PlainAttrValueDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.membership.Membership;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
@@ -44,7 +44,7 @@ public class UserTest extends AbstractTest {
private UserDAO userDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private PlainSchemaDAO plainSchemaDAO;
@@ -66,7 +66,7 @@ public class UserTest extends AbstractTest {
assertNull(plainAttrValueDAO.find(22L, UPlainAttrValue.class));
assertNotNull(plainSchemaDAO.find("loginDate", UPlainSchema.class));
- List<Membership> memberships = roleDAO.findMemberships(roleDAO.find(7L));
+ List<Membership> memberships = groupDAO.findMemberships(groupDAO.find(7L));
assertTrue(memberships.isEmpty());
}
}
[14/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAEntitlementDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAEntitlementDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAEntitlementDAO.java
index bc74b30..18c0776 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAEntitlementDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAEntitlementDAO.java
@@ -20,11 +20,11 @@ package org.apache.syncope.core.persistence.jpa.dao;
import java.util.List;
import javax.persistence.TypedQuery;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.jpa.entity.JPAEntitlement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@@ -33,7 +33,7 @@ import org.springframework.stereotype.Repository;
public class JPAEntitlementDAO extends AbstractDAO<Entitlement, String> implements EntitlementDAO {
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Override
public Entitlement find(final String name) {
@@ -54,12 +54,12 @@ public class JPAEntitlementDAO extends AbstractDAO<Entitlement, String> implemen
}
@Override
- public Entitlement saveRoleEntitlement(final Role role) {
- Entitlement roleEnt = new JPAEntitlement();
- roleEnt.setKey(RoleEntitlementUtil.getEntitlementNameFromRoleKey(role.getKey()));
- roleEnt.setDescription("Entitlement for managing role " + role.getKey());
+ public Entitlement saveGroupEntitlement(final Group group) {
+ Entitlement groupEnt = new JPAEntitlement();
+ groupEnt.setKey(GroupEntitlementUtil.getEntitlementNameFromGroupKey(group.getKey()));
+ groupEnt.setDescription("Entitlement for managing group " + group.getKey());
- return save(roleEnt);
+ return save(groupEnt);
}
@Override
@@ -78,9 +78,9 @@ public class JPAEntitlementDAO extends AbstractDAO<Entitlement, String> implemen
return;
}
- for (Role role : roleDAO.findByEntitlement(entitlement)) {
- role.removeEntitlement(entitlement);
- roleDAO.save(role);
+ for (Group group : groupDAO.findByEntitlement(entitlement)) {
+ group.removeEntitlement(entitlement);
+ groupDAO.save(group);
}
entityManager.remove(entitlement);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
index 9bc2a25..c79d1e8 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
@@ -29,7 +29,7 @@ import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.TaskDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
@@ -37,7 +37,7 @@ import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.Mapping;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
import org.apache.syncope.core.persistence.api.entity.Policy;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.persistence.api.entity.task.PushTask;
import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
@@ -45,7 +45,7 @@ import org.apache.syncope.core.persistence.api.entity.user.UMappingItem;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.jpa.entity.AbstractMappingItem;
import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMappingItem;
import org.apache.syncope.core.provisioning.api.ConnectorRegistry;
import org.springframework.beans.factory.annotation.Autowired;
@@ -62,7 +62,7 @@ public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource, String
private UserDAO userDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private PolicyDAO policyDAO;
@@ -173,7 +173,7 @@ public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource, String
Class<? extends AbstractMappingItem> jpaRef = reference.equals(UMappingItem.class)
? JPAUMappingItem.class
- : JPARMappingItem.class;
+ : JPAGMappingItem.class;
TypedQuery<T> query = entityManager.createQuery("SELECT m FROM " + jpaRef.getSimpleName()
+ " m WHERE m.intAttrName=:intAttrName AND m.intMappingType=:intMappingType", reference);
@@ -218,8 +218,8 @@ public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource, String
for (User user : userDAO.findByResource(resource)) {
user.removeResource(resource);
}
- for (Role role : roleDAO.findByResource(resource)) {
- role.removeResource(resource);
+ for (Group group : groupDAO.findByResource(resource)) {
+ group.removeResource(resource);
}
for (AccountPolicy policy : policyDAO.findByResource(resource)) {
policy.removeResource(resource);
@@ -240,13 +240,13 @@ public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource, String
resource.getUmapping().setResource(null);
resource.setUmapping(null);
}
- if (resource.getRmapping() != null) {
- for (MappingItem item : resource.getRmapping().getItems()) {
+ if (resource.getGmapping() != null) {
+ for (MappingItem item : resource.getGmapping().getItems()) {
item.setMapping(null);
}
- resource.getRmapping().getItems().clear();
- resource.getRmapping().setResource(null);
- resource.setRmapping(null);
+ resource.getGmapping().getItems().clear();
+ resource.getGmapping().setResource(null);
+ resource.setGmapping(null);
}
entityManager.remove(resource);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
new file mode 100644
index 0000000..63e9fc6
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
@@ -0,0 +1,579 @@
+/*
+ * 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;
+
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.persistence.NoResultException;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.common.lib.types.ResourceOperation;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
+import org.apache.syncope.core.persistence.api.dao.DerAttrDAO;
+import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
+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.dao.VirAttrDAO;
+import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.DerAttr;
+import org.apache.syncope.core.persistence.api.entity.Entitlement;
+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.Policy;
+import org.apache.syncope.core.persistence.api.entity.Subject;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+import org.apache.syncope.core.persistence.api.entity.membership.MDerAttr;
+import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
+import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.Membership;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
+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.jpa.entity.membership.JPAMembership;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
+import org.apache.syncope.common.lib.types.PropagationByResource;
+import org.apache.syncope.core.misc.security.AuthContextUtil;
+import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAttr> implements GroupDAO {
+
+ @Autowired
+ private UserDAO userDAO;
+
+ @Autowired
+ private PlainAttrDAO plainAttrDAO;
+
+ @Autowired
+ private DerAttrDAO derAttrDAO;
+
+ @Autowired
+ private VirAttrDAO virAttrDAO;
+
+ @Autowired
+ private EntitlementDAO entitlementDAO;
+
+ @Autowired
+ private AttributableUtilFactory attrUtilFactory;
+
+ @Override
+ protected Subject<GPlainAttr, GDerAttr, GVirAttr> findInternal(final Long key) {
+ return find(key);
+ }
+
+ @Override
+ public Group find(final Long key) {
+ TypedQuery<Group> query = entityManager.createQuery("SELECT e FROM " + JPAGroup.class.getSimpleName() + " e WHERE e.id = :id", Group.class);
+ query.setParameter("id", key);
+
+ Group result = null;
+ try {
+ result = query.getSingleResult();
+ } catch (NoResultException e) {
+ LOG.debug("No group found with id {}", key, e);
+ }
+
+ return result;
+ }
+
+ @Override
+ public List<Group> find(final String name) {
+ TypedQuery<Group> query = entityManager.createQuery("SELECT e FROM " + JPAGroup.class.getSimpleName() + " e WHERE e.name = :name", Group.class);
+ query.setParameter("name", name);
+
+ return query.getResultList();
+ }
+
+ @Override
+ public Group find(final String name, final Long parentId) {
+ TypedQuery<Group> query;
+ if (parentId == null) {
+ query = entityManager.createQuery("SELECT r FROM " + JPAGroup.class.getSimpleName() + " r WHERE "
+ + "r.name=:name AND r.parent IS NULL", Group.class);
+ } else {
+ query = entityManager.createQuery("SELECT r FROM " + JPAGroup.class.getSimpleName() + " r WHERE "
+ + "r.name=:name AND r.parent.id=:parentId", Group.class);
+ query.setParameter("parentId", parentId);
+ }
+ query.setParameter("name", name);
+
+ List<Group> result = query.getResultList();
+ return result.isEmpty()
+ ? null
+ : result.get(0);
+ }
+
+ private void findSameOwnerDescendants(final List<Group> result, final Group group) {
+ List<Group> children = findChildren(group);
+ if (children != null) {
+ for (Group child : children) {
+ if ((child.getUserOwner() == null && child.getGroupOwner() == null && child.isInheritOwner())
+ || (child.getUserOwner() != null && child.getUserOwner().equals(group.getUserOwner()))
+ || (child.getGroupOwner() != null && child.getGroupOwner().equals(group.getGroupOwner()))) {
+
+ findDescendants(result, child);
+ }
+ }
+ }
+ result.add(group);
+ }
+
+ @Transactional(readOnly = true)
+ @Override
+ public List<Group> findOwnedByUser(final Long userKey) {
+ User owner = userDAO.find(userKey);
+ if (owner == null) {
+ return Collections.<Group>emptyList();
+ }
+
+ StringBuilder queryString = new StringBuilder("SELECT e FROM ").append(JPAGroup.class.getSimpleName()).
+ append(" e WHERE e.userOwner=:owner ");
+ for (Long groupKey : owner.getGroupKeys()) {
+ queryString.append("OR e.groupOwner.id=").append(groupKey).append(' ');
+ }
+
+ TypedQuery<Group> query = entityManager.createQuery(queryString.toString(), Group.class);
+ query.setParameter("owner", owner);
+
+ List<Group> result = new ArrayList<>();
+ for (Group group : query.getResultList()) {
+ findSameOwnerDescendants(result, group);
+ }
+
+ return result;
+ }
+
+ @Transactional(readOnly = true)
+ @Override
+ public List<Group> findOwnedByGroup(final Long groupId) {
+ Group owner = find(groupId);
+ if (owner == null) {
+ return Collections.<Group>emptyList();
+ }
+
+ StringBuilder queryString = new StringBuilder("SELECT e FROM ").append(JPAGroup.class.getSimpleName()).
+ append(" e WHERE e.groupOwner=:owner ");
+
+ TypedQuery<Group> query = entityManager.createQuery(queryString.toString(), Group.class);
+ query.setParameter("owner", owner);
+
+ List<Group> result = new ArrayList<Group>();
+ for (Group group : query.getResultList()) {
+ findSameOwnerDescendants(result, group);
+ }
+
+ return result;
+ }
+
+ @Override
+ public List<Group> findByEntitlement(final Entitlement entitlement) {
+ TypedQuery<Group> query = entityManager.createQuery("SELECT e FROM " + JPAGroup.class.getSimpleName() + " e "
+ + "WHERE :entitlement MEMBER OF e.entitlements", Group.class);
+ query.setParameter("entitlement", entitlement);
+
+ return query.getResultList();
+ }
+
+ private Map.Entry<String, String> getPolicyFields(final PolicyType type) {
+ String policyField;
+ String inheritPolicyField;
+ if (type == PolicyType.GLOBAL_ACCOUNT || type == PolicyType.ACCOUNT) {
+ policyField = "accountPolicy";
+ inheritPolicyField = "inheritAccountPolicy";
+ } else {
+ policyField = "passwordPolicy";
+ inheritPolicyField = "inheritPasswordPolicy";
+ }
+
+ return new AbstractMap.SimpleEntry<>(policyField, inheritPolicyField);
+ }
+
+ private List<Group> findSamePolicyChildren(final Group group, final PolicyType type) {
+ List<Group> result = new ArrayList<>();
+
+ for (Group child : findChildren(group)) {
+ boolean inherit = type == PolicyType.GLOBAL_ACCOUNT || type == PolicyType.ACCOUNT
+ ? child.isInheritAccountPolicy()
+ : child.isInheritPasswordPolicy();
+ if (inherit) {
+ result.add(child);
+ result.addAll(findSamePolicyChildren(child, type));
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public List<Group> findByPolicy(final Policy policy) {
+ if (policy.getType() == PolicyType.GLOBAL_SYNC || policy.getType() == PolicyType.SYNC) {
+ return Collections.<Group>emptyList();
+ }
+
+ Map.Entry<String, String> policyFields = getPolicyFields(policy.getType());
+ StringBuilder queryString = new StringBuilder("SELECT e FROM ").
+ append(JPAGroup.class.getSimpleName()).append(" e WHERE e.").
+ append(policyFields.getKey()).append(" = :policy AND (e.").
+ append(policyFields.getValue()).append(" IS NULL OR e.").
+ append(policyFields.getValue()).append(" = 0)");
+
+ TypedQuery<Group> query = entityManager.createQuery(queryString.toString(), Group.class);
+ query.setParameter("policy", policy);
+
+ List<Group> result = new ArrayList<>();
+ for (Group group : query.getResultList()) {
+ result.add(group);
+ result.addAll(findSamePolicyChildren(group, policy.getType()));
+ }
+ return result;
+ }
+
+ @Override
+ public List<Group> findWithoutPolicy(final PolicyType type) {
+ if (type == PolicyType.GLOBAL_SYNC || type == PolicyType.SYNC) {
+ return Collections.<Group>emptyList();
+ }
+
+ Map.Entry<String, String> policyFields = getPolicyFields(type);
+ StringBuilder queryString = new StringBuilder("SELECT e FROM ").
+ append(JPAGroup.class.getSimpleName()).append(" e WHERE e.").
+ append(policyFields.getKey()).append(" IS NULL AND (e.").
+ append(policyFields.getValue()).append(" IS NULL OR e.").
+ append(policyFields.getValue()).append(" = 0)");
+
+ TypedQuery<Group> query = entityManager.createQuery(queryString.toString(), Group.class);
+ return query.getResultList();
+ }
+
+ private void findAncestors(final List<Group> result, final Group group) {
+ if (group.getParent() != null && !result.contains(group.getParent())) {
+ result.add(group.getParent());
+ findAncestors(result, group.getParent());
+ }
+ }
+
+ @Override
+ public List<Group> findAncestors(final Group group) {
+ List<Group> result = new ArrayList<>();
+ findAncestors(result, group);
+ return result;
+ }
+
+ @Override
+ public List<Group> findChildren(final Group group) {
+ TypedQuery<Group> query = entityManager.createQuery(
+ "SELECT g FROM " + JPAGroup.class.getSimpleName() + " g WHERE g.parent=:group", Group.class);
+ query.setParameter("group", group);
+
+ return query.getResultList();
+ }
+
+ private void findDescendants(final List<Group> result, final Group group) {
+ List<Group> children = findChildren(group);
+ if (children != null) {
+ for (Group child : children) {
+ findDescendants(result, child);
+ }
+ }
+ result.add(group);
+ }
+
+ @Override
+ public List<Group> findDescendants(final Group group) {
+ List<Group> result = new ArrayList<>();
+ findDescendants(result, group);
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<Group> findByAttrValue(final String schemaName, final GPlainAttrValue attrValue) {
+ return (List<Group>) findByAttrValue(
+ schemaName, attrValue, attrUtilFactory.getInstance(AttributableType.GROUP));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Group findByAttrUniqueValue(final String schemaName, final GPlainAttrValue attrUniqueValue) {
+ return (Group) findByAttrUniqueValue(schemaName, attrUniqueValue,
+ attrUtilFactory.getInstance(AttributableType.GROUP));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<Group> findByDerAttrValue(final String schemaName, final String value) {
+ return (List<Group>) findByDerAttrValue(
+ schemaName, value, attrUtilFactory.getInstance(AttributableType.GROUP));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<Group> findByResource(final ExternalResource resource) {
+ return (List<Group>) findByResource(resource, attrUtilFactory.getInstance(AttributableType.GROUP));
+ }
+
+ @Override
+ public List<Group> findAll() {
+ return findAll(-1, -1, Collections.<OrderByClause>emptyList());
+ }
+
+ @Override
+ public List<Group> findAll(final int page, final int itemsPerPage, final List<OrderByClause> orderBy) {
+ TypedQuery<Group> query = entityManager.createQuery("SELECT e FROM " + JPAGroup.class.getSimpleName() + " e "
+ + toOrderByStatement(Group.class, "e", orderBy), Group.class);
+
+ query.setFirstResult(itemsPerPage * (page <= 0
+ ? 0
+ : page - 1));
+
+ if (itemsPerPage > 0) {
+ query.setMaxResults(itemsPerPage);
+ }
+
+ return query.getResultList();
+ }
+
+ @Override
+ public List<Membership> findMemberships(final Group group) {
+ TypedQuery<Membership> query = entityManager.createQuery(
+ "SELECT e FROM " + JPAMembership.class.getSimpleName() + " e"
+ + " WHERE e.group=:group", Membership.class);
+ query.setParameter("group", group);
+
+ return query.getResultList();
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<Long> unmatched(final Long groupId,
+ final Class<?> attrClass, final Class<? extends AttrTemplate<?>> attrTemplateClass) {
+
+ final Query query = entityManager.createNativeQuery(new StringBuilder().
+ append("SELECT ma.id ").
+ append("FROM ").append(JPAMembership.TABLE).append(" m, ").
+ append(attrClass.getSimpleName()).append(" ma ").
+ append("WHERE m.group_id = ?1 ").
+ append("AND ma.owner_id = m.id ").
+ append("AND ma.template_id NOT IN (").
+ append("SELECT id ").
+ append("FROM ").append(attrTemplateClass.getSimpleName()).append(' ').
+ append("WHERE owner_id = ?1)").toString());
+ query.setParameter(1, groupId);
+
+ return query.getResultList();
+ }
+
+ @Override
+ public final int count() {
+ Query countQuery = entityManager.createNativeQuery("SELECT COUNT(e.id) FROM " + JPAGroup.TABLE + " e");
+
+ return ((Number) countQuery.getSingleResult()).intValue();
+ }
+
+ @Override
+ public Group save(final Group group) {
+ // reset account policy in case of inheritance
+ if (group.isInheritAccountPolicy()) {
+ group.setAccountPolicy(null);
+ }
+
+ // reset password policy in case of inheritance
+ if (group.isInheritPasswordPolicy()) {
+ group.setPasswordPolicy(null);
+ }
+
+ // remove attributes without a valid template
+ List<GPlainAttr> rToBeDeleted = new ArrayList<>();
+ for (PlainAttr attr : group.getPlainAttrs()) {
+ boolean found = false;
+ for (GPlainAttrTemplate template : group.findInheritedTemplates(GPlainAttrTemplate.class)) {
+ if (template.getSchema().equals(attr.getSchema())) {
+ found = true;
+ }
+ }
+ if (!found) {
+ rToBeDeleted.add((GPlainAttr) attr);
+ }
+ }
+ for (GPlainAttr attr : rToBeDeleted) {
+ LOG.debug("Removing {} from {} because no template is available for it", attr, group);
+ group.removePlainAttr(attr);
+ }
+
+ // remove derived attributes without a valid template
+ List<GDerAttr> rDerToBeDeleted = new ArrayList<GDerAttr>();
+ for (DerAttr attr : group.getDerAttrs()) {
+ boolean found = false;
+ for (GDerAttrTemplate template : group.findInheritedTemplates(GDerAttrTemplate.class)) {
+ if (template.getSchema().equals(attr.getSchema())) {
+ found = true;
+ }
+ }
+ if (!found) {
+ rDerToBeDeleted.add((GDerAttr) attr);
+ }
+ }
+ for (GDerAttr attr : rDerToBeDeleted) {
+ LOG.debug("Removing {} from {} because no template is available for it", attr, group);
+ group.removeDerAttr(attr);
+ }
+
+ // remove virtual attributes without a valid template
+ List<GVirAttr> rVirToBeDeleted = new ArrayList<GVirAttr>();
+ for (VirAttr attr : group.getVirAttrs()) {
+ boolean found = false;
+ for (GVirAttrTemplate template : group.findInheritedTemplates(GVirAttrTemplate.class)) {
+ if (template.getSchema().equals(attr.getSchema())) {
+ found = true;
+ }
+ }
+ if (!found) {
+ LOG.debug("Removing {} from {} because no template is available for it", attr, group);
+ rVirToBeDeleted.add((GVirAttr) attr);
+ }
+ }
+ for (GVirAttr attr : rVirToBeDeleted) {
+ group.removeVirAttr(attr);
+ }
+
+ Group merged = entityManager.merge(group);
+
+ // Now the same process for any exising membership of the group being saved
+ if (group.getKey() != null) {
+ for (Long key : unmatched(group.getKey(), MPlainAttr.class, MPlainAttrTemplate.class)) {
+ LOG.debug("Removing MAttr[{}] because no template is available for it in {}", key, group);
+ plainAttrDAO.delete(key, MPlainAttr.class);
+ }
+ for (Long id : unmatched(group.getKey(), MDerAttr.class, MDerAttrTemplate.class)) {
+ LOG.debug("Removing MDerAttr[{}] because no template is available for it in {}", id, group);
+ derAttrDAO.delete(id, MDerAttr.class);
+ }
+ for (Long id : unmatched(group.getKey(), MVirAttr.class, MVirAttrTemplate.class)) {
+ LOG.debug("Removing MVirAttr[{}] because no template is available for it in {}", id, group);
+ virAttrDAO.delete(id, MVirAttr.class);
+ }
+ }
+
+ merged = entityManager.merge(merged);
+ for (VirAttr attr : merged.getVirAttrs()) {
+ attr.getValues().clear();
+ attr.getValues().addAll(group.getVirAttr(attr.getSchema().getKey()).getValues());
+ }
+
+ entitlementDAO.saveGroupEntitlement(merged);
+
+ return merged;
+ }
+
+ @Override
+ public void delete(final Group group) {
+ for (Group groupToBeDeleted : findDescendants(group)) {
+ for (Membership membership : findMemberships(groupToBeDeleted)) {
+ membership.getUser().removeMembership(membership);
+ userDAO.save(membership.getUser());
+
+ entityManager.remove(membership);
+ }
+
+ groupToBeDeleted.getEntitlements().clear();
+
+ groupToBeDeleted.setParent(null);
+ groupToBeDeleted.setUserOwner(null);
+ groupToBeDeleted.setGroupOwner(null);
+ entityManager.remove(groupToBeDeleted);
+
+ entitlementDAO.delete(GroupEntitlementUtil.getEntitlementNameFromGroupKey(groupToBeDeleted.getKey()));
+ }
+ }
+
+ @Override
+ public void delete(final Long key) {
+ Group group = (Group) findInternal(key);
+ if (group == null) {
+ return;
+ }
+
+ delete(group);
+ }
+
+ @Override
+ public Group authFetch(Long key) {
+ if (key == null) {
+ throw new NotFoundException("Null group id");
+ }
+
+ Group group = find(key);
+ if (group == null) {
+ throw new NotFoundException("Group " + key);
+ }
+
+ Set<Long> allowedGroupKeys = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+ if (!allowedGroupKeys.contains(group.getKey())) {
+ throw new UnauthorizedGroupException(group.getKey());
+ }
+ return group;
+ }
+
+ @Transactional(readOnly = true)
+ @Override
+ public Map<Long, PropagationByResource> findUsersWithIndirectResources(final Long groupKey) {
+ Group group = authFetch(groupKey);
+
+ Map<Long, PropagationByResource> result = new HashMap<>();
+
+ for (Membership membership : findMemberships(group)) {
+ User user = membership.getUser();
+
+ PropagationByResource propByRes = new PropagationByResource();
+ for (ExternalResource resource : group.getResources()) {
+ if (!user.getOwnResources().contains(resource)) {
+ propByRes.add(ResourceOperation.DELETE, resource.getKey());
+ }
+
+ if (!propByRes.isEmpty()) {
+ result.put(user.getKey(), propByRes);
+ }
+ }
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAMembershipDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAMembershipDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAMembershipDAO.java
index 8be8c72..998f680 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAMembershipDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAMembershipDAO.java
@@ -26,7 +26,7 @@ import org.apache.syncope.core.persistence.api.dao.MembershipDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+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.jpa.entity.membership.JPAMembership;
import org.springframework.beans.factory.annotation.Autowired;
@@ -44,18 +44,19 @@ public class JPAMembershipDAO extends AbstractDAO<Membership, Long> implements M
}
@Override
- public Membership find(final User user, final Role role) {
+ public Membership find(final User user, final Group group) {
Query query = entityManager.createQuery(
- "SELECT e FROM " + JPAMembership.class.getSimpleName() + " e WHERE e.user = :user AND e.role = :role");
+ "SELECT e FROM " + JPAMembership.class.getSimpleName()
+ + " e WHERE e.user = :user AND e.group = :group");
query.setParameter("user", user);
- query.setParameter("role", role);
+ query.setParameter("group", group);
Membership result = null;
try {
result = (Membership) query.getSingleResult();
} catch (NoResultException e) {
- LOG.debug("No membership was found for user {} and role {}", user, role, e);
+ LOG.debug("No membership was found for user {} and group {}", user, group, e);
}
return result;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrDAO.java
index 9e2f757..b41066c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrDAO.java
@@ -23,12 +23,12 @@ import org.apache.syncope.core.persistence.api.entity.Attributable;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttr;
import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttr;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr;
import org.springframework.stereotype.Repository;
@@ -40,8 +40,8 @@ public class JPAPlainAttrDAO extends AbstractDAO<PlainAttr, Long> implements Pla
return CPlainAttr.class.isAssignableFrom(reference)
? JPACPlainAttr.class
- : RPlainAttr.class.isAssignableFrom(reference)
- ? JPARPlainAttr.class
+ : GPlainAttr.class.isAssignableFrom(reference)
+ ? JPAGPlainAttr.class
: MPlainAttr.class.isAssignableFrom(reference)
? JPAMPlainAttr.class
: UPlainAttr.class.isAssignableFrom(reference)
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrValueDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrValueDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrValueDAO.java
index 17861d6..4b99051 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrValueDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrValueDAO.java
@@ -26,8 +26,8 @@ import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrUniqueValue
import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrUniqueValue;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrUniqueValue;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
@@ -35,8 +35,8 @@ import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrUniqueVa
import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrValue;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrUniqueValue;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue;
import org.springframework.stereotype.Repository;
@@ -51,10 +51,10 @@ public class JPAPlainAttrValueDAO extends AbstractDAO<PlainAttrValue, Long> impl
? JPACPlainAttrValue.class
: reference.equals(CPlainAttrUniqueValue.class)
? JPACPlainAttrUniqueValue.class
- : reference.equals(RPlainAttrValue.class)
- ? JPARPlainAttrValue.class
- : reference.equals(RPlainAttrUniqueValue.class)
- ? JPARPlainAttrUniqueValue.class
+ : reference.equals(GPlainAttrValue.class)
+ ? JPAGPlainAttrValue.class
+ : reference.equals(GPlainAttrUniqueValue.class)
+ ? JPAGPlainAttrUniqueValue.class
: reference.equals(MPlainAttrValue.class)
? JPAMPlainAttrValue.class
: reference.equals(MPlainAttrUniqueValue.class)
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
index 2a354a5..b271868 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
@@ -34,15 +34,15 @@ import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RMappingItem;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GMappingItem;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
import org.apache.syncope.core.persistence.api.entity.user.UMappingItem;
import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema;
import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainSchema;
import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainSchema;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainSchema;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainSchema;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@@ -64,8 +64,8 @@ public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema, String> implemen
return CPlainSchema.class.isAssignableFrom(reference)
? JPACPlainSchema.class
- : RPlainSchema.class.isAssignableFrom(reference)
- ? JPARPlainSchema.class
+ : GPlainSchema.class.isAssignableFrom(reference)
+ ? JPAGPlainSchema.class
: MPlainSchema.class.isAssignableFrom(reference)
? JPAMPlainSchema.class
: UPlainSchema.class.isAssignableFrom(reference)
@@ -90,7 +90,7 @@ public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema, String> implemen
final StringBuilder queryString = new StringBuilder("SELECT e FROM ").
append(((JPAPlainAttrDAO) attrDAO).getJPAEntityReference(reference).getSimpleName()).
append(" e WHERE e.");
- if (RPlainAttr.class.isAssignableFrom(reference) || MPlainAttr.class.isAssignableFrom(reference)) {
+ if (GPlainAttr.class.isAssignableFrom(reference) || MPlainAttr.class.isAssignableFrom(reference)) {
queryString.append("template.");
}
queryString.append("schema=:schema");
@@ -122,7 +122,7 @@ public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema, String> implemen
attrDAO.delete(attrId, attributableUtil.plainAttrClass());
}
- if (attributableUtil.getType() == AttributableType.ROLE
+ if (attributableUtil.getType() == AttributableType.GROUP
|| attributableUtil.getType() == AttributableType.MEMBERSHIP) {
for (Iterator<Number> it = attrTemplateDAO.
@@ -134,7 +134,7 @@ public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema, String> implemen
}
resourceDAO.deleteMapping(key, attributableUtil.plainIntMappingType(), UMappingItem.class);
- resourceDAO.deleteMapping(key, attributableUtil.plainIntMappingType(), RMappingItem.class);
+ resourceDAO.deleteMapping(key, attributableUtil.plainIntMappingType(), GMappingItem.class);
entityManager.remove(schema);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
deleted file mode 100644
index 3003bb4..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
+++ /dev/null
@@ -1,584 +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;
-
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.DerAttrDAO;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
-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.VirAttrDAO;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-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.Policy;
-import org.apache.syncope.core.persistence.api.entity.Subject;
-import org.apache.syncope.core.persistence.api.entity.VirAttr;
-import org.apache.syncope.core.persistence.api.entity.membership.MDerAttr;
-import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
-import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
-import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.misc.security.UnauthorizedRoleException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-@Repository
-public class JPARoleDAO extends AbstractSubjectDAO<RPlainAttr, RDerAttr, RVirAttr> implements RoleDAO {
-
- @Autowired
- private UserDAO userDAO;
-
- @Autowired
- private PlainAttrDAO plainAttrDAO;
-
- @Autowired
- private DerAttrDAO derAttrDAO;
-
- @Autowired
- private VirAttrDAO virAttrDAO;
-
- @Autowired
- private EntitlementDAO entitlementDAO;
-
- @Autowired
- private AttributableUtilFactory attrUtilFactory;
-
- @Override
- protected Subject<RPlainAttr, RDerAttr, RVirAttr> findInternal(final Long key) {
- return find(key);
- }
-
- @Override
- public Role find(final Long key) {
- TypedQuery<Role> query = entityManager.createQuery(
- "SELECT e FROM " + JPARole.class.getSimpleName() + " e WHERE e.id = :id", Role.class);
- query.setParameter("id", key);
-
- Role result = null;
- try {
- result = query.getSingleResult();
- } catch (NoResultException e) {
- LOG.debug("No role found with id {}", key, e);
- }
-
- return result;
- }
-
- @Override
- public List<Role> find(final String name) {
- TypedQuery<Role> query = entityManager.createQuery(
- "SELECT e FROM " + JPARole.class.getSimpleName() + " e WHERE e.name = :name", Role.class);
- query.setParameter("name", name);
-
- return query.getResultList();
- }
-
- @Override
- public Role find(final String name, final Long parentId) {
- TypedQuery<Role> query;
- if (parentId == null) {
- query = entityManager.createQuery("SELECT r FROM " + JPARole.class.getSimpleName() + " r WHERE "
- + "r.name=:name AND r.parent IS NULL", Role.class);
- } else {
- query = entityManager.createQuery("SELECT r FROM " + JPARole.class.getSimpleName() + " r WHERE "
- + "r.name=:name AND r.parent.id=:parentId", Role.class);
- query.setParameter("parentId", parentId);
- }
- query.setParameter("name", name);
-
- List<Role> result = query.getResultList();
- return result.isEmpty()
- ? null
- : result.get(0);
- }
-
- private void findSameOwnerDescendants(final List<Role> result, final Role role) {
- List<Role> children = findChildren(role);
- if (children != null) {
- for (Role child : children) {
- if ((child.getUserOwner() == null && child.getRoleOwner() == null && child.isInheritOwner())
- || (child.getUserOwner() != null && child.getUserOwner().equals(role.getUserOwner()))
- || (child.getRoleOwner() != null && child.getRoleOwner().equals(role.getRoleOwner()))) {
-
- findDescendants(result, child);
- }
- }
- }
- result.add(role);
- }
-
- @Transactional(readOnly = true)
- @Override
- public List<Role> findOwnedByUser(final Long userKey) {
- User owner = userDAO.find(userKey);
- if (owner == null) {
- return Collections.<Role>emptyList();
- }
-
- StringBuilder queryString = new StringBuilder("SELECT e FROM ").append(JPARole.class.getSimpleName()).
- append(" e WHERE e.userOwner=:owner ");
- for (Long roleKey : owner.getRoleKeys()) {
- queryString.append("OR e.roleOwner.id=").append(roleKey).append(' ');
- }
-
- TypedQuery<Role> query = entityManager.createQuery(queryString.toString(), Role.class);
- query.setParameter("owner", owner);
-
- List<Role> result = new ArrayList<>();
- for (Role role : query.getResultList()) {
- findSameOwnerDescendants(result, role);
- }
-
- return result;
- }
-
- @Transactional(readOnly = true)
- @Override
- public List<Role> findOwnedByRole(final Long roleId) {
- Role owner = find(roleId);
- if (owner == null) {
- return Collections.<Role>emptyList();
- }
-
- StringBuilder queryString = new StringBuilder("SELECT e FROM ").append(JPARole.class.getSimpleName()).
- append(" e WHERE e.roleOwner=:owner ");
-
- TypedQuery<Role> query = entityManager.createQuery(queryString.toString(), Role.class);
- query.setParameter("owner", owner);
-
- List<Role> result = new ArrayList<Role>();
- for (Role role : query.getResultList()) {
- findSameOwnerDescendants(result, role);
- }
-
- return result;
- }
-
- @Override
- public List<Role> findByEntitlement(final Entitlement entitlement) {
- TypedQuery<Role> query = entityManager.createQuery(
- "SELECT e FROM " + JPARole.class.getSimpleName() + " e "
- + "WHERE :entitlement MEMBER OF e.entitlements", Role.class);
- query.setParameter("entitlement", entitlement);
-
- return query.getResultList();
- }
-
- private Map.Entry<String, String> getPolicyFields(final PolicyType type) {
- String policyField;
- String inheritPolicyField;
- if (type == PolicyType.GLOBAL_ACCOUNT || type == PolicyType.ACCOUNT) {
- policyField = "accountPolicy";
- inheritPolicyField = "inheritAccountPolicy";
- } else {
- policyField = "passwordPolicy";
- inheritPolicyField = "inheritPasswordPolicy";
- }
-
- return new AbstractMap.SimpleEntry<>(policyField, inheritPolicyField);
- }
-
- private List<Role> findSamePolicyChildren(final Role role, final PolicyType type) {
- List<Role> result = new ArrayList<Role>();
-
- for (Role child : findChildren(role)) {
- boolean inherit = type == PolicyType.GLOBAL_ACCOUNT || type == PolicyType.ACCOUNT
- ? child.isInheritAccountPolicy()
- : child.isInheritPasswordPolicy();
- if (inherit) {
- result.add(child);
- result.addAll(findSamePolicyChildren(child, type));
- }
- }
-
- return result;
- }
-
- @Override
- public List<Role> findByPolicy(final Policy policy) {
- if (policy.getType() == PolicyType.GLOBAL_SYNC || policy.getType() == PolicyType.SYNC) {
- return Collections.<Role>emptyList();
- }
-
- Map.Entry<String, String> policyFields = getPolicyFields(policy.getType());
- StringBuilder queryString = new StringBuilder("SELECT e FROM ").
- append(JPARole.class.getSimpleName()).append(" e WHERE e.").
- append(policyFields.getKey()).append(" = :policy AND (e.").
- append(policyFields.getValue()).append(" IS NULL OR e.").
- append(policyFields.getValue()).append(" = 0)");
-
- TypedQuery<Role> query = entityManager.createQuery(queryString.toString(), Role.class);
- query.setParameter("policy", policy);
-
- List<Role> result = new ArrayList<Role>();
- for (Role role : query.getResultList()) {
- result.add(role);
- result.addAll(findSamePolicyChildren(role, policy.getType()));
- }
- return result;
- }
-
- @Override
- public List<Role> findWithoutPolicy(final PolicyType type) {
- if (type == PolicyType.GLOBAL_SYNC || type == PolicyType.SYNC) {
- return Collections.<Role>emptyList();
- }
-
- Map.Entry<String, String> policyFields = getPolicyFields(type);
- StringBuilder queryString = new StringBuilder("SELECT e FROM ").
- append(JPARole.class.getSimpleName()).append(" e WHERE e.").
- append(policyFields.getKey()).append(" IS NULL AND (e.").
- append(policyFields.getValue()).append(" IS NULL OR e.").
- append(policyFields.getValue()).append(" = 0)");
-
- TypedQuery<Role> query = entityManager.createQuery(queryString.toString(), Role.class);
- return query.getResultList();
- }
-
- private void findAncestors(final List<Role> result, final Role role) {
- if (role.getParent() != null && !result.contains(role.getParent())) {
- result.add(role.getParent());
- findAncestors(result, role.getParent());
- }
- }
-
- @Override
- public List<Role> findAncestors(final Role role) {
- List<Role> result = new ArrayList<>();
- findAncestors(result, role);
- return result;
- }
-
- @Override
- public List<Role> findChildren(final Role role) {
- TypedQuery<Role> query = entityManager.createQuery(
- "SELECT r FROM " + JPARole.class.getSimpleName() + " r WHERE r.parent=:role", Role.class);
- query.setParameter("role", role);
-
- return query.getResultList();
- }
-
- private void findDescendants(final List<Role> result, final Role role) {
- List<Role> children = findChildren(role);
- if (children != null) {
- for (Role child : children) {
- findDescendants(result, child);
- }
- }
- result.add(role);
- }
-
- @Override
- public List<Role> findDescendants(final Role role) {
- List<Role> result = new ArrayList<>();
- findDescendants(result, role);
- return result;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public List<Role> findByAttrValue(final String schemaName, final RPlainAttrValue attrValue) {
- return (List<Role>) findByAttrValue(
- schemaName, attrValue, attrUtilFactory.getInstance(AttributableType.ROLE));
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Role findByAttrUniqueValue(final String schemaName, final RPlainAttrValue attrUniqueValue) {
- return (Role) findByAttrUniqueValue(schemaName, attrUniqueValue,
- attrUtilFactory.getInstance(AttributableType.ROLE));
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public List<Role> findByDerAttrValue(final String schemaName, final String value) {
- return (List<Role>) findByDerAttrValue(
- schemaName, value, attrUtilFactory.getInstance(AttributableType.ROLE));
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public List<Role> findByResource(final ExternalResource resource) {
- return (List<Role>) findByResource(resource, attrUtilFactory.getInstance(AttributableType.ROLE));
- }
-
- @Override
- public List<Role> findAll() {
- return findAll(-1, -1, Collections.<OrderByClause>emptyList());
- }
-
- @Override
- public List<Role> findAll(final int page, final int itemsPerPage, final List<OrderByClause> orderBy) {
- TypedQuery<Role> query = entityManager.createQuery(
- "SELECT e FROM " + JPARole.class.getSimpleName() + " e "
- + toOrderByStatement(Role.class, "e", orderBy), Role.class);
-
- query.setFirstResult(itemsPerPage * (page <= 0
- ? 0
- : page - 1));
-
- if (itemsPerPage > 0) {
- query.setMaxResults(itemsPerPage);
- }
-
- return query.getResultList();
- }
-
- @Override
- public List<Membership> findMemberships(final Role role) {
- TypedQuery<Membership> query = entityManager.createQuery(
- "SELECT e FROM " + JPAMembership.class.getSimpleName() + " e"
- + " WHERE e.role=:role", Membership.class);
- query.setParameter("role", role);
-
- return query.getResultList();
- }
-
- @SuppressWarnings("unchecked")
- private List<Long> unmatched(final Long roleId,
- final Class<?> attrClass, final Class<? extends AttrTemplate<?>> attrTemplateClass) {
-
- final Query query = entityManager.createNativeQuery(new StringBuilder().
- append("SELECT ma.id ").
- append("FROM ").append(JPAMembership.TABLE).append(" m, ").
- append(attrClass.getSimpleName()).append(" ma ").
- append("WHERE m.role_id = ?1 ").
- append("AND ma.owner_id = m.id ").
- append("AND ma.template_id NOT IN (").
- append("SELECT id ").
- append("FROM ").append(attrTemplateClass.getSimpleName()).append(' ').
- append("WHERE owner_id = ?1)").toString());
- query.setParameter(1, roleId);
-
- return query.getResultList();
- }
-
- @Override
- public final int count() {
- Query countQuery = entityManager.createNativeQuery(
- "SELECT COUNT(e.id) FROM " + JPARole.TABLE + " e");
-
- return ((Number) countQuery.getSingleResult()).intValue();
- }
-
- @Override
- public Role save(final Role role) {
- // reset account policy in case of inheritance
- if (role.isInheritAccountPolicy()) {
- role.setAccountPolicy(null);
- }
-
- // reset password policy in case of inheritance
- if (role.isInheritPasswordPolicy()) {
- role.setPasswordPolicy(null);
- }
-
- // remove attributes without a valid template
- List<RPlainAttr> rToBeDeleted = new ArrayList<>();
- for (PlainAttr attr : role.getPlainAttrs()) {
- boolean found = false;
- for (RPlainAttrTemplate template : role.findInheritedTemplates(RPlainAttrTemplate.class)) {
- if (template.getSchema().equals(attr.getSchema())) {
- found = true;
- }
- }
- if (!found) {
- rToBeDeleted.add((RPlainAttr) attr);
- }
- }
- for (RPlainAttr attr : rToBeDeleted) {
- LOG.debug("Removing {} from {} because no template is available for it", attr, role);
- role.removePlainAttr(attr);
- }
-
- // remove derived attributes without a valid template
- List<RDerAttr> rDerToBeDeleted = new ArrayList<RDerAttr>();
- for (DerAttr attr : role.getDerAttrs()) {
- boolean found = false;
- for (RDerAttrTemplate template : role.findInheritedTemplates(RDerAttrTemplate.class)) {
- if (template.getSchema().equals(attr.getSchema())) {
- found = true;
- }
- }
- if (!found) {
- rDerToBeDeleted.add((RDerAttr) attr);
- }
- }
- for (RDerAttr attr : rDerToBeDeleted) {
- LOG.debug("Removing {} from {} because no template is available for it", attr, role);
- role.removeDerAttr(attr);
- }
-
- // remove virtual attributes without a valid template
- List<RVirAttr> rVirToBeDeleted = new ArrayList<RVirAttr>();
- for (VirAttr attr : role.getVirAttrs()) {
- boolean found = false;
- for (RVirAttrTemplate template : role.findInheritedTemplates(RVirAttrTemplate.class)) {
- if (template.getSchema().equals(attr.getSchema())) {
- found = true;
- }
- }
- if (!found) {
- LOG.debug("Removing {} from {} because no template is available for it", attr, role);
- rVirToBeDeleted.add((RVirAttr) attr);
- }
- }
- for (RVirAttr attr : rVirToBeDeleted) {
- role.removeVirAttr(attr);
- }
-
- Role merged = entityManager.merge(role);
-
- // Now the same process for any exising membership of the role being saved
- if (role.getKey() != null) {
- for (Long key : unmatched(role.getKey(), MPlainAttr.class, MPlainAttrTemplate.class)) {
- LOG.debug("Removing MAttr[{}] because no template is available for it in {}", key, role);
- plainAttrDAO.delete(key, MPlainAttr.class);
- }
- for (Long id : unmatched(role.getKey(), MDerAttr.class, MDerAttrTemplate.class)) {
- LOG.debug("Removing MDerAttr[{}] because no template is available for it in {}", id, role);
- derAttrDAO.delete(id, MDerAttr.class);
- }
- for (Long id : unmatched(role.getKey(), MVirAttr.class, MVirAttrTemplate.class)) {
- LOG.debug("Removing MVirAttr[{}] because no template is available for it in {}", id, role);
- virAttrDAO.delete(id, MVirAttr.class);
- }
- }
-
- merged = entityManager.merge(merged);
- for (VirAttr attr : merged.getVirAttrs()) {
- attr.getValues().clear();
- attr.getValues().addAll(role.getVirAttr(attr.getSchema().getKey()).getValues());
- }
-
- entitlementDAO.saveRoleEntitlement(merged);
-
- return merged;
- }
-
- @Override
- public void delete(final Role role) {
- for (Role roleToBeDeleted : findDescendants(role)) {
- for (Membership membership : findMemberships(roleToBeDeleted)) {
- membership.getUser().removeMembership(membership);
- userDAO.save(membership.getUser());
-
- entityManager.remove(membership);
- }
-
- roleToBeDeleted.getEntitlements().clear();
-
- roleToBeDeleted.setParent(null);
- roleToBeDeleted.setUserOwner(null);
- roleToBeDeleted.setRoleOwner(null);
- entityManager.remove(roleToBeDeleted);
-
- entitlementDAO.delete(RoleEntitlementUtil.getEntitlementNameFromRoleKey(roleToBeDeleted.getKey()));
- }
- }
-
- @Override
- public void delete(final Long key) {
- Role role = (Role) findInternal(key);
- if (role == null) {
- return;
- }
-
- delete(role);
- }
-
- @Override
- public Role authFetch(Long key) {
- if (key == null) {
- throw new NotFoundException("Null role id");
- }
-
- Role role = find(key);
- if (role == null) {
- throw new NotFoundException("Role " + key);
- }
-
- Set<Long> allowedRoleKeys = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
- if (!allowedRoleKeys.contains(role.getKey())) {
- throw new UnauthorizedRoleException(role.getKey());
- }
- return role;
- }
-
- @Transactional(readOnly = true)
- @Override
- public Map<Long, PropagationByResource> findUsersWithIndirectResources(final Long roleKey) {
- Role role = authFetch(roleKey);
-
- Map<Long, PropagationByResource> result = new HashMap<>();
-
- for (Membership membership : findMemberships(role)) {
- User user = membership.getUser();
-
- PropagationByResource propByRes = new PropagationByResource();
- for (ExternalResource resource : role.getResources()) {
- if (!user.getOwnResources().contains(resource)) {
- propByRes.add(ResourceOperation.DELETE, resource.getKey());
- }
-
- if (!propByRes.isEmpty()) {
- result.put(user.getKey(), propByRes);
- }
- }
- }
-
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPASubjectSearchDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPASubjectSearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPASubjectSearchDAO.java
index 0fec6de..3e30b7c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPASubjectSearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPASubjectSearchDAO.java
@@ -37,7 +37,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.SubjectType;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
@@ -65,7 +65,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
private UserDAO userDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private PlainSchemaDAO schemaDAO;
@@ -73,50 +73,50 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
@Autowired
private AttributableUtilFactory attrUtilFactory;
- private String getAdminRolesFilter(final Set<Long> adminRoles, final SubjectType type) {
- final StringBuilder adminRolesFilter = new StringBuilder();
+ private String getAdminGroupsFilter(final Set<Long> adminGroups, final SubjectType type) {
+ final StringBuilder adminGroupFilter = new StringBuilder();
if (type == SubjectType.USER) {
- adminRolesFilter.append("SELECT user_id AS subject_id FROM Membership M1 WHERE role_id IN (").
- append("SELECT role_id FROM Membership M2 WHERE M2.user_id=M1.user_id ").
- append("AND role_id NOT IN (");
+ adminGroupFilter.append("SELECT user_id AS subject_id FROM Membership M1 WHERE group_id IN (").
+ append("SELECT group_id FROM Membership M2 WHERE M2.user_id=M1.user_id ").
+ append("AND group_id NOT IN (");
}
- adminRolesFilter.append("SELECT id AS ").
- append(type == SubjectType.USER ? "role" : "subject").
- append("_id FROM SyncopeRole");
+ adminGroupFilter.append("SELECT id AS ").
+ append(type == SubjectType.USER ? "group" : "subject").
+ append("_id FROM SyncopeGroup");
- boolean firstRole = true;
+ boolean firstGroup = true;
- for (Long adminRoleId : adminRoles) {
- if (firstRole) {
- adminRolesFilter.append(" WHERE");
- firstRole = false;
+ for (Long adminGroupId : adminGroups) {
+ if (firstGroup) {
+ adminGroupFilter.append(" WHERE");
+ firstGroup = false;
} else {
- adminRolesFilter.append(type == SubjectType.USER ? " OR" : " AND");
+ adminGroupFilter.append(type == SubjectType.USER ? " OR" : " AND");
}
- adminRolesFilter.append(type == SubjectType.USER ? " id = " : " id <> ").append(adminRoleId);
+ adminGroupFilter.append(type == SubjectType.USER ? " id = " : " id <> ").append(adminGroupId);
}
if (type == SubjectType.USER) {
- adminRolesFilter.append("))");
+ adminGroupFilter.append("))");
}
- return adminRolesFilter.toString();
+ return adminGroupFilter.toString();
}
@Override
- public int count(final Set<Long> adminRoles, final SearchCond searchCondition, final SubjectType type) {
+ public int count(final Set<Long> adminGroups, final SearchCond searchCondition, final SubjectType type) {
List<Object> parameters = Collections.synchronizedList(new ArrayList<>());
// 1. get the query string from the search condition
SearchSupport svs = new SearchSupport(type);
StringBuilder queryString = getQuery(searchCondition, parameters, type, svs);
- // 2. take into account administrative roles
+ // 2. take into account administrative groups
queryString.insert(0, "SELECT u.subject_id FROM (");
queryString.append(") u WHERE subject_id NOT IN (");
- queryString.append(getAdminRolesFilter(adminRoles, type)).append(')');
+ queryString.append(getAdminGroupsFilter(adminGroups, type)).append(')');
// 3. prepare the COUNT query
queryString.insert(0, "SELECT COUNT(subject_id) FROM (");
@@ -135,32 +135,32 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
@Override
public <T extends Subject<?, ?, ?>> List<T> search(
- final Set<Long> adminRoles, final SearchCond searchCondition, final SubjectType type) {
+ final Set<Long> adminGroups, final SearchCond searchCondition, final SubjectType type) {
- return search(adminRoles, searchCondition, Collections.<OrderByClause>emptyList(), type);
+ return search(adminGroups, searchCondition, Collections.<OrderByClause>emptyList(), type);
}
@Override
public <T extends Subject<?, ?, ?>> List<T> search(
- final Set<Long> adminRoles, final SearchCond searchCondition, final List<OrderByClause> orderBy,
+ final Set<Long> adminGroups, final SearchCond searchCondition, final List<OrderByClause> orderBy,
final SubjectType type) {
- return search(adminRoles, searchCondition, -1, -1, orderBy, type);
+ return search(adminGroups, searchCondition, -1, -1, orderBy, type);
}
@Override
public <T extends Subject<?, ?, ?>> List<T> search(
- final Set<Long> adminRoles, final SearchCond searchCondition, final int page, final int itemsPerPage,
+ final Set<Long> adminGroups, final SearchCond searchCondition, final int page, final int itemsPerPage,
final List<OrderByClause> orderBy, final SubjectType type) {
List<T> result = Collections.<T>emptyList();
- if (adminRoles != null && (!adminRoles.isEmpty() || roleDAO.findAll().isEmpty())) {
+ if (adminGroups != null && (!adminGroups.isEmpty() || groupDAO.findAll().isEmpty())) {
LOG.debug("Search condition:\n{}", searchCondition);
if (searchCondition != null && searchCondition.isValid()) {
try {
- result = doSearch(adminRoles, searchCondition, page, itemsPerPage, orderBy, type);
+ result = doSearch(adminGroups, searchCondition, page, itemsPerPage, orderBy, type);
} catch (Exception e) {
LOG.error("While searching for {}", type, e);
}
@@ -184,7 +184,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
boolean matches;
if (queryString.length() == 0) {
- // Could be empty: got into a role search with a single membership condition ...
+ // Could be empty: got into a group search with a single membership condition ...
matches = false;
} else {
// 2. take into account the passed user
@@ -331,7 +331,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
}
@SuppressWarnings("unchecked")
- private <T extends Subject<?, ?, ?>> List<T> doSearch(final Set<Long> adminRoles,
+ private <T extends Subject<?, ?, ?>> List<T> doSearch(final Set<Long> adminGroups,
final SearchCond nodeCond, final int page, final int itemsPerPage, final List<OrderByClause> orderBy,
final SubjectType type) {
@@ -341,7 +341,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
SearchSupport svs = new SearchSupport(type);
StringBuilder queryString = getQuery(nodeCond, parameters, type, svs);
- // 2. take into account administrative roles and ordering
+ // 2. take into account administrative groups and ordering
OrderBySupport orderBySupport = parseOrderBy(type, svs, orderBy);
if (queryString.charAt(0) == '(') {
queryString.insert(0, buildSelect(orderBySupport));
@@ -351,7 +351,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
queryString.append(')').append(buildWhere(orderBySupport, type));
}
queryString.
- append(getAdminRolesFilter(adminRoles, type)).append(')').
+ append(getAdminGroupsFilter(adminGroups, type)).append(')').
append(buildOrderBy(orderBySupport));
// 3. prepare the search query
@@ -382,7 +382,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
T subject = type == SubjectType.USER
? (T) userDAO.find(actualId)
- : (T) roleDAO.find(actualId);
+ : (T) groupDAO.find(actualId);
if (subject == null) {
LOG.error("Could not find {} with id {}, even though returned by the native query",
type, actualId);
@@ -461,7 +461,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
query.append("SELECT DISTINCT subject_id ").append("FROM ").
append(svs.membership().name).append(" WHERE ").
- append("role_id=?").append(setParameter(parameters, cond.getRoleId())).
+ append("group_id=?").append(setParameter(parameters, cond.getGroupId())).
append(')');
return query.toString();
@@ -486,7 +486,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
if (type == SubjectType.USER) {
query.append(" UNION SELECT DISTINCT subject_id FROM ").
- append(svs.roleResource().name).
+ append(svs.groupResource().name).
append(" WHERE resource_name=?").
append(setParameter(parameters, cond.getResourceName()));
}
@@ -676,7 +676,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
}
// Deal with subject Integer fields logically mapping to boolean values
- // (JPARole.inheritPlainAttrs, for example)
+ // (JPAGroup.inheritPlainAttrs, for example)
boolean foundBooleanMin = false;
boolean foundBooleanMax = false;
if (Integer.class.equals(subjectField.getType())) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
index c08e1a2..5e48aac 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
@@ -26,9 +26,9 @@ import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
@@ -48,7 +48,7 @@ import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.misc.security.UnauthorizedRoleException;
+import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@@ -60,7 +60,7 @@ public class JPAUserDAO extends AbstractSubjectDAO<UPlainAttr, UDerAttr, UVirAtt
private SubjectSearchDAO searchDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Resource(name = "anonymousUser")
private String anonymousUser;
@@ -69,7 +69,7 @@ public class JPAUserDAO extends AbstractSubjectDAO<UPlainAttr, UDerAttr, UVirAtt
private AttributableUtilFactory attrUtilFactory;
@Override
- protected Subject<UPlainAttr, UDerAttr, UVirAttr> findInternal(Long key) {
+ protected Subject<UPlainAttr, UDerAttr, UVirAttr> findInternal(final Long key) {
return find(key);
}
@@ -174,8 +174,8 @@ public class JPAUserDAO extends AbstractSubjectDAO<UPlainAttr, UDerAttr, UVirAtt
}
@Override
- public final List<User> findAll(final Set<Long> adminRoles, final int page, final int itemsPerPage) {
- return findAll(adminRoles, page, itemsPerPage, Collections.<OrderByClause>emptyList());
+ public final List<User> findAll(final Set<Long> adminGroups, final int page, final int itemsPerPage) {
+ return findAll(adminGroups, page, itemsPerPage, Collections.<OrderByClause>emptyList());
}
private SearchCond getAllMatchingCond() {
@@ -185,16 +185,16 @@ public class JPAUserDAO extends AbstractSubjectDAO<UPlainAttr, UDerAttr, UVirAtt
}
@Override
- public List<User> findAll(final Set<Long> adminRoles,
+ public List<User> findAll(final Set<Long> adminGroups,
final int page, final int itemsPerPage, final List<OrderByClause> orderBy) {
return searchDAO.search(
- adminRoles, getAllMatchingCond(), page, itemsPerPage, orderBy, SubjectType.USER);
+ adminGroups, getAllMatchingCond(), page, itemsPerPage, orderBy, SubjectType.USER);
}
@Override
- public final int count(final Set<Long> adminRoles) {
- return searchDAO.count(adminRoles, getAllMatchingCond(), SubjectType.USER);
+ public final int count(final Set<Long> adminGroups) {
+ return searchDAO.count(adminGroups, getAllMatchingCond(), SubjectType.USER);
}
@Override
@@ -225,8 +225,8 @@ public class JPAUserDAO extends AbstractSubjectDAO<UPlainAttr, UDerAttr, UVirAtt
for (Membership membership : user.getMemberships()) {
membership.setUser(null);
- roleDAO.save(membership.getRole());
- membership.setRole(null);
+ groupDAO.save(membership.getGroup());
+ membership.setGroup(null);
entityManager.remove(membership);
}
@@ -237,15 +237,15 @@ public class JPAUserDAO extends AbstractSubjectDAO<UPlainAttr, UDerAttr, UVirAtt
private void securityChecks(final User user) {
// Allows anonymous (during self-registration) and self (during self-update) to read own user,
- // otherwise goes thorugh security checks to see if needed role entitlements are owned
+ // otherwise goes thorugh security checks to see if needed group entitlements are owned
if (!AuthContextUtil.getAuthenticatedUsername().equals(anonymousUser)
&& !AuthContextUtil.getAuthenticatedUsername().equals(user.getUsername())) {
- Set<Long> roleKeys = user.getRoleKeys();
- Set<Long> adminRoleKeys = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
- roleKeys.removeAll(adminRoleKeys);
- if (!roleKeys.isEmpty()) {
- throw new UnauthorizedRoleException(roleKeys);
+ Set<Long> groupKeys = user.getGroupKeys();
+ Set<Long> adminGroupKeys = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+ groupKeys.removeAll(adminGroupKeys);
+ if (!groupKeys.isEmpty()) {
+ throw new UnauthorizedGroupException(groupKeys);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirAttrDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirAttrDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirAttrDAO.java
index 2235295..48a645a 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirAttrDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirAttrDAO.java
@@ -24,11 +24,11 @@ import org.apache.syncope.core.persistence.api.dao.VirAttrDAO;
import org.apache.syncope.core.persistence.api.entity.Attributable;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttr;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttr;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirAttr;
import org.springframework.stereotype.Repository;
@@ -38,8 +38,8 @@ public class JPAVirAttrDAO extends AbstractDAO<VirAttr, Long> implements VirAttr
public <T extends VirAttr> Class<? extends AbstractVirAttr> getJPAEntityReference(
final Class<T> reference) {
- return RVirAttr.class.isAssignableFrom(reference)
- ? JPARVirAttr.class
+ return GVirAttr.class.isAssignableFrom(reference)
+ ? JPAGVirAttr.class
: MVirAttr.class.isAssignableFrom(reference)
? JPAMVirAttr.class
: UVirAttr.class.isAssignableFrom(reference)
[31/57] syncope git commit: More replacements thanks to
commons-collections
Posted by il...@apache.org.
More replacements thanks to commons-collections
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/091c735f
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/091c735f
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/091c735f
Branch: refs/heads/master
Commit: 091c735fd84516757bac6f47edc98a34102734e1
Parents: c5d8c89
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 7 16:25:39 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 7 16:25:39 2015 +0200
----------------------------------------------------------------------
.../persistence/api/entity/Notification.java | 8 --
.../jpa/content/MultiParentNode.java | 6 +-
.../jpa/content/MultiParentNodeOp.java | 1 -
.../jpa/entity/AbstractAttributable.java | 81 ++++++++++----------
.../persistence/jpa/entity/AbstractMapping.java | 14 ++--
.../jpa/entity/AbstractPlainAttr.java | 13 +++-
.../jpa/entity/AbstractPlainAttrValue.java | 2 +-
.../jpa/entity/AbstractPlainSchema.java | 4 +-
.../persistence/jpa/entity/AbstractSubject.java | 15 ++--
.../jpa/entity/JPAAccountPolicy.java | 13 ++--
.../persistence/jpa/entity/JPAConnInstance.java | 11 +--
.../jpa/entity/JPAExternalResource.java | 20 ++---
.../persistence/jpa/entity/JPANotification.java | 21 -----
.../core/persistence/jpa/entity/JPAReport.java | 33 ++++----
.../jpa/entity/JPAttributableUtilFactory.java | 12 +--
.../persistence/jpa/entity/group/JPAGroup.java | 38 ++++-----
.../jpa/entity/membership/JPAMembership.java | 17 ++--
.../jpa/entity/task/JPANotificationTask.java | 2 +-
.../jpa/entity/task/JPAPropagationTask.java | 12 +--
.../persistence/jpa/entity/user/JPAUser.java | 45 +++++------
.../entity/ConnInstanceValidator.java | 1 -
.../entity/ExternalResourceValidator.java | 14 ++--
.../jpa/validation/entity/ReportValidator.java | 14 +++-
.../validation/entity/SchemaNameValidator.java | 21 ++---
.../jpa/entity/NotificationTest.java | 10 +--
25 files changed, 207 insertions(+), 221 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
index 0c55b14..e505f24 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
@@ -24,10 +24,6 @@ import org.apache.syncope.common.lib.types.TraceLevel;
public interface Notification extends Entity<Long> {
- boolean addEvent(String event);
-
- boolean addStaticRecipient(String staticRecipient);
-
List<String> getEvents();
String getRecipientAttrName();
@@ -54,10 +50,6 @@ public interface Notification extends Entity<Long> {
boolean isSelfAsRecipient();
- boolean removeEvent(String event);
-
- boolean removeStaticRecipient(String staticRecipient);
-
void setActive(boolean active);
void setRecipientAttrName(String recipientAttrName);
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNode.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNode.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNode.java
index 95b7da5..98529e8 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNode.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNode.java
@@ -35,14 +35,14 @@ class MultiParentNode<T> {
public MultiParentNode(final T object) {
this.object = object;
- children = new HashSet<MultiParentNode<T>>();
+ children = new HashSet<>();
}
public int getLevel() {
return level;
}
- public void setLevel(int level) {
+ public void setLevel(final int level) {
this.level = level;
}
@@ -50,7 +50,7 @@ class MultiParentNode<T> {
return exploited;
}
- void setExploited(boolean exploited) {
+ void setExploited(final boolean exploited) {
this.exploited = exploited;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNodeOp.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNodeOp.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNodeOp.java
index 7c16b13..68568ae 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNodeOp.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNodeOp.java
@@ -33,7 +33,6 @@ class MultiParentNodeOp {
}
public static <T> void traverseTree(final MultiParentNode<T> root, final Collection<T> objects) {
-
root.setExploited(true);
for (MultiParentNode<T> child : root.getChildren()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttributable.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttributable.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttributable.java
index d648748..6d4f6c3 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttributable.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttributable.java
@@ -20,6 +20,10 @@ package org.apache.syncope.core.persistence.jpa.entity;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.core.persistence.api.entity.Attributable;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
@@ -35,72 +39,67 @@ public abstract class AbstractAttributable<P extends PlainAttr, D extends DerAtt
@Override
public P getPlainAttr(final String plainSchemaName) {
- P result = null;
- for (P plainAttr : getPlainAttrs()) {
- if (plainAttr != null && plainAttr.getSchema() != null
- && plainSchemaName.equals(plainAttr.getSchema().getKey())) {
+ return CollectionUtils.find(getPlainAttrs(), new Predicate<P>() {
- result = plainAttr;
+ @Override
+ public boolean evaluate(final P plainAttr) {
+ return plainAttr != null && plainAttr.getSchema() != null
+ && plainSchemaName.equals(plainAttr.getSchema().getKey());
}
- }
- return result;
+ });
}
@Override
public D getDerAttr(final String derSchemaName) {
- D result = null;
- for (D derAttr : getDerAttrs()) {
- if (derAttr != null && derAttr.getSchema() != null
- && derSchemaName.equals(derAttr.getSchema().getKey())) {
+ return CollectionUtils.find(getDerAttrs(), new Predicate<D>() {
- result = derAttr;
+ @Override
+ public boolean evaluate(final D derAttr) {
+ return derAttr != null && derAttr.getSchema() != null
+ && derSchemaName.equals(derAttr.getSchema().getKey());
}
- }
-
- return result;
+ });
}
@Override
public V getVirAttr(final String virSchemaName) {
- V result = null;
- for (V virAttr : getVirAttrs()) {
- if (virAttr != null && virAttr.getSchema() != null
- && virSchemaName.equals(virAttr.getSchema().getKey())) {
+ return CollectionUtils.find(getVirAttrs(), new Predicate<V>() {
- result = virAttr;
+ @Override
+ public boolean evaluate(final V virAttr) {
+ return virAttr != null && virAttr.getSchema() != null
+ && virSchemaName.equals(virAttr.getSchema().getKey());
}
- }
-
- return result;
+ });
}
protected Map<PlainSchema, P> getPlainAttrMap() {
- final Map<PlainSchema, P> map = new HashMap<>();
+ return MapUtils.lazyMap(new HashMap<PlainSchema, P>(), new Transformer<PlainSchema, P>() {
- for (P attr : getPlainAttrs()) {
- map.put(attr.getSchema(), attr);
- }
-
- return map;
+ @Override
+ public P transform(final PlainSchema input) {
+ return getPlainAttr(input.getKey());
+ }
+ });
}
protected Map<DerSchema, D> getDerAttrMap() {
- final Map<DerSchema, D> map = new HashMap<>();
+ return MapUtils.lazyMap(new HashMap<DerSchema, D>(), new Transformer<DerSchema, D>() {
- for (D attr : getDerAttrs()) {
- map.put(attr.getSchema(), attr);
- }
-
- return map;
+ @Override
+ public D transform(final DerSchema input) {
+ return getDerAttr(input.getKey());
+ }
+ });
}
protected Map<VirSchema, V> getVirAttrMap() {
- final Map<VirSchema, V> map = new HashMap<>();
+ return MapUtils.lazyMap(new HashMap<VirSchema, V>(), new Transformer<VirSchema, V>() {
- for (V attr : getVirAttrs()) {
- map.put(attr.getSchema(), attr);
- }
-
- return map;
+ @Override
+ public V transform(final VirSchema input) {
+ return getVirAttr(input.getKey());
+ }
+ });
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
index 814909d..4481d3e 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
@@ -20,6 +20,8 @@ package org.apache.syncope.core.persistence.jpa.entity;
import javax.persistence.Cacheable;
import javax.persistence.MappedSuperclass;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.core.persistence.api.entity.Mapping;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
@@ -47,13 +49,13 @@ public abstract class AbstractMapping<T extends MappingItem> extends AbstractEnt
@Override
public T getAccountIdItem() {
- T accountIdItem = null;
- for (T item : getItems()) {
- if (item.isAccountid()) {
- accountIdItem = item;
+ return CollectionUtils.find(getItems(), new Predicate<T>() {
+
+ @Override
+ public boolean evaluate(final T item) {
+ return item.isAccountid();
}
- }
- return accountIdItem;
+ });
}
protected boolean addAccountIdItem(final T accountIdItem) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
index 659b7f1..2db17f0 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
@@ -23,6 +23,8 @@ import java.util.Collections;
import java.util.List;
import javax.persistence.MappedSuperclass;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
@@ -67,10 +69,13 @@ public abstract class AbstractPlainAttr extends AbstractEntity<Long> implements
public List<String> getValuesAsStrings() {
List<String> result;
if (getUniqueValue() == null) {
- result = new ArrayList<>(getValues().size());
- for (PlainAttrValue attributeValue : getValues()) {
- result.add(attributeValue.getValueAsString());
- }
+ result = CollectionUtils.collect(getValues(), new Transformer<PlainAttrValue, String>() {
+
+ @Override
+ public String transform(final PlainAttrValue input) {
+ return input.getValueAsString();
+ }
+ }, new ArrayList<String>());
} else {
result = Collections.singletonList(getUniqueValue().getValueAsString());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
index 4977dad..c3469b1 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
@@ -256,7 +256,7 @@ public abstract class AbstractPlainAttrValue extends AbstractEntity<Long> implem
break;
case Binary:
- result = new String(Base64.encodeBase64String(getBinaryValue()));
+ result = Base64.encodeBase64String(getBinaryValue());
break;
case String:
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainSchema.java
index cf0a3c9..d08ba1c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainSchema.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainSchema.java
@@ -143,7 +143,7 @@ public abstract class AbstractPlainSchema extends AbstractEntity<String> impleme
}
@Override
- public void setMultivalue(boolean multivalue) {
+ public void setMultivalue(final boolean multivalue) {
this.multivalue = getBooleanAsInteger(multivalue);
}
@@ -217,7 +217,7 @@ public abstract class AbstractPlainSchema extends AbstractEntity<String> impleme
}
@Override
- public void setEnumerationKeys(String enumerationKeys) {
+ public void setEnumerationKeys(final String enumerationKeys) {
this.enumerationKeys = enumerationKeys;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
index 194e57b..14a33aa 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
@@ -20,6 +20,8 @@ package org.apache.syncope.core.persistence.jpa.entity;
import java.util.HashSet;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
@@ -51,14 +53,13 @@ public abstract class AbstractSubject<P extends PlainAttr, D extends DerAttr, V
@Override
public Set<String> getResourceNames() {
- Set<? extends ExternalResource> ownResources = getResources();
+ return CollectionUtils.collect(getResources(), new Transformer<ExternalResource, String>() {
- Set<String> result = new HashSet<>(ownResources.size());
- for (ExternalResource resource : ownResources) {
- result.add(resource.getKey());
- }
-
- return result;
+ @Override
+ public String transform(final ExternalResource input) {
+ return input.getKey();
+ }
+ }, new HashSet<String>());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
index 726110a..068dd29 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
@@ -27,6 +27,8 @@ import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.validation.Valid;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.types.PolicyType;
import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
@@ -80,11 +82,12 @@ public class JPAAccountPolicy extends JPAPolicy implements AccountPolicy {
@Override
public Set<String> getResourceNames() {
- Set<String> result = new HashSet<>(resources.size());
- for (ExternalResource resource : resources) {
- result.add(resource.getKey());
- }
+ return CollectionUtils.collect(getResources(), new Transformer<ExternalResource, String>() {
- return result;
+ @Override
+ public String transform(final ExternalResource input) {
+ return input.getKey();
+ }
+ }, new HashSet<String>());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
index 048ea6a..6abedd5 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
@@ -19,8 +19,6 @@
package org.apache.syncope.core.persistence.jpa.entity;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -37,7 +35,7 @@ import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
-import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.ConnectorCapability;
@@ -182,12 +180,9 @@ public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstanc
@Override
public Set<ConnConfProperty> getConfiguration() {
- Set<ConnConfProperty> configuration = Collections.<ConnConfProperty>emptySet();
+ Set<ConnConfProperty> configuration = new HashSet<>();
if (!StringUtils.isBlank(jsonConf)) {
- ConnConfProperty[] deserialized = POJOHelper.deserialize(jsonConf, ConnConfProperty[].class);
- if (ArrayUtils.isNotEmpty(deserialized)) {
- configuration = new HashSet<>(Arrays.asList(deserialized));
- }
+ CollectionUtils.addAll(configuration, POJOHelper.deserialize(jsonConf, ConnConfProperty[].class));
}
return configuration;
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
index e1c44aa..908422b 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
@@ -19,8 +19,6 @@
package org.apache.syncope.core.persistence.jpa.entity;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -42,6 +40,7 @@ import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.PropagationMode;
@@ -253,7 +252,7 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
}
@Override
- public void setPropagationPrimary(boolean propagationPrimary) {
+ public void setPropagationPrimary(final boolean propagationPrimary) {
this.propagationPrimary = getBooleanAsInteger(propagationPrimary);
}
@@ -263,7 +262,7 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
}
@Override
- public void setPropagationPriority(Integer propagationPriority) {
+ public void setPropagationPriority(final Integer propagationPriority) {
if (propagationPriority != null) {
this.propagationPriority = propagationPriority;
}
@@ -275,7 +274,7 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
}
@Override
- public void setRandomPwdIfNotProvided(boolean randomPwdIfNotProvided) {
+ public void setRandomPwdIfNotProvided(final boolean randomPwdIfNotProvided) {
this.randomPwdIfNotProvided = getBooleanAsInteger(randomPwdIfNotProvided);
}
@@ -285,7 +284,7 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
}
@Override
- public void setPropagationMode(PropagationMode propagationMode) {
+ public void setPropagationMode(final PropagationMode propagationMode) {
this.propagationMode = propagationMode;
}
@@ -375,9 +374,12 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
@Override
public Set<ConnConfProperty> getConnInstanceConfiguration() {
- return StringUtils.isBlank(jsonConf)
- ? Collections.<ConnConfProperty>emptySet()
- : new HashSet<>(Arrays.asList(POJOHelper.deserialize(jsonConf, ConnConfProperty[].class)));
+ Set<ConnConfProperty> configuration = new HashSet<>();
+ if (!StringUtils.isBlank(jsonConf)) {
+ CollectionUtils.addAll(configuration, POJOHelper.deserialize(jsonConf, ConnConfProperty[].class));
+ }
+
+ return configuration;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
index b97ca54..d2acd58 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
@@ -174,32 +174,11 @@ public class JPANotification extends AbstractEntity<Long> implements Notificatio
}
@Override
- public boolean addEvent(final String event) {
- return event != null && !events.contains(event) && events.add(event);
- }
-
- @Override
- public boolean removeEvent(final String event) {
- return event != null && events.remove(event);
- }
-
- @Override
public List<String> getStaticRecipients() {
return staticRecipients;
}
@Override
- public boolean addStaticRecipient(final String staticRecipient) {
- return staticRecipient != null && !staticRecipients.contains(staticRecipient)
- && staticRecipients.add(staticRecipient);
- }
-
- @Override
- public boolean removeStaticRecipient(final String staticRecipient) {
- return staticRecipient != null && staticRecipients.remove(staticRecipient);
- }
-
- @Override
public boolean isSelfAsRecipient() {
return isBooleanAsInteger(selfAsRecipient);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAReport.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAReport.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAReport.java
index 788863e..544868f 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAReport.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAReport.java
@@ -27,9 +27,13 @@ import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.report.ReportletConf;
import org.apache.syncope.core.persistence.api.entity.Report;
import org.apache.syncope.core.persistence.api.entity.ReportExec;
+import org.apache.syncope.core.persistence.api.entity.ReportletConfInstance;
import org.apache.syncope.core.persistence.jpa.validation.entity.ReportCheck;
@Entity
@@ -109,31 +113,24 @@ public class JPAReport extends AbstractEntity<Long> implements Report {
@Override
public boolean removeReportletConf(final ReportletConf reportletConf) {
- if (reportletConf == null) {
- return false;
- }
+ return CollectionUtils.filter(reportletConfs, new Predicate<JPAReportletConfInstance>() {
- JPAReportletConfInstance found = null;
- for (JPAReportletConfInstance instance : reportletConfs) {
- if (reportletConf.equals(instance.getInstance())) {
- found = instance;
+ @Override
+ public boolean evaluate(final JPAReportletConfInstance object) {
+ return reportletConf.equals(object.getInstance());
}
- }
-
- return found == null
- ? false
- : reportletConfs.remove(found);
+ });
}
@Override
public List<ReportletConf> getReportletConfs() {
- List<ReportletConf> result = new ArrayList<>(reportletConfs.size());
-
- for (JPAReportletConfInstance instance : reportletConfs) {
- result.add(instance.getInstance());
- }
+ return CollectionUtils.collect(reportletConfs, new Transformer<ReportletConfInstance, ReportletConf>() {
- return result;
+ @Override
+ public ReportletConf transform(final ReportletConfInstance input) {
+ return input.getInstance();
+ }
+ }, new ArrayList<ReportletConf>());
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
index 8eaf54e..d81981a 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
@@ -47,8 +47,7 @@ public class JPAttributableUtilFactory implements AttributableUtilFactory {
AttributableType type = null;
if (ObjectClass.ACCOUNT.equals(objectClass)) {
type = AttributableType.USER;
- }
- if (ObjectClass.GROUP.equals(objectClass)) {
+ } else if (ObjectClass.GROUP.equals(objectClass)) {
type = AttributableType.GROUP;
}
@@ -64,14 +63,11 @@ public class JPAttributableUtilFactory implements AttributableUtilFactory {
AttributableType type = null;
if (attributable instanceof User) {
type = AttributableType.USER;
- }
- if (attributable instanceof Group) {
+ } else if (attributable instanceof Group) {
type = AttributableType.GROUP;
- }
- if (attributable instanceof Membership) {
+ } else if (attributable instanceof Membership) {
type = AttributableType.MEMBERSHIP;
- }
- if (attributable instanceof Conf) {
+ } else if (attributable instanceof Conf) {
type = AttributableType.CONFIGURATION;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
----------------------------------------------------------------------
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 5924b16..e6dcc7b 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
@@ -41,6 +41,9 @@ import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
@@ -338,26 +341,24 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
public <T extends AttrTemplate<K>, K extends Schema> T getAttrTemplate(
final Class<T> reference, final String schemaName) {
- T result = null;
+ return CollectionUtils.find(findInheritedTemplates(reference), new Predicate<T>() {
- for (T template : findInheritedTemplates(reference)) {
- if (schemaName.equals(template.getSchema().getKey())) {
- result = template;
+ @Override
+ public boolean evaluate(final T template) {
+ return schemaName.equals(template.getSchema().getKey());
}
- }
-
- return result;
+ });
}
@Override
public <T extends AttrTemplate<K>, K extends Schema> List<K> getAttrTemplateSchemas(final Class<T> reference) {
- final List<K> result = new ArrayList<>();
-
- for (T template : findInheritedTemplates(reference)) {
- result.add(template.getSchema());
- }
+ return CollectionUtils.collect(findInheritedTemplates(reference), new Transformer<T, K>() {
- return result;
+ @Override
+ public K transform(final T input) {
+ return input.getSchema();
+ }
+ }, new ArrayList<K>());
}
@Override
@@ -439,11 +440,11 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
*/
@Override
public List<? extends GPlainAttr> findLastInheritedAncestorPlainAttrs() {
- final Map<JPAGPlainSchema, GPlainAttr> result = new HashMap<>();
-
if (!isInheritPlainAttrs()) {
return plainAttrs;
}
+
+ final Map<JPAGPlainSchema, GPlainAttr> result = new HashMap<>();
if (isInheritPlainAttrs() && getParent() != null) {
final Map<PlainSchema, GPlainAttr> attrMap = getPlainAttrMap();
@@ -476,11 +477,11 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
*/
@Override
public List<? extends GDerAttr> findLastInheritedAncestorDerAttrs() {
- final Map<GDerSchema, GDerAttr> result = new HashMap<>();
-
if (!isInheritDerAttrs()) {
return derAttrs;
}
+
+ final Map<GDerSchema, GDerAttr> result = new HashMap<>();
if (isInheritDerAttrs() && getParent() != null) {
Map<DerSchema, GDerAttr> derAttrMap = getDerAttrMap();
@@ -513,12 +514,11 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
*/
@Override
public List<? extends GVirAttr> findLastInheritedAncestorVirAttrs() {
- final Map<GVirSchema, GVirAttr> result = new HashMap<>();
-
if (!isInheritVirAttrs()) {
return virAttrs;
}
+ final Map<GVirSchema, GVirAttr> result = new HashMap<>();
if (isInheritVirAttrs() && getParent() != null) {
Map<VirSchema, GVirAttr> virAttrMap = getVirAttrMap();
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
index 2579eba..ad79250 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
@@ -28,6 +28,8 @@ import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.Valid;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.core.persistence.api.entity.membership.MDerAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr;
@@ -127,12 +129,15 @@ public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MV
checkType(derAttr, JPAMDerAttr.class);
if (getGroup() != null && derAttr.getSchema() != null) {
- MDerAttrTemplate found = null;
- for (MDerAttrTemplate template : getGroup().findInheritedTemplates(MDerAttrTemplate.class)) {
- if (derAttr.getSchema().equals(template.getSchema())) {
- found = template;
- }
- }
+ MDerAttrTemplate found = CollectionUtils.find(getGroup().findInheritedTemplates(MDerAttrTemplate.class),
+ new Predicate<MDerAttrTemplate>() {
+
+ @Override
+ public boolean evaluate(final MDerAttrTemplate template) {
+ return derAttr.getSchema().equals(template.getSchema());
+ }
+
+ });
if (found != null) {
derAttr.setTemplate(found);
return derAttrs.add((JPAMDerAttr) derAttr);
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPANotificationTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPANotificationTask.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPANotificationTask.java
index e175245..b63bd10 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPANotificationTask.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPANotificationTask.java
@@ -144,7 +144,7 @@ public class JPANotificationTask extends JPATask implements NotificationTask {
}
@Override
- public void setExecuted(boolean executed) {
+ public void setExecuted(final boolean executed) {
this.executed = getBooleanAsInteger(executed);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPropagationTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPropagationTask.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPropagationTask.java
index e532f3c..90104a3 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPropagationTask.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPropagationTask.java
@@ -18,8 +18,6 @@
*/
package org.apache.syncope.core.persistence.jpa.entity.task;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.DiscriminatorValue;
@@ -28,6 +26,7 @@ import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.PropagationMode;
@@ -118,9 +117,12 @@ public class JPAPropagationTask extends JPATask implements PropagationTask {
@Override
public Set<Attribute> getAttributes() {
- return StringUtils.isBlank(xmlAttributes)
- ? Collections.<Attribute>emptySet()
- : new HashSet<>(Arrays.asList(POJOHelper.deserialize(xmlAttributes, Attribute[].class)));
+ Set<Attribute> attributes = new HashSet<>();
+ if (!StringUtils.isBlank(xmlAttributes)) {
+ CollectionUtils.addAll(attributes, POJOHelper.deserialize(xmlAttributes, Attribute[].class));
+ }
+
+ return attributes;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
index 704c3b7..a5e3f28 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.persistence.Basic;
@@ -50,6 +49,9 @@ import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
@@ -212,15 +214,13 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
@Override
public Membership getMembership(final Long groupKey) {
- Membership result = null;
- Membership membership;
- for (Iterator<? extends Membership> itor = getMemberships().iterator(); result == null && itor.hasNext();) {
- membership = itor.next();
- if (membership.getGroup() != null && groupKey.equals(membership.getGroup().getKey())) {
- result = membership;
+ return CollectionUtils.find(getMemberships(), new Predicate<Membership>() {
+
+ @Override
+ public boolean evaluate(final Membership membership) {
+ return membership.getGroup() != null && groupKey.equals(membership.getGroup().getKey());
}
- }
- return result;
+ });
}
@Override
@@ -230,27 +230,24 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
@Override
public List<Group> getGroups() {
- List<Group> result = new ArrayList<>();
+ return CollectionUtils.collect(memberships, new Transformer<Membership, Group>() {
- for (Membership membership : memberships) {
- if (membership.getGroup() != null) {
- result.add(membership.getGroup());
+ @Override
+ public Group transform(final Membership input) {
+ return input.getGroup();
}
- }
-
- return result;
+ }, new ArrayList<Group>());
}
@Override
public Set<Long> getGroupKeys() {
- List<Group> groups = getGroups();
-
- Set<Long> result = new HashSet<>(groups.size());
- for (Group group : groups) {
- result.add(group.getKey());
- }
+ return CollectionUtils.collect(getGroups(), new Transformer<Group, Long>() {
- return result;
+ @Override
+ public Long transform(final Group input) {
+ return input.getKey();
+ }
+ }, new HashSet<Long>());
}
@Override
@@ -417,7 +414,7 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
@Override
public boolean checkToken(final String token) {
- return this.token == null
+ return this.token == null
? token == null
: this.token.equals(token) && !hasTokenExpired();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ConnInstanceValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ConnInstanceValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ConnInstanceValidator.java
index d99c5ae..2393975 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ConnInstanceValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ConnInstanceValidator.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.jpa.validation.entity;
import javax.validation.ConstraintValidatorContext;
import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
-import org.apache.syncope.core.persistence.jpa.entity.JPAConnPoolConf;
import org.apache.syncope.core.provisioning.api.URIUtil;
import org.apache.syncope.core.provisioning.api.ConnPoolConfUtil;
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
index 5737287..9fbbeab 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
@@ -19,6 +19,8 @@
package org.apache.syncope.core.persistence.jpa.validation.entity;
import javax.validation.ConstraintValidatorContext;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.EntityViolationType;
@@ -63,12 +65,13 @@ public class ExternalResourceValidator extends AbstractValidator<ExternalResourc
return true;
}
- int accountIds = 0;
- for (MappingItem item : mapping.getItems()) {
- if (item.isAccountid()) {
- accountIds++;
+ int accountIds = CollectionUtils.countMatches(mapping.getItems(), new Predicate<MappingItem>() {
+
+ @Override
+ public boolean evaluate(final MappingItem item) {
+ return item.isAccountid();
}
- }
+ });
if (accountIds != 1) {
context.buildConstraintViolationWithTemplate(
getTemplate(EntityViolationType.InvalidMapping, "One and only one accountId mapping is needed")).
@@ -79,6 +82,7 @@ public class ExternalResourceValidator extends AbstractValidator<ExternalResourc
final MappingItem accountId = mapping.getAccountIdItem();
if (mapping instanceof UMapping
&& AttributableType.GROUP == accountId.getIntMappingType().getAttributableType()) {
+
context.buildConstraintViolationWithTemplate(
getTemplate(EntityViolationType.InvalidMapping,
"Group attribute as accountId is not permitted")).
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ReportValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ReportValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ReportValidator.java
index 0025725..e05dee8 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ReportValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ReportValidator.java
@@ -22,6 +22,8 @@ import java.text.ParseException;
import java.util.HashSet;
import java.util.Set;
import javax.validation.ConstraintValidatorContext;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.report.ReportletConf;
import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.core.persistence.api.entity.Report;
@@ -48,10 +50,14 @@ public class ReportValidator extends AbstractValidator<ReportCheck, Report> {
}
}
- Set<String> reportletNames = new HashSet<>();
- for (ReportletConf conf : object.getReportletConfs()) {
- reportletNames.add(conf.getName());
- }
+ Set<String> reportletNames = CollectionUtils.collect(object.getReportletConfs(),
+ new Transformer<ReportletConf, String>() {
+
+ @Override
+ public String transform(final ReportletConf input) {
+ return input.getName();
+ }
+ }, new HashSet<String>());
if (reportletNames.size() != object.getReportletConfs().size()) {
LOG.error("Reportlet name must be unique");
isValid = false;
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
index cf7e53d..5084522 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
@@ -19,11 +19,12 @@
package org.apache.syncope.core.persistence.jpa.validation.entity;
import java.lang.reflect.Field;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.validation.ConstraintValidatorContext;
import org.apache.commons.lang3.ClassUtils;
import org.apache.syncope.common.lib.types.EntityViolationType;
@@ -44,13 +45,13 @@ import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Object> {
- private static final List<String> UNALLOWED_USCHEMA_NAMES = new ArrayList<>();
+ private static final Set<String> UNALLOWED_USCHEMA_NAMES = new HashSet<>();
- private static final List<String> UNALLOWED_MSCHEMA_NAMES = new ArrayList<>();
+ private static final Set<String> UNALLOWED_MSCHEMA_NAMES = new HashSet<>();
- private static final List<String> UNALLOWED_RSCHEMA_NAMES = new ArrayList<>();
+ private static final Set<String> UNALLOWED_RSCHEMA_NAMES = new HashSet<>();
- private static final List<String> UNALLOWED_CSCHEMA_NAMES = new ArrayList<>();
+ private static final Set<String> UNALLOWED_CSCHEMA_NAMES = new HashSet<>();
static {
initUnallowedSchemaNames(JPAUser.class, UNALLOWED_USCHEMA_NAMES);
@@ -59,9 +60,11 @@ public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Obje
initUnallowedSchemaNames(JPAConf.class, UNALLOWED_CSCHEMA_NAMES);
}
- private static void initUnallowedSchemaNames(final Class<?> entityClass, final List<String> names) {
+ private static void initUnallowedSchemaNames(final Class<?> entityClass, final Set<String> names) {
List<Class<?>> classes = ClassUtils.getAllSuperclasses(entityClass);
- classes.add(JPAUser.class);
+ if (!classes.contains(JPAUser.class)) {
+ classes.add(JPAUser.class);
+ }
for (Class<?> clazz : classes) {
for (Field field : clazz.getDeclaredFields()) {
if (!Collection.class.isAssignableFrom(field.getType())
@@ -76,7 +79,7 @@ public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Obje
@Override
public boolean isValid(final Object object, final ConstraintValidatorContext context) {
final String schemaName;
- final List<String> unallowedNames;
+ final Set<String> unallowedNames;
if (object instanceof UPlainSchema) {
schemaName = ((UPlainSchema) object).getKey();
@@ -110,7 +113,7 @@ public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Obje
unallowedNames = UNALLOWED_CSCHEMA_NAMES;
} else {
schemaName = null;
- unallowedNames = Collections.emptyList();
+ unallowedNames = Collections.emptySet();
}
boolean isValid = NAME_PATTERN.matcher(schemaName).matches();
http://git-wip-us.apache.org/repos/asf/syncope/blob/091c735f/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/NotificationTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/NotificationTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/NotificationTest.java
index f162259..8b545b8 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/NotificationTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/NotificationTest.java
@@ -58,7 +58,7 @@ public class NotificationTest extends AbstractTest {
@Test
public void save() {
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("save");
+ notification.getEvents().add("save");
notification.setUserAbout("fake search condition");
@@ -85,7 +85,7 @@ public class NotificationTest extends AbstractTest {
@Test
public void issueSYNCOPE445() {
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("save");
+ notification.getEvents().add("save");
notification.setUserAbout("fake search condition");
@@ -94,7 +94,7 @@ public class NotificationTest extends AbstractTest {
notification.setRecipientAttrName("email");
notification.setRecipientAttrType(IntMappingType.UserPlainSchema);
- notification.addStaticRecipient("syncope445@syncope.apache.org");
+ notification.getStaticRecipients().add("syncope445@syncope.apache.org");
notification.setSender("syncope@syncope.apache.org");
notification.setSubject("Test notification");
@@ -110,14 +110,14 @@ public class NotificationTest extends AbstractTest {
@Test
public void issueSYNCOPE446() {
Notification notification = entityFactory.newEntity(Notification.class);
- notification.addEvent("[REST]:[GroupLogic]:[]:[create]:[SUCCESS]");
+ notification.getEvents().add("[REST]:[GroupLogic]:[]:[create]:[SUCCESS]");
notification.setGroupAbout("fake search condition");
notification.setRecipientAttrName("email");
notification.setRecipientAttrType(IntMappingType.UserPlainSchema);
- notification.addStaticRecipient("syncope446@syncope.apache.org");
+ notification.getStaticRecipients().add("syncope446@syncope.apache.org");
notification.setSender("syncope@syncope.apache.org");
notification.setSubject("Test notification");
[49/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
new file mode 100644
index 0000000..db49c0f
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
@@ -0,0 +1,735 @@
+/*
+ * 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.misc;
+
+import org.apache.syncope.core.misc.policy.InvalidPasswordPolicySpecException;
+import org.apache.syncope.core.misc.security.PasswordGenerator;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.jexl2.JexlContext;
+import org.apache.commons.jexl2.MapContext;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.syncope.common.lib.CollectionUtils2;
+import org.apache.syncope.common.lib.mod.AttrMod;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
+import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
+import org.apache.syncope.core.persistence.api.entity.Attributable;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
+import org.apache.syncope.core.persistence.api.entity.DerAttr;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.Subject;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.Membership;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
+import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.user.UVirSchema;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
+import org.apache.syncope.core.misc.security.Encryptor;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
+import org.identityconnectors.framework.common.FrameworkUtil;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.AttributeUtil;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.OperationalAttributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ConfigurableApplicationContext;
+
+public final class MappingUtils {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(MappingUtils.class);
+
+ private static final Encryptor ENCRYPTOR = Encryptor.getInstance();
+
+ public static <T extends MappingItem> Collection<T> getMatchingMappingItems(
+ final Collection<T> items, final IntMappingType type) {
+
+ return CollectionUtils2.find(items, new Predicate<T>() {
+
+ @Override
+ public boolean evaluate(final T item) {
+ return item.getIntMappingType() == type;
+ }
+ });
+ }
+
+ public static <T extends MappingItem> Collection<T> getMatchingMappingItems(
+ final Collection<T> items, final String intAttrName, final IntMappingType type) {
+
+ return CollectionUtils2.find(items, new Predicate<T>() {
+
+ @Override
+ public boolean evaluate(final T item) {
+ return item.getIntMappingType() == type && intAttrName.equals(item.getIntAttrName());
+ }
+ });
+ }
+
+ public static <T extends MappingItem> Collection<T> getMatchingMappingItems(
+ final Collection<T> items, final String intAttrName) {
+
+ return CollectionUtils2.find(items, new Predicate<T>() {
+
+ @Override
+ public boolean evaluate(final T item) {
+ return intAttrName.equals(item.getIntAttrName());
+ }
+ });
+ }
+
+ /**
+ * Prepare attributes for sending to a connector instance.
+ *
+ * @param attrUtils user / group
+ * @param subject given user / group
+ * @param password clear-text password
+ * @param changePwd whether password should be included for propagation attributes or not
+ * @param vAttrsToBeRemoved virtual attributes to be removed
+ * @param vAttrsToBeUpdated virtual attributes to be added
+ * @param membVAttrsToBeRemoved membership virtual attributes to be removed
+ * @param membVAttrsToBeUpdated membership virtual attributes to be added
+ * @param enable whether user must be enabled or not
+ * @param resource target resource
+ * @return account link + prepared attributes
+ */
+ public static Pair<String, Set<Attribute>> prepareAttributes(
+ final AttributableUtils attrUtils, final Subject<?, ?, ?> subject,
+ final String password,
+ final boolean changePwd,
+ final Set<String> vAttrsToBeRemoved,
+ final Map<String, AttrMod> vAttrsToBeUpdated,
+ final Set<String> membVAttrsToBeRemoved,
+ final Map<String, AttrMod> membVAttrsToBeUpdated,
+ final Boolean enable,
+ final ExternalResource resource) {
+
+ LOG.debug("Preparing resource attributes for {} on resource {} with attributes {}",
+ subject, resource, subject.getPlainAttrs());
+
+ final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
+ final VirAttrCache virAttrCache = context.getBean(VirAttrCache.class);
+ final PasswordGenerator passwordGenerator = context.getBean(PasswordGenerator.class);
+
+ Set<Attribute> attributes = new HashSet<>();
+ String accountId = null;
+
+ for (MappingItem mapping : attrUtils.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
+ LOG.debug("Processing schema {}", mapping.getIntAttrName());
+
+ try {
+ if ((attrUtils.getType() == AttributableType.USER
+ && mapping.getIntMappingType() == IntMappingType.UserVirtualSchema)
+ || (attrUtils.getType() == AttributableType.GROUP
+ && mapping.getIntMappingType() == IntMappingType.GroupVirtualSchema)) {
+
+ LOG.debug("Expire entry cache {}-{}", subject.getKey(), mapping.getIntAttrName());
+ virAttrCache.expire(attrUtils.getType(), subject.getKey(), mapping.getIntAttrName());
+ }
+
+ // SYNCOPE-458 expire cache also for membership virtual schemas
+ if (attrUtils.getType() == AttributableType.USER && mapping.getIntMappingType()
+ == IntMappingType.MembershipVirtualSchema && (subject instanceof User)) {
+
+ final User user = (User) subject;
+ for (Membership membership : user.getMemberships()) {
+ LOG.debug("Expire entry cache {}-{} for membership {}", subject.getKey(),
+ mapping.getIntAttrName(), membership);
+ virAttrCache.expire(AttributableType.MEMBERSHIP, membership.getKey(),
+ mapping.getIntAttrName());
+ }
+ }
+
+ Pair<String, Attribute> preparedAttr = prepareAttr(
+ resource, mapping, subject, password, passwordGenerator, vAttrsToBeRemoved, vAttrsToBeUpdated,
+ membVAttrsToBeRemoved, membVAttrsToBeUpdated);
+
+ if (preparedAttr != null && preparedAttr.getKey() != null) {
+ accountId = preparedAttr.getKey();
+ }
+
+ if (preparedAttr != null && preparedAttr.getValue() != null) {
+ Attribute alreadyAdded = AttributeUtil.find(preparedAttr.getValue().getName(), attributes);
+
+ if (alreadyAdded == null) {
+ attributes.add(preparedAttr.getValue());
+ } else {
+ attributes.remove(alreadyAdded);
+
+ Set<Object> values = new HashSet<>(alreadyAdded.getValue());
+ values.addAll(preparedAttr.getValue().getValue());
+
+ attributes.add(AttributeBuilder.build(preparedAttr.getValue().getName(), values));
+ }
+ }
+ } catch (Exception e) {
+ LOG.debug("Attribute '{}' processing failed", mapping.getIntAttrName(), e);
+ }
+ }
+
+ final Attribute accountIdExtAttr =
+ AttributeUtil.find(attrUtils.getAccountIdItem(resource).getExtAttrName(), attributes);
+ if (accountIdExtAttr != null) {
+ attributes.remove(accountIdExtAttr);
+ attributes.add(AttributeBuilder.build(attrUtils.getAccountIdItem(resource).getExtAttrName(), accountId));
+ }
+ attributes.add(MappingUtils.evaluateNAME(subject, resource, accountId));
+
+ if (enable != null) {
+ attributes.add(AttributeBuilder.buildEnabled(enable));
+ }
+ if (!changePwd) {
+ Attribute pwdAttr = AttributeUtil.find(OperationalAttributes.PASSWORD_NAME, attributes);
+ if (pwdAttr != null) {
+ attributes.remove(pwdAttr);
+ }
+ }
+
+ return new ImmutablePair<>(accountId, attributes);
+ }
+
+ /**
+ * Prepare an attribute to be sent to a connector instance.
+ *
+ * @param resource target resource
+ * @param mapItem mapping item for the given attribute
+ * @param subject given user
+ * @param password clear-text password
+ * @param passwordGenerator password generator
+ * @param vAttrsToBeRemoved virtual attributes to be removed
+ * @param vAttrsToBeUpdated virtual attributes to be added
+ * @return account link + prepared attribute
+ */
+ @SuppressWarnings("unchecked")
+ private static Pair<String, Attribute> prepareAttr(
+ final ExternalResource resource, final MappingItem mapItem,
+ final Subject<?, ?, ?> subject, final String password, final PasswordGenerator passwordGenerator,
+ final Set<String> vAttrsToBeRemoved, final Map<String, AttrMod> vAttrsToBeUpdated,
+ final Set<String> membVAttrsToBeRemoved, final Map<String, AttrMod> membVAttrsToBeUpdated) {
+
+ List<Attributable<?, ?, ?>> attributables = new ArrayList<>();
+
+ ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
+ AttributableUtilsFactory attrUtilsFactory = context.getBean(AttributableUtilsFactory.class);
+ ConnObjectUtils connObjectUtils = context.getBean(ConnObjectUtils.class);
+
+ switch (mapItem.getIntMappingType().getAttributableType()) {
+ case USER:
+ if (subject instanceof User) {
+ attributables.add(subject);
+ }
+ break;
+
+ case GROUP:
+ if (subject instanceof User) {
+ for (Group group : ((User) subject).getGroups()) {
+ connObjectUtils.retrieveVirAttrValues(group, attrUtilsFactory.getInstance(group));
+ attributables.add(group);
+ }
+ }
+ if (subject instanceof Group) {
+ attributables.add(subject);
+ }
+ break;
+
+ case MEMBERSHIP:
+ if (subject instanceof User) {
+ attributables.addAll(((User) subject).getMemberships());
+ }
+ break;
+
+ default:
+ }
+
+ List<PlainAttrValue> values = getIntValues(
+ resource, mapItem, attributables, vAttrsToBeRemoved, vAttrsToBeUpdated, membVAttrsToBeRemoved,
+ membVAttrsToBeUpdated);
+
+ PlainSchema schema = null;
+ boolean readOnlyVirSchema = false;
+ AttrSchemaType schemaType;
+ final Pair<String, Attribute> result;
+
+ switch (mapItem.getIntMappingType()) {
+ case UserPlainSchema:
+ case GroupPlainSchema:
+ case MembershipPlainSchema:
+ final PlainSchemaDAO plainSchemaDAO = context.getBean(PlainSchemaDAO.class);
+ schema = plainSchemaDAO.find(mapItem.getIntAttrName(),
+ MappingUtils.getIntMappingTypeClass(mapItem.getIntMappingType()));
+ schemaType = schema == null ? AttrSchemaType.String : schema.getType();
+ break;
+
+ case UserVirtualSchema:
+ case GroupVirtualSchema:
+ case MembershipVirtualSchema:
+ VirSchemaDAO virSchemaDAO = context.getBean(VirSchemaDAO.class);
+ VirSchema virSchema = virSchemaDAO.find(mapItem.getIntAttrName(),
+ MappingUtils.getIntMappingTypeClass(mapItem.getIntMappingType()));
+ readOnlyVirSchema = (virSchema != null && virSchema.isReadonly());
+ schemaType = AttrSchemaType.String;
+ break;
+
+ default:
+ schemaType = AttrSchemaType.String;
+ }
+
+ final String extAttrName = mapItem.getExtAttrName();
+
+ LOG.debug("Define mapping for: "
+ + "\n* ExtAttrName " + extAttrName
+ + "\n* is accountId " + mapItem.isAccountid()
+ + "\n* is password " + (mapItem.isPassword() || mapItem.getIntMappingType() == IntMappingType.Password)
+ + "\n* mandatory condition " + mapItem.getMandatoryCondition()
+ + "\n* Schema " + mapItem.getIntAttrName()
+ + "\n* IntMappingType " + mapItem.getIntMappingType().toString()
+ + "\n* ClassType " + schemaType.getType().getName()
+ + "\n* Values " + values);
+
+ if (readOnlyVirSchema) {
+ result = null;
+ } else {
+ final List<Object> objValues = new ArrayList<>();
+
+ for (PlainAttrValue value : values) {
+ if (FrameworkUtil.isSupportedAttributeType(schemaType.getType())) {
+ objValues.add(value.getValue());
+ } else {
+ objValues.add(value.getValueAsString());
+ }
+ }
+
+ if (mapItem.isAccountid()) {
+ result = new ImmutablePair<>(objValues.iterator().next().toString(), null);
+ } else if (mapItem.isPassword() && subject instanceof User) {
+ String passwordAttrValue = password;
+ if (StringUtils.isBlank(passwordAttrValue)) {
+ User user = (User) subject;
+ if (user.canDecodePassword()) {
+ try {
+ passwordAttrValue = ENCRYPTOR.decode(user.getPassword(), user.getCipherAlgorithm());
+ } catch (Exception e) {
+ LOG.error("Could not decode password for {}", user, e);
+ }
+ } else if (resource.isRandomPwdIfNotProvided()) {
+ try {
+ passwordAttrValue = passwordGenerator.generate(user);
+ } catch (InvalidPasswordPolicySpecException e) {
+ LOG.error("Could not generate policy-compliant random password for {}", user, e);
+ }
+ }
+ }
+
+ if (passwordAttrValue == null) {
+ result = null;
+ } else {
+ result = new ImmutablePair<>(
+ null,
+ AttributeBuilder.buildPassword(passwordAttrValue.toCharArray()));
+ }
+ } else {
+ if ((schema != null && schema.isMultivalue()) || attrUtilsFactory.getInstance(subject).getType()
+ != mapItem.getIntMappingType().getAttributableType()) {
+
+ result = new ImmutablePair<>(
+ null,
+ AttributeBuilder.build(extAttrName, objValues));
+ } else {
+ result = new ImmutablePair<>(
+ null, objValues.isEmpty()
+ ? AttributeBuilder.build(extAttrName)
+ : AttributeBuilder.build(extAttrName, objValues.iterator().next()));
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Build __NAME__ for propagation. First look if there ia a defined accountLink for the given resource (and in this
+ * case evaluate as JEXL); otherwise, take given accountId.
+ *
+ * @param subject given user / group
+ * @param resource target resource
+ * @param accountId accountId
+ * @return the value to be propagated as __NAME__
+ */
+ public static Name evaluateNAME(final Subject<?, ?, ?> subject,
+ final ExternalResource resource, final String accountId) {
+
+ final AttributableUtilsFactory attrUtilsFactory =
+ ApplicationContextProvider.getApplicationContext().getBean(AttributableUtilsFactory.class);
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(subject);
+
+ if (StringUtils.isBlank(accountId)) {
+ // LOG error but avoid to throw exception: leave it to the external resource
+ LOG.error("Missing accountId for '{}': ", resource.getKey());
+ }
+
+ // Evaluate AccountLink expression
+ String evalAccountLink = null;
+ if (StringUtils.isNotBlank(attrUtils.getAccountLink(resource))) {
+ final JexlContext jexlContext = new MapContext();
+ JexlUtils.addFieldsToContext(subject, jexlContext);
+ JexlUtils.addAttrsToContext(subject.getPlainAttrs(), jexlContext);
+ JexlUtils.addDerAttrsToContext(subject.getDerAttrs(), subject.getPlainAttrs(), jexlContext);
+ evalAccountLink = JexlUtils.evaluate(attrUtils.getAccountLink(resource), jexlContext);
+ }
+
+ // If AccountLink evaluates to an empty string, just use the provided AccountId as Name(),
+ // otherwise evaluated AccountLink expression is taken as Name().
+ Name name;
+ if (StringUtils.isBlank(evalAccountLink)) {
+ // add AccountId as __NAME__ attribute ...
+ LOG.debug("Add AccountId [{}] as __NAME__", accountId);
+ name = new Name(accountId);
+ } else {
+ LOG.debug("Add AccountLink [{}] as __NAME__", evalAccountLink);
+ name = new Name(evalAccountLink);
+
+ // AccountId not propagated: it will be used to set the value for __UID__ attribute
+ LOG.debug("AccountId will be used just as __UID__ attribute");
+ }
+
+ return name;
+ }
+
+ private static String getGroupOwnerValue(
+ final ExternalResource resource, final Subject<?, ?, ?> subject) {
+
+ AttributableUtilsFactory attrUtilsFactory =
+ ApplicationContextProvider.getApplicationContext().getBean(AttributableUtilsFactory.class);
+
+ Pair<String, Attribute> preparedAttr = prepareAttr(
+ resource, attrUtilsFactory.getInstance(subject).getAccountIdItem(resource), subject, null, null,
+ Collections.<String>emptySet(), Collections.<String, AttrMod>emptyMap(),
+ Collections.<String>emptySet(), Collections.<String, AttrMod>emptyMap());
+ String accountId = preparedAttr.getKey();
+
+ final Name groupOwnerName = evaluateNAME(subject, resource, accountId);
+ return groupOwnerName.getNameValue();
+ }
+
+ /**
+ * Get attribute values.
+ *
+ * @param resource target resource
+ * @param mappingItem mapping item
+ * @param attributables list of attributables
+ * @param vAttrsToBeRemoved virtual attributes to be removed
+ * @param vAttrsToBeUpdated virtual attributes to be added
+ * @param membVAttrsToBeRemoved membership virtual attributes to be removed
+ * @param membVAttrsToBeUpdated membership virtual attributes to be added
+ * @return attribute values.
+ */
+ public static List<PlainAttrValue> getIntValues(final ExternalResource resource,
+ final MappingItem mappingItem, final List<Attributable<?, ?, ?>> attributables,
+ final Set<String> vAttrsToBeRemoved, final Map<String, AttrMod> vAttrsToBeUpdated,
+ final Set<String> membVAttrsToBeRemoved, final Map<String, AttrMod> membVAttrsToBeUpdated) {
+
+ LOG.debug("Get attributes for '{}' and mapping type '{}'", attributables, mappingItem.getIntMappingType());
+
+ final EntityFactory entityFactory =
+ ApplicationContextProvider.getApplicationContext().getBean(EntityFactory.class);
+ List<PlainAttrValue> values = new ArrayList<>();
+ PlainAttrValue attrValue;
+ switch (mappingItem.getIntMappingType()) {
+ case UserPlainSchema:
+ case GroupPlainSchema:
+ case MembershipPlainSchema:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ final PlainAttr attr = attributable.getPlainAttr(mappingItem.getIntAttrName());
+ if (attr != null) {
+ if (attr.getUniqueValue() != null) {
+ values.add(attr.getUniqueValue());
+ } else if (attr.getValues() != null) {
+ values.addAll(attr.getValues());
+ }
+ }
+
+ LOG.debug("Retrieved attribute {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ attr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
+ }
+
+ break;
+
+ case UserVirtualSchema:
+ case GroupVirtualSchema:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ VirAttr virAttr = attributable.getVirAttr(mappingItem.getIntAttrName());
+ if (virAttr != null) {
+ if (vAttrsToBeRemoved != null && vAttrsToBeUpdated != null) {
+ if (vAttrsToBeUpdated.containsKey(mappingItem.getIntAttrName())) {
+ virAttr.getValues().clear();
+ virAttr.getValues().addAll(
+ vAttrsToBeUpdated.get(mappingItem.getIntAttrName()).getValuesToBeAdded());
+ } else if (vAttrsToBeRemoved.contains(mappingItem.getIntAttrName())) {
+ virAttr.getValues().clear();
+ } else {
+ throw new IllegalArgumentException("Don't need to update virtual attribute '"
+ + mappingItem.getIntAttrName() + "'");
+ }
+ }
+ if (virAttr.getValues() != null) {
+ for (String value : virAttr.getValues()) {
+ attrValue = entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(value);
+ values.add(attrValue);
+ }
+ }
+ }
+
+ LOG.debug("Retrieved {} virtual attribute {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ attributable.getClass().getSimpleName(),
+ virAttr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
+ }
+ break;
+
+ case MembershipVirtualSchema:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ VirAttr virAttr = attributable.getVirAttr(mappingItem.getIntAttrName());
+ if (virAttr != null) {
+ if (membVAttrsToBeRemoved != null && membVAttrsToBeUpdated != null) {
+ if (membVAttrsToBeUpdated.containsKey(mappingItem.getIntAttrName())) {
+ virAttr.getValues().clear();
+ virAttr.getValues().addAll(
+ membVAttrsToBeUpdated.get(mappingItem.getIntAttrName()).getValuesToBeAdded());
+ } else if (membVAttrsToBeRemoved.contains(mappingItem.getIntAttrName())) {
+ virAttr.getValues().clear();
+ } else {
+ throw new IllegalArgumentException("Don't need to update membership virtual attribute '"
+ + mappingItem.getIntAttrName() + "'");
+ }
+ }
+ if (virAttr.getValues() != null) {
+ for (String value : virAttr.getValues()) {
+ attrValue = entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(value);
+ values.add(attrValue);
+ }
+ }
+ }
+
+ LOG.debug("Retrieved {} virtual attribute {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ attributable.getClass().getSimpleName(),
+ virAttr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
+ }
+ break;
+
+ case UserDerivedSchema:
+ case GroupDerivedSchema:
+ case MembershipDerivedSchema:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ DerAttr derAttr = attributable.getDerAttr(mappingItem.getIntAttrName());
+ if (derAttr != null) {
+ attrValue = attributable instanceof Group
+ ? entityFactory.newEntity(GPlainAttrValue.class)
+ : entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(derAttr.getValue(attributable.getPlainAttrs()));
+ values.add(attrValue);
+ }
+
+ LOG.debug("Retrieved attribute {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ derAttr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
+ }
+ break;
+
+ case UserId:
+ case GroupId:
+ case MembershipId:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ attrValue = entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(attributable.getKey().toString());
+ values.add(attrValue);
+ }
+ break;
+
+ case Username:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ if (attributable instanceof User) {
+ attrValue = entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(((User) attributable).getUsername());
+ values.add(attrValue);
+ }
+ }
+ break;
+
+ case GroupName:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ if (attributable instanceof Group) {
+ attrValue = entityFactory.newEntity(GPlainAttrValue.class);
+ attrValue.setStringValue(((Group) attributable).getName());
+ values.add(attrValue);
+ }
+ }
+ break;
+
+ case GroupOwnerSchema:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ if (attributable instanceof Group) {
+ Group group = (Group) attributable;
+ String groupOwnerValue = null;
+ if (group.getUserOwner() != null && resource.getUmapping() != null) {
+ groupOwnerValue = getGroupOwnerValue(resource, group.getUserOwner());
+ }
+ if (group.getGroupOwner() != null && resource.getGmapping() != null) {
+ groupOwnerValue = getGroupOwnerValue(resource, group.getGroupOwner());
+ }
+
+ if (StringUtils.isNotBlank(groupOwnerValue)) {
+ attrValue = entityFactory.newEntity(GPlainAttrValue.class);
+ attrValue.setStringValue(groupOwnerValue);
+ values.add(attrValue);
+ }
+ }
+ }
+ break;
+
+ default:
+ }
+
+ LOG.debug("Retrieved values '{}'", values);
+
+ return values;
+ }
+
+ /**
+ * Get accountId internal value.
+ *
+ * @param attributable attributable
+ * @param accountIdItem accountId mapping item
+ * @param resource external resource
+ * @return accountId internal value
+ */
+ public static String getAccountIdValue(final Attributable<?, ?, ?> attributable,
+ final ExternalResource resource, final MappingItem accountIdItem) {
+
+ List<PlainAttrValue> values = getIntValues(resource, accountIdItem,
+ Collections.<Attributable<?, ?, ?>>singletonList(attributable), null, null, null, null);
+ return values == null || values.isEmpty()
+ ? null
+ : values.get(0).getValueAsString();
+ }
+
+ /**
+ * For given source mapping type, return the corresponding Class object.
+ *
+ * @param intMappingType source mapping type
+ * @return corresponding Class object, if any (can be null)
+ */
+ @SuppressWarnings("rawtypes")
+ public static Class getIntMappingTypeClass(final IntMappingType intMappingType) {
+ Class result;
+
+ switch (intMappingType) {
+ case UserPlainSchema:
+ result = UPlainSchema.class;
+ break;
+
+ case GroupPlainSchema:
+ result = GPlainSchema.class;
+ break;
+
+ case MembershipPlainSchema:
+ result = MPlainSchema.class;
+ break;
+
+ case UserDerivedSchema:
+ result = UDerSchema.class;
+ break;
+
+ case GroupDerivedSchema:
+ result = GDerSchema.class;
+ break;
+
+ case MembershipDerivedSchema:
+ result = MDerSchema.class;
+ break;
+
+ case UserVirtualSchema:
+ result = UVirSchema.class;
+ break;
+
+ case GroupVirtualSchema:
+ result = GVirSchema.class;
+ break;
+
+ case MembershipVirtualSchema:
+ result = MVirSchema.class;
+ break;
+
+ default:
+ result = null;
+ }
+
+ return result;
+ }
+
+ /**
+ * Private default constructor, for static-only classes.
+ */
+ private MappingUtils() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/RealmUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/RealmUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/RealmUtils.java
new file mode 100644
index 0000000..7a921ee
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/RealmUtils.java
@@ -0,0 +1,61 @@
+/*
+ * 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.misc;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+public final class RealmUtils {
+
+ public static String getGroupOwnerRealm(final String realmPath, final Long groupId) {
+ return realmPath + "@" + groupId;
+ }
+
+ public static boolean normalizingAddTo(final Set<String> realms, final String newRealm) {
+ boolean dontAdd = false;
+ Set<String> toRemove = new HashSet<>();
+ for (String realm : realms) {
+ if (newRealm.startsWith(realm)) {
+ dontAdd = true;
+ } else if (realm.startsWith(newRealm)) {
+ toRemove.add(realm);
+ }
+ }
+
+ realms.removeAll(toRemove);
+ if (!dontAdd) {
+ realms.add(newRealm);
+ }
+ return !dontAdd;
+ }
+
+ public static Set<String> normalize(final Collection<String> realms) {
+ Set<String> normalized = new HashSet<>();
+ for (String realm : realms) {
+ normalizingAddTo(normalized, realm);
+ }
+
+ return normalized;
+ }
+
+ private RealmUtils() {
+ // empty constructor for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java
deleted file mode 100644
index b624eaa..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java
+++ /dev/null
@@ -1,285 +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.misc.jexl;
-
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import org.apache.commons.jexl2.Expression;
-import org.apache.commons.jexl2.JexlContext;
-import org.apache.commons.jexl2.JexlEngine;
-import org.apache.commons.jexl2.JexlException;
-import org.apache.commons.jexl2.MapContext;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.to.AbstractAttributableTO;
-import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-import org.apache.syncope.core.persistence.api.entity.VirAttr;
-import org.apache.syncope.core.misc.DataFormat;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * JEXL <a href="http://commons.apache.org/jexl/reference/index.html">reference</a> is available.
- */
-public final class JexlUtil {
-
- private static final Logger LOG = LoggerFactory.getLogger(JexlUtil.class);
-
- private static final String[] IGNORE_FIELDS = { "password", "clearPassword", "serialVersionUID", "class" };
-
- private static JexlEngine JEXL_ENGINE;
-
- private static JexlEngine getEngine() {
- synchronized (LOG) {
- if (JEXL_ENGINE == null) {
- JEXL_ENGINE = new JexlEngine(new ClassFreeUberspectImpl(null), null, null, null);
- JEXL_ENGINE.setClassLoader(new EmptyClassLoader());
- JEXL_ENGINE.setCache(512);
- JEXL_ENGINE.setLenient(true);
- JEXL_ENGINE.setSilent(false);
- }
- }
-
- return JEXL_ENGINE;
- }
-
- public static boolean isExpressionValid(final String expression) {
- boolean result;
- try {
- getEngine().createExpression(expression);
- result = true;
- } catch (JexlException e) {
- LOG.error("Invalid jexl expression: " + expression, e);
- result = false;
- }
-
- return result;
- }
-
- public static String evaluate(final String expression, final JexlContext jexlContext) {
- String result = StringUtils.EMPTY;
-
- if (StringUtils.isNotBlank(expression) && jexlContext != null) {
- try {
- Expression jexlExpression = getEngine().createExpression(expression);
- Object evaluated = jexlExpression.evaluate(jexlContext);
- if (evaluated != null) {
- result = evaluated.toString();
- }
- } catch (Exception e) {
- LOG.error("Error while evaluating JEXL expression: " + expression, e);
- }
- } else {
- LOG.debug("Expression not provided or invalid context");
- }
-
- return result;
- }
-
- public static JexlContext addFieldsToContext(final Object object, final JexlContext jexlContext) {
- JexlContext context = jexlContext == null ? new MapContext() : jexlContext;
-
- try {
- for (PropertyDescriptor desc : Introspector.getBeanInfo(object.getClass()).getPropertyDescriptors()) {
- final Class<?> type = desc.getPropertyType();
- final String fieldName = desc.getName();
-
- if ((!fieldName.startsWith("pc"))
- && (!ArrayUtils.contains(IGNORE_FIELDS, fieldName))
- && (!Iterable.class.isAssignableFrom(type))
- && (!type.isArray())) {
- try {
- final Method getter = desc.getReadMethod();
-
- final Object fieldValue;
-
- if (getter == null) {
- final Field field = object.getClass().getDeclaredField(fieldName);
- field.setAccessible(true);
- fieldValue = field.get(object);
- } else {
- fieldValue = getter.invoke(object);
- }
-
- context.set(fieldName, fieldValue == null
- ? StringUtils.EMPTY
- : (type.equals(Date.class)
- ? DataFormat.format((Date) fieldValue, false)
- : fieldValue));
-
- LOG.debug("Add field {} with value {}", fieldName, fieldValue);
-
- } catch (Exception iae) {
- LOG.error("Reading '{}' value error", fieldName, iae);
- }
- }
- }
- } catch (IntrospectionException ie) {
- LOG.error("Reading class attributes error", ie);
- }
-
- return context;
- }
-
- public static JexlContext addAttrsToContext(final Collection<? extends PlainAttr> attrs,
- final JexlContext jexlContext) {
-
- JexlContext context = jexlContext == null
- ? new MapContext()
- : jexlContext;
-
- for (PlainAttr attr : attrs) {
- if (attr.getSchema() != null) {
- List<String> attrValues = attr.getValuesAsStrings();
- String expressionValue = attrValues.isEmpty()
- ? StringUtils.EMPTY
- : attrValues.get(0);
-
- LOG.debug("Add attribute {} with value {}", attr.getSchema().getKey(), expressionValue);
-
- context.set(attr.getSchema().getKey(), expressionValue);
- }
- }
-
- return context;
- }
-
- public static JexlContext addDerAttrsToContext(final Collection<? extends DerAttr> derAttrs,
- final Collection<? extends PlainAttr> attrs, final JexlContext jexlContext) {
-
- JexlContext context = jexlContext == null
- ? new MapContext()
- : jexlContext;
-
- for (DerAttr derAttr : derAttrs) {
- if (derAttr.getSchema() != null) {
- String expressionValue = derAttr.getValue(attrs);
- if (expressionValue == null) {
- expressionValue = StringUtils.EMPTY;
- }
-
- LOG.debug("Add derived attribute {} with value {}", derAttr.getSchema().getKey(), expressionValue);
-
- context.set(derAttr.getSchema().getKey(), expressionValue);
- }
- }
-
- return context;
- }
-
- public static JexlContext addVirAttrsToContext(final Collection<? extends VirAttr> virAttrs,
- final JexlContext jexlContext) {
-
- JexlContext context = jexlContext == null
- ? new MapContext()
- : jexlContext;
-
- for (VirAttr virAttr : virAttrs) {
- if (virAttr.getSchema() != null) {
- List<String> attrValues = virAttr.getValues();
- String expressionValue = attrValues.isEmpty()
- ? StringUtils.EMPTY
- : attrValues.get(0);
-
- LOG.debug("Add virtual attribute {} with value {}", virAttr.getSchema().getKey(), expressionValue);
-
- context.set(virAttr.getSchema().getKey(), expressionValue);
- }
- }
-
- return context;
- }
-
- public static boolean evaluateMandatoryCondition(
- final String mandatoryCondition, final Attributable<?, ?, ?> attributable) {
-
- JexlContext jexlContext = new MapContext();
- addAttrsToContext(attributable.getPlainAttrs(), jexlContext);
- addDerAttrsToContext(attributable.getDerAttrs(), attributable.getPlainAttrs(), jexlContext);
- addVirAttrsToContext(attributable.getVirAttrs(), jexlContext);
-
- return Boolean.parseBoolean(evaluate(mandatoryCondition, jexlContext));
- }
-
- public static String evaluate(final String expression,
- final Attributable<?, ?, ?> attributable, final Collection<? extends PlainAttr> attributes) {
-
- final JexlContext jexlContext = new MapContext();
- JexlUtil.addAttrsToContext(attributes, jexlContext);
- JexlUtil.addFieldsToContext(attributable, jexlContext);
-
- // Evaluate expression using the context prepared before
- return evaluate(expression, jexlContext);
- }
-
- public static String evaluate(final String expression, final AbstractAttributableTO attributableTO) {
- final JexlContext context = new MapContext();
-
- addFieldsToContext(attributableTO, context);
-
- for (AttrTO plainAttr : attributableTO.getPlainAttrs()) {
- List<String> values = plainAttr.getValues();
- String expressionValue = values.isEmpty()
- ? StringUtils.EMPTY
- : values.get(0);
-
- LOG.debug("Add plain attribute {} with value {}", plainAttr.getSchema(), expressionValue);
-
- context.set(plainAttr.getSchema(), expressionValue);
- }
- for (AttrTO derAttr : attributableTO.getDerAttrs()) {
- List<String> values = derAttr.getValues();
- String expressionValue = values.isEmpty()
- ? StringUtils.EMPTY
- : values.get(0);
-
- LOG.debug("Add derived attribute {} with value {}", derAttr.getSchema(), expressionValue);
-
- context.set(derAttr.getSchema(), expressionValue);
- }
- for (AttrTO virAttr : attributableTO.getVirAttrs()) {
- List<String> values = virAttr.getValues();
- String expressionValue = values.isEmpty()
- ? StringUtils.EMPTY
- : values.get(0);
-
- LOG.debug("Add virtual attribute {} with value {}", virAttr.getSchema(), expressionValue);
-
- context.set(virAttr.getSchema(), expressionValue);
- }
-
- // Evaluate expression using the context prepared before
- return evaluate(expression, context);
- }
-
- /**
- * Private default constructor, for static-only classes.
- */
- private JexlUtil() {
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtils.java
new file mode 100644
index 0000000..bc3159c
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtils.java
@@ -0,0 +1,285 @@
+/*
+ * 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.misc.jexl;
+
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import org.apache.commons.jexl2.Expression;
+import org.apache.commons.jexl2.JexlContext;
+import org.apache.commons.jexl2.JexlEngine;
+import org.apache.commons.jexl2.JexlException;
+import org.apache.commons.jexl2.MapContext;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.core.persistence.api.entity.Attributable;
+import org.apache.syncope.core.persistence.api.entity.DerAttr;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+import org.apache.syncope.core.misc.DataFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * JEXL <a href="http://commons.apache.org/jexl/reference/index.html">reference</a> is available.
+ */
+public final class JexlUtils {
+
+ private static final Logger LOG = LoggerFactory.getLogger(JexlUtils.class);
+
+ private static final String[] IGNORE_FIELDS = { "password", "clearPassword", "serialVersionUID", "class" };
+
+ private static JexlEngine JEXL_ENGINE;
+
+ private static JexlEngine getEngine() {
+ synchronized (LOG) {
+ if (JEXL_ENGINE == null) {
+ JEXL_ENGINE = new JexlEngine(new ClassFreeUberspectImpl(null), null, null, null);
+ JEXL_ENGINE.setClassLoader(new EmptyClassLoader());
+ JEXL_ENGINE.setCache(512);
+ JEXL_ENGINE.setLenient(true);
+ JEXL_ENGINE.setSilent(false);
+ }
+ }
+
+ return JEXL_ENGINE;
+ }
+
+ public static boolean isExpressionValid(final String expression) {
+ boolean result;
+ try {
+ getEngine().createExpression(expression);
+ result = true;
+ } catch (JexlException e) {
+ LOG.error("Invalid jexl expression: " + expression, e);
+ result = false;
+ }
+
+ return result;
+ }
+
+ public static String evaluate(final String expression, final JexlContext jexlContext) {
+ String result = StringUtils.EMPTY;
+
+ if (StringUtils.isNotBlank(expression) && jexlContext != null) {
+ try {
+ Expression jexlExpression = getEngine().createExpression(expression);
+ Object evaluated = jexlExpression.evaluate(jexlContext);
+ if (evaluated != null) {
+ result = evaluated.toString();
+ }
+ } catch (Exception e) {
+ LOG.error("Error while evaluating JEXL expression: " + expression, e);
+ }
+ } else {
+ LOG.debug("Expression not provided or invalid context");
+ }
+
+ return result;
+ }
+
+ public static JexlContext addFieldsToContext(final Object object, final JexlContext jexlContext) {
+ JexlContext context = jexlContext == null ? new MapContext() : jexlContext;
+
+ try {
+ for (PropertyDescriptor desc : Introspector.getBeanInfo(object.getClass()).getPropertyDescriptors()) {
+ final Class<?> type = desc.getPropertyType();
+ final String fieldName = desc.getName();
+
+ if ((!fieldName.startsWith("pc"))
+ && (!ArrayUtils.contains(IGNORE_FIELDS, fieldName))
+ && (!Iterable.class.isAssignableFrom(type))
+ && (!type.isArray())) {
+ try {
+ final Method getter = desc.getReadMethod();
+
+ final Object fieldValue;
+
+ if (getter == null) {
+ final Field field = object.getClass().getDeclaredField(fieldName);
+ field.setAccessible(true);
+ fieldValue = field.get(object);
+ } else {
+ fieldValue = getter.invoke(object);
+ }
+
+ context.set(fieldName, fieldValue == null
+ ? StringUtils.EMPTY
+ : (type.equals(Date.class)
+ ? DataFormat.format((Date) fieldValue, false)
+ : fieldValue));
+
+ LOG.debug("Add field {} with value {}", fieldName, fieldValue);
+
+ } catch (Exception iae) {
+ LOG.error("Reading '{}' value error", fieldName, iae);
+ }
+ }
+ }
+ } catch (IntrospectionException ie) {
+ LOG.error("Reading class attributes error", ie);
+ }
+
+ return context;
+ }
+
+ public static JexlContext addAttrsToContext(final Collection<? extends PlainAttr> attrs,
+ final JexlContext jexlContext) {
+
+ JexlContext context = jexlContext == null
+ ? new MapContext()
+ : jexlContext;
+
+ for (PlainAttr attr : attrs) {
+ if (attr.getSchema() != null) {
+ List<String> attrValues = attr.getValuesAsStrings();
+ String expressionValue = attrValues.isEmpty()
+ ? StringUtils.EMPTY
+ : attrValues.get(0);
+
+ LOG.debug("Add attribute {} with value {}", attr.getSchema().getKey(), expressionValue);
+
+ context.set(attr.getSchema().getKey(), expressionValue);
+ }
+ }
+
+ return context;
+ }
+
+ public static JexlContext addDerAttrsToContext(final Collection<? extends DerAttr> derAttrs,
+ final Collection<? extends PlainAttr> attrs, final JexlContext jexlContext) {
+
+ JexlContext context = jexlContext == null
+ ? new MapContext()
+ : jexlContext;
+
+ for (DerAttr derAttr : derAttrs) {
+ if (derAttr.getSchema() != null) {
+ String expressionValue = derAttr.getValue(attrs);
+ if (expressionValue == null) {
+ expressionValue = StringUtils.EMPTY;
+ }
+
+ LOG.debug("Add derived attribute {} with value {}", derAttr.getSchema().getKey(), expressionValue);
+
+ context.set(derAttr.getSchema().getKey(), expressionValue);
+ }
+ }
+
+ return context;
+ }
+
+ public static JexlContext addVirAttrsToContext(final Collection<? extends VirAttr> virAttrs,
+ final JexlContext jexlContext) {
+
+ JexlContext context = jexlContext == null
+ ? new MapContext()
+ : jexlContext;
+
+ for (VirAttr virAttr : virAttrs) {
+ if (virAttr.getSchema() != null) {
+ List<String> attrValues = virAttr.getValues();
+ String expressionValue = attrValues.isEmpty()
+ ? StringUtils.EMPTY
+ : attrValues.get(0);
+
+ LOG.debug("Add virtual attribute {} with value {}", virAttr.getSchema().getKey(), expressionValue);
+
+ context.set(virAttr.getSchema().getKey(), expressionValue);
+ }
+ }
+
+ return context;
+ }
+
+ public static boolean evaluateMandatoryCondition(
+ final String mandatoryCondition, final Attributable<?, ?, ?> attributable) {
+
+ JexlContext jexlContext = new MapContext();
+ addAttrsToContext(attributable.getPlainAttrs(), jexlContext);
+ addDerAttrsToContext(attributable.getDerAttrs(), attributable.getPlainAttrs(), jexlContext);
+ addVirAttrsToContext(attributable.getVirAttrs(), jexlContext);
+
+ return Boolean.parseBoolean(evaluate(mandatoryCondition, jexlContext));
+ }
+
+ public static String evaluate(final String expression,
+ final Attributable<?, ?, ?> attributable, final Collection<? extends PlainAttr> attributes) {
+
+ final JexlContext jexlContext = new MapContext();
+ JexlUtils.addAttrsToContext(attributes, jexlContext);
+ JexlUtils.addFieldsToContext(attributable, jexlContext);
+
+ // Evaluate expression using the context prepared before
+ return evaluate(expression, jexlContext);
+ }
+
+ public static String evaluate(final String expression, final AbstractAttributableTO attributableTO) {
+ final JexlContext context = new MapContext();
+
+ addFieldsToContext(attributableTO, context);
+
+ for (AttrTO plainAttr : attributableTO.getPlainAttrs()) {
+ List<String> values = plainAttr.getValues();
+ String expressionValue = values.isEmpty()
+ ? StringUtils.EMPTY
+ : values.get(0);
+
+ LOG.debug("Add plain attribute {} with value {}", plainAttr.getSchema(), expressionValue);
+
+ context.set(plainAttr.getSchema(), expressionValue);
+ }
+ for (AttrTO derAttr : attributableTO.getDerAttrs()) {
+ List<String> values = derAttr.getValues();
+ String expressionValue = values.isEmpty()
+ ? StringUtils.EMPTY
+ : values.get(0);
+
+ LOG.debug("Add derived attribute {} with value {}", derAttr.getSchema(), expressionValue);
+
+ context.set(derAttr.getSchema(), expressionValue);
+ }
+ for (AttrTO virAttr : attributableTO.getVirAttrs()) {
+ List<String> values = virAttr.getValues();
+ String expressionValue = values.isEmpty()
+ ? StringUtils.EMPTY
+ : values.get(0);
+
+ LOG.debug("Add virtual attribute {} with value {}", virAttr.getSchema(), expressionValue);
+
+ context.set(virAttr.getSchema(), expressionValue);
+ }
+
+ // Evaluate expression using the context prepared before
+ return evaluate(expression, context);
+ }
+
+ /**
+ * Private default constructor, for static-only classes.
+ */
+ private JexlUtils() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
index ab0e7fb..4b8faec 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
@@ -91,8 +91,8 @@ public class AccountPolicyEnforcer implements PolicyEnforcer<AccountPolicySpec,
// check for subsequent failed logins
if (userSuspender != null
- && user.getFailedLogins() != null && policy.getPermittedLoginRetries() > 0
- && user.getFailedLogins() > policy.getPermittedLoginRetries() && !user.isSuspended()) {
+ && user.getFailedLogins() != null && policy.getMaxAuthenticationAttempts() > 0
+ && user.getFailedLogins() > policy.getMaxAuthenticationAttempts() && !user.isSuspended()) {
userSuspender.suspend(user, policy.isPropagateSuspension());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEvaluator.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEvaluator.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEvaluator.java
index a3bd84e..b9cfb64 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEvaluator.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEvaluator.java
@@ -48,9 +48,8 @@ public class PolicyEvaluator {
T result = null;
switch (policy.getType()) {
case PASSWORD:
- case GLOBAL_PASSWORD:
- final PasswordPolicySpec ppSpec = policy.getSpecification(PasswordPolicySpec.class);
- final PasswordPolicySpec evaluatedPPSpec = new PasswordPolicySpec();
+ PasswordPolicySpec ppSpec = policy.getSpecification(PasswordPolicySpec.class);
+ PasswordPolicySpec evaluatedPPSpec = new PasswordPolicySpec();
BeanUtils.copyProperties(ppSpec, evaluatedPPSpec, new String[] { "schemasNotPermitted" });
@@ -79,7 +78,6 @@ public class PolicyEvaluator {
break;
case ACCOUNT:
- case GLOBAL_ACCOUNT:
final AccountPolicySpec spec = policy.getSpecification(AccountPolicySpec.class);
final AccountPolicySpec accountPolicy = new AccountPolicySpec();
@@ -99,7 +97,6 @@ public class PolicyEvaluator {
break;
case SYNC:
- case GLOBAL_SYNC:
default:
result = null;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
index 949dee7..1062a93 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
@@ -31,7 +31,6 @@ import org.apache.syncope.common.lib.search.SpecialAttr;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
-import org.apache.syncope.core.persistence.api.dao.search.EntitlementCond;
import org.apache.syncope.core.persistence.api.dao.search.MembershipCond;
import org.apache.syncope.core.persistence.api.dao.search.ResourceCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
@@ -108,12 +107,6 @@ public class SearchCondVisitor extends AbstractSearchConditionVisitor<SearchBean
leaf = SearchCond.getLeafCond(resourceCond);
break;
- case ENTITLEMENTS:
- EntitlementCond entitlementCond = new EntitlementCond();
- entitlementCond.setExpression(value);
- leaf = SearchCond.getLeafCond(entitlementCond);
- break;
-
default:
throw new IllegalArgumentException(
String.format("Special attr name %s is not supported", specialAttrName));
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java
deleted file mode 100644
index d88c353..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.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.misc.security;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.syncope.common.lib.SyncopeConstants;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.context.SecurityContext;
-import org.springframework.security.core.context.SecurityContextHolder;
-
-public final class AuthContextUtil {
-
- public static String getAuthenticatedUsername() {
- Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
- return authentication == null ? SyncopeConstants.UNAUTHENTICATED : authentication.getName();
- }
-
- public static Set<String> getOwnedEntitlementNames() {
- final Set<String> result = new HashSet<>();
-
- final SecurityContext ctx = SecurityContextHolder.getContext();
-
- if (ctx != null && ctx.getAuthentication() != null && ctx.getAuthentication().getAuthorities() != null) {
- for (GrantedAuthority authority : ctx.getAuthentication().getAuthorities()) {
- result.add(authority.getAuthority());
- }
- }
-
- return result;
- }
-
- /**
- * Extend the current authentication context to include the given group.
- *
- * @param groupKey group key
- * @param groupEntitlement group entitlement
- */
- public static void extendAuthContext(final Long groupKey, final String groupEntitlement) {
- Authentication auth = SecurityContextHolder.getContext().getAuthentication();
- List<GrantedAuthority> authorities = new ArrayList<>(auth.getAuthorities());
- authorities.add(new SimpleGrantedAuthority(groupEntitlement));
- Authentication newAuth = new UsernamePasswordAuthenticationToken(
- auth.getPrincipal(), auth.getCredentials(), authorities);
- SecurityContextHolder.getContext().setAuthentication(newAuth);
- }
-
- /**
- * Private default constructor, for static-only classes.
- */
- private AuthContextUtil() {
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtils.java
new file mode 100644
index 0000000..2bdf45a
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtils.java
@@ -0,0 +1,73 @@
+/*
+ * 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.misc.security;
+
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.types.Entitlement;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.User;
+
+public final class AuthContextUtils {
+
+ public static String getAuthenticatedUsername() {
+ Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+ return authentication == null ? SyncopeConstants.UNAUTHENTICATED : authentication.getName();
+ }
+
+ public static void updateAuthenticatedUsername(final String newUsername) {
+ Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+
+ Authentication newAuth = new UsernamePasswordAuthenticationToken(
+ new User(newUsername, "FAKE_PASSWORD", auth.getAuthorities()),
+ auth.getCredentials(), auth.getAuthorities());
+ SecurityContextHolder.getContext().setAuthentication(newAuth);
+ }
+
+ public static Map<Entitlement, Set<String>> getAuthorizations() {
+ Map<Entitlement, Set<String>> result = null;
+
+ final SecurityContext ctx = SecurityContextHolder.getContext();
+ if (ctx != null && ctx.getAuthentication() != null && ctx.getAuthentication().getAuthorities() != null) {
+ result = new EnumMap<>(Entitlement.class);
+ for (GrantedAuthority authority : ctx.getAuthentication().getAuthorities()) {
+ if (authority instanceof SyncopeGrantedAuthority) {
+ result.put(
+ SyncopeGrantedAuthority.class.cast(authority).getEntitlement(),
+ SyncopeGrantedAuthority.class.cast(authority).getRealms());
+ }
+ }
+ }
+
+ return MapUtils.emptyIfNull(result);
+ }
+
+ /**
+ * Private default constructor, for static-only classes.
+ */
+ private AuthContextUtils() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/security/PasswordGenerator.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/PasswordGenerator.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/PasswordGenerator.java
index 8ed136b..8ad1967 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/PasswordGenerator.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/PasswordGenerator.java
@@ -26,10 +26,11 @@ import org.apache.syncope.common.lib.types.PasswordPolicySpec;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
-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.misc.policy.InvalidPasswordPolicySpecException;
import org.apache.syncope.core.misc.policy.PolicyPattern;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -46,6 +47,9 @@ public class PasswordGenerator {
@Autowired
private PolicyDAO policyDAO;
+ @Autowired
+ private RealmDAO realmDAO;
+
public String generate(final List<PasswordPolicySpec> ppSpecs)
throws InvalidPasswordPolicySpecException {
@@ -59,18 +63,13 @@ public class PasswordGenerator {
public String generate(final User user)
throws InvalidPasswordPolicySpecException {
- List<PasswordPolicySpec> ppSpecs = new ArrayList<PasswordPolicySpec>();
+ List<PasswordPolicySpec> ppSpecs = new ArrayList<>();
- PasswordPolicy globalPP = policyDAO.getGlobalPasswordPolicy();
- if (globalPP != null && globalPP.getSpecification(PasswordPolicySpec.class) != null) {
- ppSpecs.add(globalPP.getSpecification(PasswordPolicySpec.class));
- }
+ for (Realm ancestor : realmDAO.findAncestors(user.getRealm())) {
+ if (ancestor.getPasswordPolicy() != null
+ && ancestor.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
- for (Group group : user.getGroups()) {
- if (group.getPasswordPolicy() != null
- && group.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
-
- ppSpecs.add(group.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
+ ppSpecs.add(ancestor.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
}
}
@@ -220,7 +219,8 @@ public class PasswordGenerator {
//filled empty chars
for (int firstEmptyChar = firstEmptyChar(generatedPassword);
firstEmptyChar < generatedPassword.length - 1; firstEmptyChar++) {
- generatedPassword[firstEmptyChar] = SecureRandomUtil.generateRandomLetter();
+
+ generatedPassword[firstEmptyChar] = SecureRandomUtils.generateRandomLetter();
}
checkPrefixAndSuffix(generatedPassword, policySpec);
@@ -230,42 +230,38 @@ public class PasswordGenerator {
private void checkStartChar(final String[] generatedPassword, final PasswordPolicySpec policySpec) {
if (policySpec.isMustStartWithAlpha()) {
- generatedPassword[0] = SecureRandomUtil.generateRandomLetter();
+ generatedPassword[0] = SecureRandomUtils.generateRandomLetter();
}
if (policySpec.isMustStartWithNonAlpha() || policySpec.isMustStartWithDigit()) {
- generatedPassword[0] = SecureRandomUtil.generateRandomNumber();
+ generatedPassword[0] = SecureRandomUtils.generateRandomNumber();
}
if (policySpec.isMustntStartWithAlpha()) {
- generatedPassword[0] = SecureRandomUtil.generateRandomNumber();
-
+ generatedPassword[0] = SecureRandomUtils.generateRandomNumber();
}
if (policySpec.isMustntStartWithDigit()) {
- generatedPassword[0] = SecureRandomUtil.generateRandomLetter();
-
+ generatedPassword[0] = SecureRandomUtils.generateRandomLetter();
}
if (policySpec.isMustntStartWithNonAlpha()) {
- generatedPassword[0] = SecureRandomUtil.generateRandomLetter();
-
+ generatedPassword[0] = SecureRandomUtils.generateRandomLetter();
}
}
private void checkEndChar(final String[] generatedPassword, final PasswordPolicySpec policySpec) {
if (policySpec.isMustEndWithAlpha()) {
- generatedPassword[policySpec.getMinLength() - 1] = SecureRandomUtil.generateRandomLetter();
+ generatedPassword[policySpec.getMinLength() - 1] = SecureRandomUtils.generateRandomLetter();
}
if (policySpec.isMustEndWithNonAlpha() || policySpec.isMustEndWithDigit()) {
- generatedPassword[policySpec.getMinLength() - 1] = SecureRandomUtil.generateRandomNumber();
+ generatedPassword[policySpec.getMinLength() - 1] = SecureRandomUtils.generateRandomNumber();
}
if (policySpec.isMustntEndWithAlpha()) {
- generatedPassword[policySpec.getMinLength() - 1] = SecureRandomUtil.generateRandomNumber();
+ generatedPassword[policySpec.getMinLength() - 1] = SecureRandomUtils.generateRandomNumber();
}
if (policySpec.isMustntEndWithDigit()) {
- generatedPassword[policySpec.getMinLength() - 1] = SecureRandomUtil.generateRandomLetter();
+ generatedPassword[policySpec.getMinLength() - 1] = SecureRandomUtils.generateRandomLetter();
}
if (policySpec.isMustntEndWithNonAlpha()) {
- generatedPassword[policySpec.getMinLength() - 1] = SecureRandomUtil.generateRandomLetter();
-
+ generatedPassword[policySpec.getMinLength() - 1] = SecureRandomUtils.generateRandomLetter();
}
}
@@ -281,28 +277,28 @@ public class PasswordGenerator {
if (policySpec.isDigitRequired()
&& !PolicyPattern.DIGIT.matcher(StringUtils.join(generatedPassword)).matches()) {
- generatedPassword[firstEmptyChar(generatedPassword)] = SecureRandomUtil.generateRandomNumber();
+ generatedPassword[firstEmptyChar(generatedPassword)] = SecureRandomUtils.generateRandomNumber();
}
if (policySpec.isUppercaseRequired()
&& !PolicyPattern.ALPHA_UPPERCASE.matcher(StringUtils.join(generatedPassword)).matches()) {
generatedPassword[firstEmptyChar(generatedPassword)] =
- SecureRandomUtil.generateRandomLetter().toUpperCase();
+ SecureRandomUtils.generateRandomLetter().toUpperCase();
}
if (policySpec.isLowercaseRequired()
&& !PolicyPattern.ALPHA_LOWERCASE.matcher(StringUtils.join(generatedPassword)).matches()) {
generatedPassword[firstEmptyChar(generatedPassword)] =
- SecureRandomUtil.generateRandomLetter().toLowerCase();
+ SecureRandomUtils.generateRandomLetter().toLowerCase();
}
if (policySpec.isNonAlphanumericRequired()
&& !PolicyPattern.NON_ALPHANUMERIC.matcher(StringUtils.join(generatedPassword)).matches()) {
generatedPassword[firstEmptyChar(generatedPassword)] =
- SecureRandomUtil.generateRandomSpecialCharacter(SPECIAL_CHARS);
+ SecureRandomUtils.generateRandomSpecialCharacter(SPECIAL_CHARS);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtil.java
deleted file mode 100644
index 7939a83..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtil.java
+++ /dev/null
@@ -1,48 +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.misc.security;
-
-import java.security.SecureRandom;
-
-import org.apache.commons.lang3.RandomStringUtils;
-
-public final class SecureRandomUtil {
-
- private static final SecureRandom RANDOM = new SecureRandom();
-
- public static String generateRandomPassword(final int tokenLength) {
- return RandomStringUtils.random(tokenLength, 0, 0, true, false, null, RANDOM);
- }
-
- public static String generateRandomLetter() {
- return RandomStringUtils.random(1, 0, 0, true, false, null, RANDOM);
- }
-
- public static String generateRandomNumber() {
- return RandomStringUtils.random(1, 0, 0, false, true, null, RANDOM);
- }
-
- public static String generateRandomSpecialCharacter(final char[] characters) {
- return RandomStringUtils.random(1, 0, 0, false, false, characters, RANDOM);
- }
-
- private SecureRandomUtil() {
- // private constructor for static utility class
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtils.java
new file mode 100644
index 0000000..f41207b
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SecureRandomUtils.java
@@ -0,0 +1,48 @@
+/*
+ * 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.misc.security;
+
+import java.security.SecureRandom;
+
+import org.apache.commons.lang3.RandomStringUtils;
+
+public final class SecureRandomUtils {
+
+ private static final SecureRandom RANDOM = new SecureRandom();
+
+ public static String generateRandomPassword(final int tokenLength) {
+ return RandomStringUtils.random(tokenLength, 0, 0, true, false, null, RANDOM);
+ }
+
+ public static String generateRandomLetter() {
+ return RandomStringUtils.random(1, 0, 0, true, false, null, RANDOM);
+ }
+
+ public static String generateRandomNumber() {
+ return RandomStringUtils.random(1, 0, 0, false, true, null, RANDOM);
+ }
+
+ public static String generateRandomSpecialCharacter(final char[] characters) {
+ return RandomStringUtils.random(1, 0, 0, false, false, characters, RANDOM);
+ }
+
+ private SecureRandomUtils() {
+ // private constructor for static utility class
+ }
+}
[53/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java b/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java
index 082f47f..248212c 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/AttributableOperations.java
@@ -25,6 +25,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.mod.AbstractAttributableMod;
@@ -224,6 +225,13 @@ public final class AttributableOperations {
diff(updated, original, result, incremental);
+ // 0. realm
+ if (updated.getRealm() != null && (original.getRealm() == null
+ || !original.getRealm().equals(updated.getRealm()))) {
+
+ result.setRealm(updated.getRealm());
+ }
+
// 1. password
if (updated.getPassword() != null && (original.getPassword() == null
|| !original.getPassword().equals(updated.getPassword()))) {
@@ -247,13 +255,17 @@ public final class AttributableOperations {
result.setSecurityAnswer(updated.getSecurityAnswer());
}
- // 4. memberships
+ // 4. roles
+ result.getRolesToRemove().addAll(CollectionUtils.subtract(original.getRoles(), updated.getRoles()));
+ result.getRolesToAdd().addAll(CollectionUtils.subtract(updated.getRoles(), original.getRoles()));
+
+ // 5. memberships
Map<Long, MembershipTO> updatedMembs = updated.getMembershipMap();
Map<Long, MembershipTO> originalMembs = original.getMembershipMap();
for (Map.Entry<Long, MembershipTO> entry : updatedMembs.entrySet()) {
MembershipMod membMod = new MembershipMod();
- membMod.setGroup(entry.getValue().getGroupId());
+ membMod.setGroup(entry.getValue().getGroupKey());
if (originalMembs.containsKey(entry.getKey())) {
// if memberships are actually same, just make the isEmpty() call below succeed
@@ -328,62 +340,38 @@ public final class AttributableOperations {
diff(updated, original, result, incremental);
- // 1. inheritance
- result.setInheritOwner(updated.isInheritOwner());
- result.setInheritTemplates(updated.isInheritTemplates());
- result.setInheritAccountPolicy(updated.isInheritAccountPolicy());
- result.setInheritPasswordPolicy(updated.isInheritPasswordPolicy());
- result.setInheritPlainAttrs(updated.isInheritPlainAttrs());
- result.setInheritDerAttrs(updated.isInheritDerAttrs());
- result.setInheritVirAttrs(updated.isInheritVirAttrs());
-
- // 2. policies
- result.setAccountPolicy(new ReferenceMod(updated.getAccountPolicy()));
- result.setPasswordPolicy(new ReferenceMod(updated.getPasswordPolicy()));
-
- // 3. name
+ // 1. name
if (!original.getName().equals(updated.getName())) {
result.setName(updated.getName());
}
- // 4. entitlements
- Set<String> updatedEnts = new HashSet<>(updated.getEntitlements());
- Set<String> originalEnts = new HashSet<>(original.getEntitlements());
- if (updatedEnts.equals(originalEnts)) {
- result.setModEntitlements(false);
- result.getEntitlements().clear();
- } else {
- result.setModEntitlements(true);
- result.getEntitlements().addAll(updated.getEntitlements());
- }
-
- // 5. templates
+ // 2. templates
Set<String> updatedTemplates = new HashSet<>(updated.getGPlainAttrTemplates());
Set<String> originalTemplates = new HashSet<>(original.getGPlainAttrTemplates());
if (updatedTemplates.equals(originalTemplates)) {
- result.setModRAttrTemplates(false);
- result.getRPlainAttrTemplates().clear();
+ result.setModGAttrTemplates(false);
+ result.getGPlainAttrTemplates().clear();
} else {
- result.setModRAttrTemplates(true);
- result.getRPlainAttrTemplates().addAll(updated.getGPlainAttrTemplates());
+ result.setModGAttrTemplates(true);
+ result.getGPlainAttrTemplates().addAll(updated.getGPlainAttrTemplates());
}
updatedTemplates = new HashSet<>(updated.getGDerAttrTemplates());
originalTemplates = new HashSet<>(original.getGDerAttrTemplates());
if (updatedTemplates.equals(originalTemplates)) {
- result.setModRDerAttrTemplates(false);
- result.getRDerAttrTemplates().clear();
+ result.setModGDerAttrTemplates(false);
+ result.getGDerAttrTemplates().clear();
} else {
- result.setModRDerAttrTemplates(true);
- result.getRDerAttrTemplates().addAll(updated.getGDerAttrTemplates());
+ result.setModGDerAttrTemplates(true);
+ result.getGDerAttrTemplates().addAll(updated.getGDerAttrTemplates());
}
updatedTemplates = new HashSet<>(updated.getGVirAttrTemplates());
originalTemplates = new HashSet<>(original.getGVirAttrTemplates());
if (updatedTemplates.equals(originalTemplates)) {
- result.setModRVirAttrTemplates(false);
- result.getRVirAttrTemplates().clear();
+ result.setModGVirAttrTemplates(false);
+ result.getGVirAttrTemplates().clear();
} else {
- result.setModRVirAttrTemplates(true);
- result.getRVirAttrTemplates().addAll(updated.getGVirAttrTemplates());
+ result.setModGVirAttrTemplates(true);
+ result.getGVirAttrTemplates().addAll(updated.getGVirAttrTemplates());
}
updatedTemplates = new HashSet<>(updated.getMPlainAttrTemplates());
originalTemplates = new HashSet<>(original.getMPlainAttrTemplates());
@@ -413,7 +401,7 @@ public final class AttributableOperations {
result.getMVirAttrTemplates().addAll(updated.getMVirAttrTemplates());
}
- // 6. owner
+ // 3. owner
result.setUserOwner(new ReferenceMod(updated.getUserOwner()));
result.setGroupOwner(new ReferenceMod(updated.getGroupOwner()));
@@ -484,6 +472,11 @@ public final class AttributableOperations {
UserTO result = SerializationUtils.clone(userTO);
apply(userTO, userMod, result);
+ // 0. realm
+ if (userMod.getRealm() != null) {
+ result.setRealm(userMod.getRealm());
+ }
+
// 1. password
result.setPassword(userMod.getPassword());
@@ -491,14 +484,19 @@ public final class AttributableOperations {
if (userMod.getUsername() != null) {
result.setUsername(userMod.getUsername());
}
- // 3. memberships
+
+ // 3. roles
+ result.getRoles().removeAll(userMod.getRolesToRemove());
+ result.getRoles().addAll(userMod.getRolesToAdd());
+
+ // 4. memberships
Map<Long, MembershipTO> membs = result.getMembershipMap();
- for (Long membId : userMod.getMembershipsToRemove()) {
- result.getMemberships().remove(membs.get(membId));
+ for (Long membKey : userMod.getMembershipsToRemove()) {
+ result.getMemberships().remove(membs.get(membKey));
}
for (MembershipMod membMod : userMod.getMembershipsToAdd()) {
MembershipTO membTO = new MembershipTO();
- membTO.setGroupId(membMod.getGroup());
+ membTO.setGroupKey(membMod.getGroup());
apply(membTO, membMod, membTO);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/CollectionUtils2.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/CollectionUtils2.java b/common/lib/src/main/java/org/apache/syncope/common/lib/CollectionUtils2.java
index a014fbf..69739b6 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/CollectionUtils2.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/CollectionUtils2.java
@@ -19,8 +19,11 @@
package org.apache.syncope.common.lib;
import java.util.Collection;
+import java.util.HashSet;
import java.util.Iterator;
+import java.util.Set;
import org.apache.commons.collections4.Predicate;
+import org.apache.commons.collections4.SetUtils;
import org.apache.commons.collections4.Transformer;
public final class CollectionUtils2 {
@@ -122,6 +125,28 @@ public final class CollectionUtils2 {
return outputCollection;
}
+ /**
+ * Gets elements in the input collection that match the predicate.
+ * <p/>
+ * A <code>null</code> collection or predicate matches no elements.
+ *
+ * @param <C> the type of object the {@link Iterable} contains
+ * @param input the {@link Iterable} to get the input from, may be null
+ * @param predicate the predicate to use, may be null
+ * @return the matches for the predicate in the collection
+ */
+ public static <C> Collection<C> find(final Iterable<C> input, final Predicate<? super C> predicate) {
+ Set<C> result = SetUtils.predicatedSet(new HashSet<C>(), predicate);
+ if (input != null && predicate != null) {
+ for (final C o : input) {
+ if (predicate.evaluate(o)) {
+ result.add(o);
+ }
+ }
+ }
+ return SetUtils.unmodifiableSet(result);
+ }
+
private CollectionUtils2() {
// private constructor for static utility class
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeConstants.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeConstants.java b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeConstants.java
index b1ab0d4..6538ec0 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeConstants.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeConstants.java
@@ -19,15 +19,19 @@
package org.apache.syncope.common.lib;
import java.nio.charset.Charset;
+import java.util.Collections;
+import java.util.Set;
import java.util.regex.Pattern;
public final class SyncopeConstants {
public static final String NAMESPACE = "http://syncope.apache.org/2.0";
- public static final String UNAUTHENTICATED = "unauthenticated";
+ public static final String ROOT_REALM = "/";
+
+ public static final Set<String> FULL_ADMIN_REALMS = Collections.singleton("/");
- public static final String ANONYMOUS_ENTITLEMENT = "anonymous";
+ public static final String UNAUTHENTICATED = "unauthenticated";
public static final String ENUM_VALUES_SEPARATOR = ";";
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AbstractSubjectMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AbstractSubjectMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AbstractSubjectMod.java
index 96e2a64..3671785 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AbstractSubjectMod.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AbstractSubjectMod.java
@@ -30,10 +30,20 @@ public abstract class AbstractSubjectMod extends AbstractAttributableMod {
private static final long serialVersionUID = -6404459635536484024L;
+ private String realm;
+
protected final Set<String> resourcesToAdd = new HashSet<>();
protected final Set<String> resourcesToRemove = new HashSet<>();
+ public String getRealm() {
+ return realm;
+ }
+
+ public void setRealm(final String realm) {
+ this.realm = realm;
+ }
+
@XmlElementWrapper(name = "resourcesToAdd")
@XmlElement(name = "resource")
@JsonProperty("resourcesToAdd")
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java
index 3dbae2e..c2b3b8a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java
@@ -53,21 +53,17 @@ public class GroupMod extends AbstractSubjectMod {
private Boolean inheritPasswordPolicy;
- private boolean modEntitlements;
+ private boolean modGAttrTemplates;
- private final List<String> entitlements = new ArrayList<>();
+ private final List<String> gPlainAttrTemplates = new ArrayList<>();
- private boolean modRAttrTemplates;
+ private boolean modGDerAttrTemplates;
- private final List<String> rPlainAttrTemplates = new ArrayList<>();
+ private final List<String> gDerAttrTemplates = new ArrayList<>();
- private boolean modRDerAttrTemplates;
+ private boolean modGVirAttrTemplates;
- private final List<String> rDerAttrTemplates = new ArrayList<>();
-
- private boolean modRVirAttrTemplates;
-
- private final List<String> rVirAttrTemplates = new ArrayList<>();
+ private final List<String> gVirAttrTemplates = new ArrayList<>();
private boolean modMAttrTemplates;
@@ -149,64 +145,49 @@ public class GroupMod extends AbstractSubjectMod {
this.inheritVirAttrs = inheritVirAttrs;
}
- public boolean isModEntitlements() {
- return modEntitlements;
- }
-
- public void setModEntitlements(final boolean modEntitlements) {
- this.modEntitlements = modEntitlements;
- }
-
- @XmlElementWrapper(name = "entitlements")
- @XmlElement(name = "entitlement")
- @JsonProperty("entitlements")
- public List<String> getEntitlements() {
- return entitlements;
- }
-
- public boolean isModRAttrTemplates() {
- return modRAttrTemplates;
+ public boolean isModGAttrTemplates() {
+ return modGAttrTemplates;
}
- public void setModRAttrTemplates(final boolean modRAttrTemplates) {
- this.modRAttrTemplates = modRAttrTemplates;
+ public void setModGAttrTemplates(final boolean modGAttrTemplates) {
+ this.modGAttrTemplates = modGAttrTemplates;
}
- @XmlElementWrapper(name = "rPlainAttrTemplates")
- @XmlElement(name = "rAttrTemplate")
- @JsonProperty("rPlainAttrTemplates")
- public List<String> getRPlainAttrTemplates() {
- return rPlainAttrTemplates;
+ @XmlElementWrapper(name = "gPlainAttrTemplates")
+ @XmlElement(name = "gAttrTemplate")
+ @JsonProperty("gPlainAttrTemplates")
+ public List<String> getGPlainAttrTemplates() {
+ return gPlainAttrTemplates;
}
- public boolean isModRDerAttrTemplates() {
- return modRDerAttrTemplates;
+ public boolean isModGDerAttrTemplates() {
+ return modGDerAttrTemplates;
}
- public void setModRDerAttrTemplates(final boolean modRDerAttrTemplates) {
- this.modRDerAttrTemplates = modRDerAttrTemplates;
+ public void setModGDerAttrTemplates(final boolean modGDerAttrTemplates) {
+ this.modGDerAttrTemplates = modGDerAttrTemplates;
}
- @XmlElementWrapper(name = "rDerAttrTemplates")
- @XmlElement(name = "rDerAttrTemplate")
- @JsonProperty("rDerAttrTemplates")
- public List<String> getRDerAttrTemplates() {
- return rDerAttrTemplates;
+ @XmlElementWrapper(name = "gDerAttrTemplates")
+ @XmlElement(name = "gDerAttrTemplate")
+ @JsonProperty("gDerAttrTemplates")
+ public List<String> getGDerAttrTemplates() {
+ return gDerAttrTemplates;
}
- public boolean isModRVirAttrTemplates() {
- return modRVirAttrTemplates;
+ public boolean isModGVirAttrTemplates() {
+ return modGVirAttrTemplates;
}
- public void setModRVirAttrTemplates(final boolean modRVirAttrTemplates) {
- this.modRVirAttrTemplates = modRVirAttrTemplates;
+ public void setModGVirAttrTemplates(final boolean modGVirAttrTemplates) {
+ this.modGVirAttrTemplates = modGVirAttrTemplates;
}
- @XmlElementWrapper(name = "rVirAttrTemplates")
- @XmlElement(name = "rVirAttrTemplate")
- @JsonProperty("rVirAttrTemplates")
- public List<String> getRVirAttrTemplates() {
- return rVirAttrTemplates;
+ @XmlElementWrapper(name = "gVirAttrTemplates")
+ @XmlElement(name = "gVirAttrTemplate")
+ @JsonProperty("gVirAttrTemplates")
+ public List<String> getGVirAttrTemplates() {
+ return gVirAttrTemplates;
}
public boolean isModMAttrTemplates() {
@@ -293,8 +274,8 @@ public class GroupMod extends AbstractSubjectMod {
&& inheritTemplates == null && inheritOwner == null
&& inheritAccountPolicy == null && inheritPasswordPolicy == null
&& inheritPlainAttrs == null && inheritDerAttrs == null && inheritVirAttrs == null
- && accountPolicy == null && passwordPolicy == null && entitlements.isEmpty()
- && rPlainAttrTemplates.isEmpty() && rDerAttrTemplates.isEmpty() && rVirAttrTemplates.isEmpty()
+ && accountPolicy == null && passwordPolicy == null
+ && gPlainAttrTemplates.isEmpty() && gDerAttrTemplates.isEmpty() && gVirAttrTemplates.isEmpty()
&& mPlainAttrTemplates.isEmpty() && mDerAttrTemplates.isEmpty() && mVirAttrTemplates.isEmpty();
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/mod/UserMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/UserMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/UserMod.java
index 0f421be..fe63b63 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/UserMod.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/UserMod.java
@@ -33,13 +33,17 @@ public class UserMod extends AbstractSubjectMod {
private static final long serialVersionUID = 3081848906558106204L;
+ private String username;
+
private String password;
- private String username;
+ private final Set<Long> rolesToAdd = new HashSet<>();
- private final Set<MembershipMod> membershipsToAdd;
+ private final Set<Long> rolesToRemove = new HashSet<>();
- private final Set<Long> membershipsToRemove;
+ private final Set<MembershipMod> membershipsToAdd = new HashSet<>();
+
+ private final Set<Long> membershipsToRemove = new HashSet<>();
private StatusMod pwdPropRequest;
@@ -47,13 +51,6 @@ public class UserMod extends AbstractSubjectMod {
private String securityAnswer;
- public UserMod() {
- super();
-
- membershipsToAdd = new HashSet<>();
- membershipsToRemove = new HashSet<>();
- }
-
public String getUsername() {
return username;
}
@@ -70,6 +67,20 @@ public class UserMod extends AbstractSubjectMod {
this.password = password;
}
+ @XmlElementWrapper(name = "rolesToAdd")
+ @XmlElement(name = "role")
+ @JsonProperty("rolesToAdd")
+ public Set<Long> getRolesToAdd() {
+ return rolesToAdd;
+ }
+
+ @XmlElementWrapper(name = "rolesToRemove")
+ @XmlElement(name = "role")
+ @JsonProperty("rolesToRemove")
+ public Set<Long> getRolesToRemove() {
+ return rolesToRemove;
+ }
+
@XmlElementWrapper(name = "membershipsToAdd")
@XmlElement(name = "membership")
@JsonProperty("membershipsToAdd")
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractSubjectReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractSubjectReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractSubjectReportletConf.java
index 28b4cba..8b3da49 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractSubjectReportletConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/AbstractSubjectReportletConf.java
@@ -60,23 +60,23 @@ public abstract class AbstractSubjectReportletConf extends AbstractReportletConf
this.matchingCond = matchingCond;
}
- @XmlElementWrapper(name = "plainAttributes")
- @XmlElement(name = "plainAttribute")
- @JsonProperty("plainAttributes")
+ @XmlElementWrapper(name = "plainAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("plainAttrs")
public List<String> getPlainAttrs() {
return plainAttrs;
}
- @XmlElementWrapper(name = "derivedAttributes")
+ @XmlElementWrapper(name = "derAttrs")
@XmlElement(name = "attribute")
- @JsonProperty("derivedAttributes")
+ @JsonProperty("derAttrs")
public List<String> getDerAttrs() {
return derAttrs;
}
- @XmlElementWrapper(name = "virtualAttributes")
+ @XmlElementWrapper(name = "virAttrs")
@XmlElement(name = "attribute")
- @JsonProperty("virtualAttributes")
+ @JsonProperty("virAttrs")
public List<String> getVirAttrs() {
return virAttrs;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
index dee3ff4..de7bff3 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
@@ -41,7 +41,6 @@ public class GroupReportletConf extends AbstractSubjectReportletConf {
name,
groupOwner,
userOwner,
- entitlements,
users,
resources
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
index 4822d2a..c8e9152 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
@@ -20,7 +20,6 @@ package org.apache.syncope.common.lib.search;
import java.util.Map;
import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
-import org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser;
/**
* Extends <tt>SyncopeFiqlSearchConditionBuilder</tt> by providing some additional facilities for searching
@@ -46,16 +45,6 @@ public class GroupFiqlSearchConditionBuilder extends AbstractFiqlSearchCondition
return newBuilderInstance().is(property);
}
- public CompleteCondition hasEntitlements(final String entitlement, final String... moreEntitlements) {
- return newBuilderInstance().is(SpecialAttr.ENTITLEMENTS.toString()).
- hasEntitlements(entitlement, moreEntitlements);
- }
-
- public CompleteCondition hasNotEntitlements(final String entitlement, final String... moreEntitlements) {
- return newBuilderInstance().is(SpecialAttr.ENTITLEMENTS.toString()).
- hasNotEntitlements(entitlement, moreEntitlements);
- }
-
protected static class Builder extends AbstractFiqlSearchConditionBuilder.Builder
implements GroupProperty, CompleteCondition {
@@ -74,17 +63,5 @@ public class GroupFiqlSearchConditionBuilder extends AbstractFiqlSearchCondition
return b;
}
- @Override
- public CompleteCondition hasEntitlements(final String entitlement, final String... moreEntitlements) {
- this.result = SpecialAttr.ENTITLEMENTS.toString();
- return condition(FiqlParser.EQ, entitlement, (Object[]) moreEntitlements);
- }
-
- @Override
- public CompleteCondition hasNotEntitlements(final String entitlement, final String... moreEntitlements) {
- this.result = SpecialAttr.ENTITLEMENTS.toString();
- return condition(FiqlParser.NEQ, entitlement, (Object[]) moreEntitlements);
- }
-
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
index 7868016..0eb7480 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
@@ -18,12 +18,6 @@
*/
package org.apache.syncope.common.lib.search;
-import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
-
public interface GroupProperty extends SyncopeProperty {
- CompleteCondition hasEntitlements(String entitlement, String... moreEntitlements);
-
- CompleteCondition hasNotEntitlements(String entitlement, String... moreEntitlements);
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
index 22e339e..37b53ec 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SpecialAttr.java
@@ -18,12 +18,15 @@
*/
package org.apache.syncope.common.lib.search;
+import java.util.Arrays;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+
public enum SpecialAttr {
NULL("$null"),
RESOURCES("$resources"),
- GROUPS("$groups"),
- ENTITLEMENTS("$entitlements");
+ GROUPS("$groups");
private final String literal;
@@ -31,20 +34,19 @@ public enum SpecialAttr {
this.literal = literal;
}
- public static SpecialAttr fromString(final String value) {
- SpecialAttr result = null;
- for (SpecialAttr specialAttr : values()) {
- if (specialAttr.literal.equals(value)) {
- result = specialAttr;
- }
- }
-
- return result;
- }
-
@Override
public String toString() {
return literal;
}
+ public static SpecialAttr fromString(final String value) {
+ return CollectionUtils.find(Arrays.asList(values()), new Predicate<SpecialAttr>() {
+
+ @Override
+ public boolean evaluate(final SpecialAttr specialAttr) {
+ return specialAttr.literal.equals(value);
+ }
+ });
+ }
+
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAttributableTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAttributableTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAttributableTO.java
index 0794b09..c724bb0 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAttributableTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAttributableTO.java
@@ -20,11 +20,11 @@ package org.apache.syncope.common.lib.to;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
+import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
@@ -36,16 +36,23 @@ public abstract class AbstractAttributableTO extends ConnObjectTO {
private long key;
- private final List<AttrTO> derAttrs = new ArrayList<>();
+ private final Set<AttrTO> derAttrs = new LinkedHashSet<>();
- private final List<AttrTO> virAttrs = new ArrayList<>();
+ private final Set<AttrTO> virAttrs = new LinkedHashSet<>();
public long getKey() {
return key;
}
- public void setKey(final long id) {
- this.key = id;
+ public void setKey(final long key) {
+ this.key = key;
+ }
+
+ @XmlElementWrapper(name = "derAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("derAttrs")
+ public Set<AttrTO> getDerAttrs() {
+ return derAttrs;
}
@JsonIgnore
@@ -54,9 +61,15 @@ public abstract class AbstractAttributableTO extends ConnObjectTO {
for (AttrTO attributeTO : derAttrs) {
result.put(attributeTO.getSchema(), attributeTO);
}
- result = Collections.unmodifiableMap(result);
- return result;
+ return Collections.unmodifiableMap(result);
+ }
+
+ @XmlElementWrapper(name = "virAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("virAttrs")
+ public Set<AttrTO> getVirAttrs() {
+ return virAttrs;
}
@JsonIgnore
@@ -65,22 +78,8 @@ public abstract class AbstractAttributableTO extends ConnObjectTO {
for (AttrTO attributeTO : virAttrs) {
result.put(attributeTO.getSchema(), attributeTO);
}
- result = Collections.unmodifiableMap(result);
- return result;
+ return Collections.unmodifiableMap(result);
}
- @XmlElementWrapper(name = "derivedAttributes")
- @XmlElement(name = "attribute")
- @JsonProperty("derivedAttributes")
- public List<AttrTO> getDerAttrs() {
- return derAttrs;
- }
-
- @XmlElementWrapper(name = "virtualAttributes")
- @XmlElement(name = "attribute")
- @JsonProperty("virtualAttributes")
- public List<AttrTO> getVirAttrs() {
- return virAttrs;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
index 3ecb44f..5f3027b 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
@@ -42,11 +42,15 @@ public abstract class AbstractPolicyTO extends AbstractBaseBean {
private String description;
- private PolicyType type;
+ private final PolicyType type;
private final List<String> usedByResources = new ArrayList<>();
- private final List<Long> usedByGroups = new ArrayList<>();
+ private final List<String> usedByRealms = new ArrayList<>();
+
+ protected AbstractPolicyTO(final PolicyType type) {
+ this.type = type;
+ }
public long getKey() {
return key;
@@ -68,10 +72,6 @@ public abstract class AbstractPolicyTO extends AbstractBaseBean {
return type;
}
- public void setType(final PolicyType type) {
- this.type = type;
- }
-
@XmlElementWrapper(name = "usedByResources")
@XmlElement(name = "resource")
@JsonProperty("usedByResources")
@@ -79,11 +79,11 @@ public abstract class AbstractPolicyTO extends AbstractBaseBean {
return usedByResources;
}
- @XmlElementWrapper(name = "usedByGroups")
+ @XmlElementWrapper(name = "usedByRealms")
@XmlElement(name = "group")
- @JsonProperty("usedByGroups")
- public List<Long> getUsedByGroups() {
- return usedByGroups;
+ @JsonProperty("usedByRealms")
+ public List<String> getUsedByRealms() {
+ return usedByRealms;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
index cbc858d..ae21f12 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
@@ -32,10 +32,20 @@ public abstract class AbstractSubjectTO extends AbstractAttributableTO {
private static final long serialVersionUID = 114668706977919206L;
+ private String realm;
+
private final Set<String> resources = new HashSet<>();
private final List<PropagationStatus> propagationStatusTOs = new ArrayList<>();
+ public String getRealm() {
+ return realm;
+ }
+
+ public void setRealm(final String realm) {
+ this.realm = realm;
+ }
+
@XmlElementWrapper(name = "resources")
@XmlElement(name = "resource")
@JsonProperty("resources")
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/AccountPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AccountPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AccountPolicyTO.java
index a58b24f..460bc20 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AccountPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AccountPolicyTO.java
@@ -36,29 +36,24 @@ public class AccountPolicyTO extends AbstractPolicyTO {
private AccountPolicySpec specification;
- private final List<String> resources = new ArrayList<String>();
+ private final List<String> resources = new ArrayList<>();
public AccountPolicyTO() {
this(false);
}
public AccountPolicyTO(final boolean global) {
- super();
+ super(PolicyType.ACCOUNT);
+ }
- PolicyType type = global
- ? PolicyType.GLOBAL_ACCOUNT
- : PolicyType.ACCOUNT;
- setType(type);
+ public AccountPolicySpec getSpecification() {
+ return specification;
}
public void setSpecification(final AccountPolicySpec specification) {
this.specification = specification;
}
- public AccountPolicySpec getSpecification() {
- return specification;
- }
-
@XmlElementWrapper(name = "resources")
@XmlElement(name = "resource")
@JsonProperty("resources")
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
index 1a9c783..9726a25 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
@@ -21,6 +21,7 @@ package org.apache.syncope.common.lib.to;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -29,8 +30,6 @@ import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import org.apache.commons.collections4.MapUtils;
-import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.AbstractBaseBean;
@XmlRootElement(name = "bulkActionResult")
@@ -84,7 +83,7 @@ public class BulkActionResult extends AbstractBaseBean {
res.put(result.getKey(), result.getValue());
}
- return res;
+ return Collections.unmodifiableMap(res);
}
@JsonIgnore
@@ -97,7 +96,7 @@ public class BulkActionResult extends AbstractBaseBean {
}
}
- return res;
+ return Collections.unmodifiableList(res);
}
public static class Result extends AbstractBaseBean {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnObjectTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnObjectTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnObjectTO.java
index 78256ba..82878f8 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnObjectTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnObjectTO.java
@@ -20,11 +20,11 @@ package org.apache.syncope.common.lib.to;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
+import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@@ -36,12 +36,12 @@ public class ConnObjectTO extends AbstractAnnotatedBean {
private static final long serialVersionUID = 5139554911265442497L;
- private final List<AttrTO> attrs = new ArrayList<>();
+ private final Set<AttrTO> attrs = new LinkedHashSet<>();
- @XmlElementWrapper(name = "attributes")
+ @XmlElementWrapper(name = "plainAttrs")
@XmlElement(name = "attribute")
- @JsonProperty("attributes")
- public List<AttrTO> getPlainAttrs() {
+ @JsonProperty("plainAttrs")
+ public Set<AttrTO> getPlainAttrs() {
return attrs;
}
@@ -51,8 +51,7 @@ public class ConnObjectTO extends AbstractAnnotatedBean {
for (AttrTO attributeTO : attrs) {
result.put(attributeTO.getSchema(), attributeTO);
}
- result = Collections.<String, AttrTO>unmodifiableMap(result);
- return result;
+ return Collections.unmodifiableMap(result);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
index 12455c5..029f8a8 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
@@ -37,28 +37,10 @@ public class GroupTO extends AbstractSubjectTO {
private String name;
- private long parent;
-
private Long userOwner;
private Long groupOwner;
- private boolean inheritOwner;
-
- private boolean inheritTemplates;
-
- private boolean inheritPlainAttrs;
-
- private boolean inheritDerAttrs;
-
- private boolean inheritVirAttrs;
-
- private boolean inheritPasswordPolicy;
-
- private boolean inheritAccountPolicy;
-
- private final List<String> entitlements = new ArrayList<>();
-
private final List<String> gPlainAttrTemplates = new ArrayList<>();
private final List<String> gDerAttrTemplates = new ArrayList<>();
@@ -71,10 +53,6 @@ public class GroupTO extends AbstractSubjectTO {
private final List<String> mVirAttrTemplates = new ArrayList<>();
- private Long passwordPolicy;
-
- private Long accountPolicy;
-
public String getName() {
return name;
}
@@ -83,14 +61,6 @@ public class GroupTO extends AbstractSubjectTO {
this.name = name;
}
- public long getParent() {
- return parent;
- }
-
- public void setParent(final long parent) {
- this.parent = parent;
- }
-
public Long getUserOwner() {
return userOwner;
}
@@ -107,53 +77,6 @@ public class GroupTO extends AbstractSubjectTO {
this.groupOwner = groupOwner;
}
- public boolean isInheritOwner() {
- return inheritOwner;
- }
-
- public void setInheritOwner(final boolean inheritOwner) {
- this.inheritOwner = inheritOwner;
- }
-
- public boolean isInheritTemplates() {
- return inheritTemplates;
- }
-
- public void setInheritTemplates(final boolean inheritTemplates) {
- this.inheritTemplates = inheritTemplates;
- }
-
- public boolean isInheritPlainAttrs() {
- return inheritPlainAttrs;
- }
-
- public void setInheritPlainAttrs(final boolean inheritPlainAttrs) {
- this.inheritPlainAttrs = inheritPlainAttrs;
- }
-
- public boolean isInheritDerAttrs() {
- return inheritDerAttrs;
- }
-
- public void setInheritDerAttrs(final boolean inheritDerAttrs) {
- this.inheritDerAttrs = inheritDerAttrs;
- }
-
- public boolean isInheritVirAttrs() {
- return inheritVirAttrs;
- }
-
- public void setInheritVirAttrs(final boolean inheritVirAttrs) {
- this.inheritVirAttrs = inheritVirAttrs;
- }
-
- @XmlElementWrapper(name = "entitlements")
- @XmlElement(name = "entitlement")
- @JsonProperty("entitlements")
- public List<String> getEntitlements() {
- return entitlements;
- }
-
@XmlElementWrapper(name = "gPlainAttrTemplates")
@XmlElement(name = "gPlainAttrTemplate")
@JsonProperty("gPlainAttrTemplates")
@@ -196,63 +119,4 @@ public class GroupTO extends AbstractSubjectTO {
return mVirAttrTemplates;
}
- public Long getPasswordPolicy() {
- return passwordPolicy;
- }
-
- public void setPasswordPolicy(final Long passwordPolicy) {
- this.passwordPolicy = passwordPolicy;
- }
-
- public boolean isInheritPasswordPolicy() {
- return inheritPasswordPolicy;
- }
-
- /**
- * Specify if password policy must be inherited. In this case eventual passwordPolicy occurrence will be ignored.
- *
- * @param inheritPasswordPolicy 'true' to inherit policy, false otherwise.
- */
- public void setInheritPasswordPolicy(final boolean inheritPasswordPolicy) {
- this.inheritPasswordPolicy = inheritPasswordPolicy;
- }
-
- public Long getAccountPolicy() {
- return accountPolicy;
- }
-
- public void setAccountPolicy(final Long accountPolicy) {
- this.accountPolicy = accountPolicy;
- }
-
- public boolean isInheritAccountPolicy() {
- return inheritAccountPolicy;
- }
-
- /**
- * Specify if account policy must be inherited. In this case eventual accountPolicy occurrence will be ignored.
- *
- * @param inheritAccountPolicy 'true' to inherit policy, false otherwise.
- */
- public void setInheritAccountPolicy(final boolean inheritAccountPolicy) {
- this.inheritAccountPolicy = inheritAccountPolicy;
- }
-
- public String getDisplayName() {
- return getKey() + " " + getName();
- }
-
- public static long fromDisplayName(final String displayName) {
- long result = 0;
- if (displayName != null && !displayName.isEmpty() && displayName.indexOf(' ') != -1) {
- try {
- result = Long.valueOf(displayName.split(" ")[0]);
- } catch (NumberFormatException e) {
- // just to avoid PMD warning about "empty catch block"
- result = 0;
- }
- }
-
- return result;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
index 9ee378a..7d81cd8 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
@@ -25,6 +25,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.AbstractBaseBean;
import org.apache.syncope.common.lib.types.IntMappingType;
@@ -47,13 +49,13 @@ public class MappingTO extends AbstractBaseBean {
}
public MappingItemTO getAccountIdItem() {
- MappingItemTO accountIdItem = null;
- for (MappingItemTO item : getItems()) {
- if (item.isAccountid()) {
- accountIdItem = item;
+ return CollectionUtils.find(getItems(), new Predicate<MappingItemTO>() {
+
+ @Override
+ public boolean evaluate(final MappingItemTO item) {
+ return item.isAccountid();
}
- }
- return accountIdItem;
+ });
}
protected boolean addAccountIdItem(final MappingItemTO accountIdItem) {
@@ -81,13 +83,13 @@ public class MappingTO extends AbstractBaseBean {
}
public MappingItemTO getPasswordItem() {
- MappingItemTO passwordItem = null;
- for (MappingItemTO item : getItems()) {
- if (item.isPassword()) {
- passwordItem = item;
+ return CollectionUtils.find(getItems(), new Predicate<MappingItemTO>() {
+
+ @Override
+ public boolean evaluate(final MappingItemTO item) {
+ return item.isPassword();
}
- }
- return passwordItem;
+ });
}
public boolean setPasswordItem(final MappingItemTO passwordItem) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
index b3007c1..2d2c7fa 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
@@ -27,16 +27,16 @@ public class MembershipTO extends AbstractAttributableTO {
private static final long serialVersionUID = 5992828670273935861L;
- private long groupId;
+ private long groupKey;
private String groupName;
- public long getGroupId() {
- return groupId;
+ public long getGroupKey() {
+ return groupKey;
}
- public void setGroupId(final long groupId) {
- this.groupId = groupId;
+ public void setGroupKey(final long groupId) {
+ this.groupKey = groupId;
}
public String getGroupName() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
index 5ea4ed7..621ab26 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
@@ -32,23 +32,15 @@ public class PasswordPolicyTO extends AbstractPolicyTO {
private PasswordPolicySpec specification;
public PasswordPolicyTO() {
- this(false);
+ super(PolicyType.PASSWORD);
}
- public PasswordPolicyTO(final boolean global) {
- super();
-
- PolicyType type = global
- ? PolicyType.GLOBAL_PASSWORD
- : PolicyType.PASSWORD;
- setType(type);
+ public PasswordPolicySpec getSpecification() {
+ return specification;
}
- public void setSpecification(final PasswordPolicySpec specification) {
+ public void setSpecification(PasswordPolicySpec specification) {
this.specification = specification;
}
- public PasswordPolicySpec getSpecification() {
- return specification;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
index f7e46de..d78ea80 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RoleTO.java
@@ -40,8 +40,6 @@ public class RoleTO extends AbstractBaseBean {
private String name;
- private String criteria;
-
private final Set<Entitlement> entitlements = EnumSet.noneOf(Entitlement.class);
private final List<String> realms = new ArrayList<>();
@@ -62,14 +60,6 @@ public class RoleTO extends AbstractBaseBean {
this.name = name;
}
- public String getCriteria() {
- return criteria;
- }
-
- public void setCriteria(final String criteria) {
- this.criteria = criteria;
- }
-
@XmlElementWrapper(name = "entitlements")
@XmlElement(name = "entitlement")
@JsonProperty("entitlements")
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncPolicyTO.java
index 4edcc43..309a4eb 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncPolicyTO.java
@@ -32,23 +32,15 @@ public class SyncPolicyTO extends AbstractPolicyTO {
private SyncPolicySpec specification;
public SyncPolicyTO() {
- this(false);
+ super(PolicyType.SYNC);
}
- public SyncPolicyTO(final boolean global) {
- super();
-
- PolicyType type = global
- ? PolicyType.GLOBAL_SYNC
- : PolicyType.SYNC;
- setType(type);
+ public SyncPolicySpec getSpecification() {
+ return specification;
}
public void setSpecification(final SyncPolicySpec specification) {
this.specification = specification;
}
- public SyncPolicySpec getSpecification() {
- return specification;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
index 175926a..e62ffe4 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
@@ -27,12 +27,22 @@ public class SyncTaskTO extends AbstractProvisioningTaskTO {
private static final long serialVersionUID = -2143537546915809017L;
+ private String destinationRealm;
+
private UserTO userTemplate;
private GroupTO groupTemplate;
private boolean fullReconciliation;
+ public String getDestinationRealm() {
+ return destinationRealm;
+ }
+
+ public void setDestinationRealm(final String destinationRealm) {
+ this.destinationRealm = destinationRealm;
+ }
+
public UserTO getUserTemplate() {
return userTemplate;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
index e4af2bb..03dda04 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
@@ -53,6 +53,8 @@ public class SyncopeTO extends AbstractBaseBean {
private String groupProvisioningManager;
+ private String virAttrCache;
+
private final List<String> reportlets = new ArrayList<>();
private final List<String> taskJobs = new ArrayList<>();
@@ -114,6 +116,10 @@ public class SyncopeTO extends AbstractBaseBean {
return groupProvisioningManager;
}
+ public String getVirAttrCache() {
+ return virAttrCache;
+ }
+
@XmlElementWrapper(name = "reportlets")
@XmlElement(name = "reportlet")
@JsonProperty("reportlets")
@@ -213,4 +219,7 @@ public class SyncopeTO extends AbstractBaseBean {
this.groupProvisioningManager = groupProvisioningManager;
}
+ public void setVirAttrCache(final String virAttrCache) {
+ this.virAttrCache = virAttrCache;
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
index 786bfc9..6597dc8 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
@@ -42,6 +42,8 @@ public class UserTO extends AbstractSubjectTO {
private String password;
+ private final List<Long> roles = new ArrayList<>();
+
private final List<MembershipTO> memberships = new ArrayList<>();
private String status;
@@ -70,6 +72,13 @@ public class UserTO extends AbstractSubjectTO {
this.password = password;
}
+ @XmlElementWrapper(name = "roles")
+ @XmlElement(name = "role")
+ @JsonProperty("roles")
+ public List<Long> getRoles() {
+ return roles;
+ }
+
@XmlElementWrapper(name = "memberships")
@XmlElement(name = "membership")
@JsonProperty("memberships")
@@ -86,7 +95,7 @@ public class UserTO extends AbstractSubjectTO {
} else {
result = new HashMap<>(getMemberships().size());
for (MembershipTO membership : getMemberships()) {
- result.put(membership.getGroupId(), membership);
+ result.put(membership.getGroupKey(), membership);
}
result = Collections.unmodifiableMap(result);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
index 0eed28e..43e6d2c 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
@@ -133,9 +133,8 @@ public class WorkflowFormTO extends AbstractBaseBean {
for (WorkflowFormPropertyTO prop : getProperties()) {
result.put(prop.getId(), prop);
}
- result = Collections.unmodifiableMap(result);
- return result;
+ return Collections.unmodifiableMap(result);
}
@JsonIgnore
@@ -147,6 +146,6 @@ public class WorkflowFormTO extends AbstractBaseBean {
}
}
- return props;
+ return Collections.unmodifiableMap(props);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
index cada048..47a60e8 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
@@ -56,12 +56,12 @@ public class AccountPolicySpec extends AbstractPolicySpec {
private boolean propagateSuspension;
/**
- * Number of permitted login retries.
+ * Maximum number of (failing) authentication attempts.
* 0 disabled; >0 enabled.
* If the number of subsequent failed logins will be greater then this value
* the account will be suspended (lock-out).
*/
- private int permittedLoginRetries;
+ private int maxAuthenticationAttempts;
public boolean isAllLowerCase() {
return allLowerCase;
@@ -111,11 +111,11 @@ public class AccountPolicySpec extends AbstractPolicySpec {
this.propagateSuspension = propagateSuspension;
}
- public int getPermittedLoginRetries() {
- return permittedLoginRetries;
+ public int getMaxAuthenticationAttempts() {
+ return maxAuthenticationAttempts;
}
- public void setPermittedLoginRetries(final int permittedLoginRetries) {
- this.permittedLoginRetries = permittedLoginRetries;
+ public void setMaxAuthenticationAttempts(final int maxAuthenticationAttempts) {
+ this.maxAuthenticationAttempts = maxAuthenticationAttempts;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
index de0ec90..fe9770a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
@@ -21,9 +21,10 @@ package org.apache.syncope.common.lib.types;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.text.ParseException;
-import java.util.AbstractMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.AbstractBaseBean;
import org.apache.syncope.common.lib.to.EventCategoryTO;
import org.apache.syncope.common.lib.types.AuditElements.EventCategoryType;
@@ -109,8 +110,8 @@ public class AuditLoggerName extends AbstractBaseBean {
eventCategory.getValue());
}
- public static Map.Entry<EventCategoryTO, Result> parseEventCategory(final String event) {
- final EventCategoryTO eventCategoryTO = new EventCategoryTO();
+ public static Pair<EventCategoryTO, Result> parseEventCategory(final String event) {
+ EventCategoryTO eventCategoryTO = new EventCategoryTO();
Result condition = null;
@@ -154,7 +155,7 @@ public class AuditLoggerName extends AbstractBaseBean {
}
}
- return new AbstractMap.SimpleEntry<>(eventCategoryTO, condition);
+ return new ImmutablePair<>(eventCategoryTO, condition);
}
/**
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
index 8f0e33b..6875279 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
@@ -25,6 +25,7 @@ public enum ClientExceptionType {
AssociatedResources(Response.Status.BAD_REQUEST),
Composite(Response.Status.BAD_REQUEST),
ConcurrentModification(Response.Status.PRECONDITION_FAILED),
+ ConnectorException(Response.Status.BAD_REQUEST),
DataIntegrityViolation(Response.Status.CONFLICT),
EntityExists(Response.Status.CONFLICT),
GenericPersistence(Response.Status.BAD_REQUEST),
@@ -35,7 +36,6 @@ public enum ClientExceptionType {
InvalidConnIdConf(Response.Status.BAD_REQUEST),
InvalidPolicy(Response.Status.BAD_REQUEST),
InvalidConf(Response.Status.BAD_REQUEST),
- InvalidGroup(Response.Status.BAD_REQUEST),
InvalidPath(Response.Status.BAD_REQUEST),
InvalidReport(Response.Status.BAD_REQUEST),
InvalidReportExec(Response.Status.BAD_REQUEST),
@@ -48,13 +48,13 @@ public enum ClientExceptionType {
InvalidDerSchema(Response.Status.BAD_REQUEST),
InvalidVirSchema(Response.Status.BAD_REQUEST),
InvalidSchemaMapping(Response.Status.BAD_REQUEST),
+ InvalidRealm(Response.Status.BAD_REQUEST),
InvalidUser(Response.Status.BAD_REQUEST),
InvalidExternalResource(Response.Status.BAD_REQUEST),
InvalidNotification(Response.Status.BAD_REQUEST),
InvalidPropagationTask(Response.Status.BAD_REQUEST),
InvalidSchedTask(Response.Status.BAD_REQUEST),
InvalidSyncTask(Response.Status.BAD_REQUEST),
- InvalidPushTask(Response.Status.BAD_REQUEST),
InvalidValues(Response.Status.BAD_REQUEST),
NotFound(Response.Status.NOT_FOUND),
RejectedUserCreate(Response.Status.BAD_REQUEST),
@@ -62,7 +62,6 @@ public enum ClientExceptionType {
RESTValidation(Response.Status.BAD_REQUEST),
GroupOwnership(Response.Status.BAD_REQUEST),
Scheduling(Response.Status.BAD_REQUEST),
- UnauthorizedGroup(Response.Status.UNAUTHORIZED),
Unauthorized(Response.Status.UNAUTHORIZED),
Unknown(Response.Status.BAD_REQUEST),
Workflow(Response.Status.BAD_REQUEST);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
index 8e40551..1712b74 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
@@ -20,6 +20,7 @@ package org.apache.syncope.common.lib.types;
public enum Entitlement {
+ ANONYMOUS,
REALM_LIST,
REALM_CREATE,
REALM_UPDATE,
@@ -34,13 +35,14 @@ public enum Entitlement {
SCHEMA_READ,
SCHEMA_UPDATE,
SCHEMA_DELETE,
+ USER_SEARCH,
USER_LIST,
USER_CREATE,
USER_READ,
USER_UPDATE,
USER_DELETE,
USER_VIEW,
- GROUP_LIST,
+ GROUP_SEARCH,
GROUP_CREATE,
GROUP_READ,
GROUP_UPDATE,
@@ -98,6 +100,9 @@ public enum Entitlement {
AUDIT_DISABLE,
SECURITY_QUESTION_CREATE,
SECURITY_QUESTION_UPDATE,
- SECURITY_QUESTION_DELETE;
+ SECURITY_QUESTION_DELETE,
+ ROUTE_READ,
+ ROUTE_LIST,
+ ROUTE_UPDATE;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java
index 0b498d6..7f1c11e 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java
@@ -24,42 +24,20 @@ import javax.xml.bind.annotation.XmlEnum;
public enum PolicyType {
/**
- * Account policy like:
- * password expire time, change password at first access, ...
+ * How username values should look like.
*/
- ACCOUNT("Account Policy"),
- GLOBAL_ACCOUNT("Account Global Policy"),
+ ACCOUNT,
/**
- * Password policy regarding password syntax.
+ * How password values should look like.
*/
- PASSWORD("Password Policy"),
- GLOBAL_PASSWORD("Password Global Policy"),
+ PASSWORD,
/**
- * SYNC policy regarding account conflicts resolution.
+ * For handling conflicts resolution during synchronization.
*/
- SYNC("Synchronization Policy"),
- GLOBAL_SYNC("Synchronization Global Policy"),
+ SYNC,
/**
- * PUSH policy regarding account conflicts resolution.
+ * For handling conflicts resolution during push.
*/
- PUSH("Push Policy"),
- GLOBAL_PUSH("Push Global Policy");
+ PUSH;
- private String description;
-
- PolicyType(final String description) {
- this.description = description;
- }
-
- public String getDescription() {
- return description;
- }
-
- public boolean isGlobal() {
- return name().startsWith("GLOBAL");
- }
-
- public static PolicyType fromString(final String value) {
- return PolicyType.valueOf(value.toUpperCase());
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/EntitlementTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/EntitlementTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/EntitlementTO.java
deleted file mode 100644
index 62530eb..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/EntitlementTO.java
+++ /dev/null
@@ -1,30 +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.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "entitlement")
-@XmlType
-public class EntitlementTO extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = 7133614577172038452L;
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
index 3ade49a..307bbba 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
@@ -33,6 +33,8 @@ public final class RESTHeaders {
*/
public static final String USERNAME = "X-Syncope-Username";
+ public static final String OWNED_ENTITLEMENTS = "X-Syncope-Entitlements";
+
/**
* HTTP header key for object ID assigned to an object after its creation.
*/
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/EntitlementService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/EntitlementService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/EntitlementService.java
deleted file mode 100644
index 44ad900..0000000
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/EntitlementService.java
+++ /dev/null
@@ -1,53 +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 java.util.List;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import org.apache.syncope.common.lib.wrap.EntitlementTO;
-
-/**
- * REST operations for entitlements.
- */
-@Path("entitlements")
-public interface EntitlementService extends JAXRSService {
-
- /**
- * Returns a list of all known entitlements.
- *
- * @return list of all known entitlements
- */
- @GET
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- List<EntitlementTO> getAllEntitlements();
-
- /**
- * Returns a list of entitlements assigned to user making the current request.
- *
- * @return list of entitlements assigned to user making the current request
- */
- @GET
- @Path("own")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- List<EntitlementTO> getOwnEntitlements();
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/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 2bbe9b7..337bebc 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
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Response;
import org.apache.cxf.jaxrs.model.wadl.Description;
import org.apache.cxf.jaxrs.model.wadl.Descriptions;
import org.apache.cxf.jaxrs.model.wadl.DocTarget;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.mod.GroupMod;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
@@ -51,28 +52,6 @@ import org.apache.syncope.common.lib.wrap.ResourceName;
public interface GroupService extends JAXRSService {
/**
- * Returns children groups of given group.
- *
- * @param groupKey key of group to get children from
- * @return children groups of given group
- */
- @GET
- @Path("{groupKey}/children")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- List<GroupTO> children(@NotNull @PathParam("groupKey") Long groupKey);
-
- /**
- * Returns parent group of the given group (or null if no parent exists).
- *
- * @param groupKey key of group to get parent group from
- * @return parent group of the given group (or null if no parent exists)
- */
- @GET
- @Path("{groupKey}/parent")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- GroupTO parent(@NotNull @PathParam("groupKey") Long groupKey);
-
- /**
* Reads the group matching the provided groupKey.
*
* @param groupKey key of group to be read
@@ -87,8 +66,7 @@ public interface GroupService extends JAXRSService {
* This method is similar to {@link #read(Long)}, but uses different authentication handling to ensure that a user
* can read his own groups.
*
- * @param groupKey key of group to be read
- * @return group with matching id
+ * @return own groups
*/
@Descriptions({
@Description(target = DocTarget.METHOD,
@@ -96,32 +74,38 @@ public interface GroupService extends JAXRSService {
+ "ensure that a user can read his own groups.")
})
@GET
- @Path("{groupKey}/own")
+ @Path("own")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- GroupTO readSelf(@NotNull @PathParam("groupKey") Long groupKey);
+ List<GroupTO> own();
/**
* Returns a paged list of existing groups.
*
+ * @param realms realms under which groups are defined
* @return paged list of all existing groups
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<GroupTO> list();
+ PagedResult<GroupTO> list(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms);
/**
* Returns a paged list of existing groups.
*
+ * @param realms realms under which groups are defined
* @param orderBy list of ordering clauses, separated by comma
* @return paged list of all existing groups
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<GroupTO> list(@QueryParam(PARAM_ORDERBY) String orderBy);
+ PagedResult<GroupTO> list(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
+ @QueryParam(PARAM_ORDERBY) String orderBy);
/**
* Returns a paged list of existing groups matching page/size conditions.
*
+ * @param realms realms under which groups are defined
* @param page result page number
* @param size number of entries per page
* @return paged list of existing groups matching page/size conditions
@@ -129,12 +113,14 @@ public interface GroupService extends JAXRSService {
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
PagedResult<GroupTO> list(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
@NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
@NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
/**
* Returns a paged list of existing groups matching page/size conditions.
*
+ * @param realms realms under which groups are defined
* @param page result page number
* @param size number of entries per page
* @param orderBy list of ordering clauses, separated by comma
@@ -143,6 +129,7 @@ public interface GroupService extends JAXRSService {
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
PagedResult<GroupTO> list(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
@NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
@NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
@QueryParam(PARAM_ORDERBY) String orderBy);
@@ -150,17 +137,21 @@ public interface GroupService extends JAXRSService {
/**
* Returns a paged list of groups matching the provided FIQL search condition.
*
+ * @param realms realms under which groups are defined
* @param fiql FIQL search expression
* @return paged list of groups matching the provided FIQL search condition
*/
@GET
@Path("search")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<GroupTO> search(@NotNull @QueryParam(PARAM_FIQL) String fiql);
+ PagedResult<GroupTO> search(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
+ @NotNull @QueryParam(PARAM_FIQL) String fiql);
/**
* Returns a paged list of groups matching the provided FIQL search condition.
*
+ * @param realms realms under which groups are defined
* @param fiql FIQL search expression
* @param orderBy list of ordering clauses, separated by comma
* @return paged list of groups matching the provided FIQL search condition
@@ -169,11 +160,14 @@ public interface GroupService extends JAXRSService {
@Path("search")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
PagedResult<GroupTO> search(
- @NotNull @QueryParam(PARAM_FIQL) String fiql, @QueryParam(PARAM_ORDERBY) String orderBy);
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
+ @NotNull @QueryParam(PARAM_FIQL) String fiql,
+ @QueryParam(PARAM_ORDERBY) String orderBy);
/**
* Returns a paged list of groups matching the provided FIQL search condition.
*
+ * @param realms realms under which groups are defined
* @param fiql FIQL search expression
* @param page result page number
* @param size number of entries per page
@@ -182,13 +176,16 @@ public interface GroupService extends JAXRSService {
@GET
@Path("search")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<GroupTO> search(@QueryParam(PARAM_FIQL) String fiql,
+ PagedResult<GroupTO> search(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
+ @QueryParam(PARAM_FIQL) String fiql,
@NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
@NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
/**
* Returns a paged list of groups matching the provided FIQL search condition.
*
+ * @param realms realms under which groups are defined
* @param fiql FIQL search expression
* @param page result page number
* @param size number of entries per page
@@ -198,7 +195,9 @@ public interface GroupService extends JAXRSService {
@GET
@Path("search")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<GroupTO> search(@QueryParam(PARAM_FIQL) String fiql,
+ PagedResult<GroupTO> search(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
+ @QueryParam(PARAM_FIQL) String fiql,
@NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
@NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
@QueryParam(PARAM_ORDERBY) String orderBy);
@@ -274,7 +273,8 @@ public interface GroupService extends JAXRSService {
@Path("{groupKey}/deassociate/{type}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- Response bulkDeassociation(@NotNull @PathParam("groupKey") Long groupKey,
+ Response bulkDeassociation(
+ @NotNull @PathParam("groupKey") Long groupKey,
@NotNull @PathParam("type") ResourceDeassociationActionType type,
@NotNull List<ResourceName> resourceNames);
@@ -294,7 +294,8 @@ public interface GroupService extends JAXRSService {
@Path("{groupKey}/associate/{type}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- Response bulkAssociation(@NotNull @PathParam("groupKey") Long groupKey,
+ Response bulkAssociation(
+ @NotNull @PathParam("groupKey") Long groupKey,
@NotNull @PathParam("type") ResourceAssociationActionType type,
@NotNull List<ResourceName> resourceNames);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
index c2a4e6a..c098ace 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
@@ -56,18 +56,6 @@ public interface PolicyService extends JAXRSService {
<T extends AbstractPolicyTO> T read(@NotNull @PathParam("policyKey") Long policyKey);
/**
- * Returns the global policy for the given type.
- *
- * @param type PolicyType to read global policy from
- * @param <T> response type (extending PolicyTO)
- * @return global policy for matching type
- */
- @GET
- @Path("global")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- <T extends AbstractPolicyTO> T readGlobal(@NotNull @MatrixParam("type") PolicyType type);
-
- /**
* Returns a list of policies of the matching type.
*
* @param type Type selector for requested policies
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
index 3046a5d..f40801e 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
@@ -35,6 +35,7 @@ import org.apache.cxf.jaxrs.model.wadl.Descriptions;
import org.apache.cxf.jaxrs.model.wadl.DocTarget;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.rest.api.RESTHeaders;
/**
* REST operations for user self-management.
@@ -45,11 +46,11 @@ public interface UserSelfService extends JAXRSService {
/**
* Returns the user making the service call.
*
- * @return calling user data
+ * @return calling user data, including owned entitlements as header value {@link RESTHeaders#OWNED_ENTITLEMENTS}
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- UserTO read();
+ Response read();
/**
* Self-registration for new user.
[19/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractPolicySpec.java
new file mode 100644
index 0000000..5f2fd1e
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractPolicySpec.java
@@ -0,0 +1,83 @@
+/*
+ * 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.types;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.annotation.SchemaList;
+
+@XmlType
+public abstract class AbstractPolicySpec implements PolicySpec {
+
+ private static final long serialVersionUID = -6210646284287392063L;
+
+ /**
+ * Substrings not permitted.
+ */
+ private final List<String> wordsNotPermitted = new ArrayList<>();
+
+ /**
+ * User attribute values not permitted.
+ */
+ @SchemaList
+ protected final List<String> schemasNotPermitted = new ArrayList<>();
+
+ /**
+ * Substrings not permitted as prefix.
+ */
+ protected final List<String> prefixesNotPermitted = new ArrayList<>();
+
+ /**
+ * Substrings not permitted as suffix.
+ */
+ protected final List<String> suffixesNotPermitted = new ArrayList<>();
+
+ @XmlElementWrapper(name = "wordsNotPermitted")
+ @XmlElement(name = "word")
+ @JsonProperty("wordsNotPermitted")
+ public List<String> getWordsNotPermitted() {
+ return wordsNotPermitted;
+ }
+
+ @XmlElementWrapper(name = "prefixesNotPermitted")
+ @XmlElement(name = "prefix")
+ @JsonProperty("prefixesNotPermitted")
+ public List<String> getPrefixesNotPermitted() {
+ return prefixesNotPermitted;
+ }
+
+ @XmlElementWrapper(name = "schemasNotPermitted")
+ @XmlElement(name = "schema")
+ @JsonProperty("schemasNotPermitted")
+ public List<String> getSchemasNotPermitted() {
+ return schemasNotPermitted;
+ }
+
+ @XmlElementWrapper(name = "suffixesNotPermitted")
+ @XmlElement(name = "suffix")
+ @JsonProperty("suffixesNotPermitted")
+ public List<String> getSuffixesNotPermitted() {
+ return suffixesNotPermitted;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
index 8d5a792..cada048 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
@@ -18,16 +18,10 @@
*/
package org.apache.syncope.common.lib.types;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.annotation.SchemaList;
@XmlType
-public class AccountPolicySpec implements PolicySpec {
+public class AccountPolicySpec extends AbstractPolicySpec {
private static final long serialVersionUID = 3259256974414758406L;
@@ -47,27 +41,6 @@ public class AccountPolicySpec implements PolicySpec {
private String pattern;
/**
- * Substrings not permitted.
- */
- private List<String> wordsNotPermitted;
-
- /**
- * User attribute values not permitted.
- */
- @SchemaList
- private List<String> schemasNotPermitted;
-
- /**
- * Substrings not permitted as prefix.
- */
- private List<String> prefixesNotPermitted;
-
- /**
- * Substrings not permitted as suffix.
- */
- private List<String> suffixesNotPermitted;
-
- /**
* Specify if one or more lowercase characters are permitted.
*/
private boolean allUpperCase;
@@ -130,46 +103,6 @@ public class AccountPolicySpec implements PolicySpec {
this.pattern = pattern;
}
- @XmlElementWrapper(name = "prefixesNotPermitted")
- @XmlElement(name = "prefix")
- @JsonProperty("prefixesNotPermitted")
- public List<String> getPrefixesNotPermitted() {
- if (prefixesNotPermitted == null) {
- prefixesNotPermitted = new ArrayList<String>();
- }
- return prefixesNotPermitted;
- }
-
- @XmlElementWrapper(name = "schemasNotPermitted")
- @XmlElement(name = "schema")
- @JsonProperty("schemasNotPermitted")
- public List<String> getSchemasNotPermitted() {
- if (schemasNotPermitted == null) {
- schemasNotPermitted = new ArrayList<String>();
- }
- return schemasNotPermitted;
- }
-
- @XmlElementWrapper(name = "suffixesNotPermitted")
- @XmlElement(name = "suffix")
- @JsonProperty("suffixesNotPermitted")
- public List<String> getSuffixesNotPermitted() {
- if (suffixesNotPermitted == null) {
- suffixesNotPermitted = new ArrayList<String>();
- }
- return suffixesNotPermitted;
- }
-
- @XmlElementWrapper(name = "wordsNotPermitted")
- @XmlElement(name = "word")
- @JsonProperty("wordsNotPermitted")
- public List<String> getWordsNotPermitted() {
- if (wordsNotPermitted == null) {
- wordsNotPermitted = new ArrayList<String>();
- }
- return wordsNotPermitted;
- }
-
public boolean isPropagateSuspension() {
return propagateSuspension;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttrSchemaType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttrSchemaType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttrSchemaType.java
index 2fc937b..be78979 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttrSchemaType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttrSchemaType.java
@@ -33,7 +33,7 @@ public enum AttrSchemaType {
Encrypted(byte[].class),
Binary(byte[].class);
- final private Class<?> type;
+ private final Class<?> type;
AttrSchemaType(final Class<?> type) {
this.type = type;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttributableType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttributableType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttributableType.java
index 6b989df..fab34f0 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttributableType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttributableType.java
@@ -24,7 +24,7 @@ import javax.xml.bind.annotation.XmlEnum;
public enum AttributableType {
USER,
- ROLE,
+ GROUP,
MEMBERSHIP,
CONFIGURATION;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java
index 40ff86a..323ea09 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java
@@ -26,9 +26,6 @@ public final class AuditElements implements Serializable {
private static final long serialVersionUID = -4385059255522273254L;
- private AuditElements() {
- }
-
@XmlEnum
public enum EventCategoryType {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
index d491037..de0ec90 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
@@ -49,8 +49,9 @@ public class AuditLoggerName extends AbstractBaseBean {
@JsonProperty("category") final String category,
@JsonProperty("subcategory") final String subcategory,
@JsonProperty("event") final String event,
- @JsonProperty("result") final Result result)
- throws IllegalArgumentException {
+ @JsonProperty("result") final Result result) {
+
+ super();
this.type = type == null ? AuditElements.EventCategoryType.CUSTOM : type;
this.category = category;
@@ -86,7 +87,7 @@ public class AuditLoggerName extends AbstractBaseBean {
@SuppressWarnings("unchecked")
public static AuditLoggerName fromLoggerName(final String loggerName)
- throws IllegalArgumentException, ParseException {
+ throws ParseException {
if (StringUtils.isBlank(loggerName)) {
throw new IllegalArgumentException("Null value not permitted");
@@ -153,7 +154,7 @@ public class AuditLoggerName extends AbstractBaseBean {
}
}
- return new AbstractMap.SimpleEntry< EventCategoryTO, Result>(eventCategoryTO, condition);
+ return new AbstractMap.SimpleEntry<>(eventCategoryTO, condition);
}
/**
@@ -183,38 +184,24 @@ public class AuditLoggerName extends AbstractBaseBean {
eventBuilder.append(type.name());
}
}
- eventBuilder.append(']');
-
- eventBuilder.append(":");
-
- eventBuilder.append('[');
+ eventBuilder.append("]:[");
if (StringUtils.isNotBlank(category)) {
eventBuilder.append(category);
}
- eventBuilder.append(']');
-
- eventBuilder.append(":");
-
- eventBuilder.append('[');
+ eventBuilder.append("]:[");
if (StringUtils.isNotBlank(subcategory)) {
eventBuilder.append(subcategory);
}
- eventBuilder.append(']');
-
- eventBuilder.append(":");
-
- eventBuilder.append('[');
+ eventBuilder.append("]:[");
if (StringUtils.isNotBlank(event)) {
eventBuilder.append(event);
}
eventBuilder.append(']');
if (resultValueCondition != null) {
- eventBuilder.append(":");
-
- eventBuilder.append('[');
- eventBuilder.append(resultValueCondition);
- eventBuilder.append(']');
+ eventBuilder.append(":[").
+ append(resultValueCondition).
+ append(']');
}
return eventBuilder.toString();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/CipherAlgorithm.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/CipherAlgorithm.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/CipherAlgorithm.java
index af5592e..d7be1bc 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/CipherAlgorithm.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/CipherAlgorithm.java
@@ -35,9 +35,9 @@ public enum CipherAlgorithm {
SSHA512("S-SHA-512", false),
BCRYPT("BCRYPT", false);
- final private String algorithm;
+ private final String algorithm;
- final private boolean invertible;
+ private final boolean invertible;
CipherAlgorithm(final String algorithm, final boolean invertible) {
this.algorithm = algorithm;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
index c55cebd..f67c3d4 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
@@ -35,10 +35,10 @@ public enum ClientExceptionType {
InvalidConnIdConf(Response.Status.BAD_REQUEST),
InvalidPolicy(Response.Status.BAD_REQUEST),
InvalidConf(Response.Status.BAD_REQUEST),
- InvalidRole(Response.Status.BAD_REQUEST),
+ InvalidGroup(Response.Status.BAD_REQUEST),
InvalidReport(Response.Status.BAD_REQUEST),
InvalidReportExec(Response.Status.BAD_REQUEST),
- InvalidRoles(Response.Status.BAD_REQUEST),
+ InvalidGroups(Response.Status.BAD_REQUEST),
InvalidSchemaDefinition(Response.Status.BAD_REQUEST),
InvalidSearchExpression(Response.Status.BAD_REQUEST),
InvalidPageOrSize(Response.Status.BAD_REQUEST),
@@ -59,9 +59,9 @@ public enum ClientExceptionType {
RejectedUserCreate(Response.Status.BAD_REQUEST),
RequiredValuesMissing(Response.Status.BAD_REQUEST),
RESTValidation(Response.Status.BAD_REQUEST),
- RoleOwnership(Response.Status.BAD_REQUEST),
+ GroupOwnership(Response.Status.BAD_REQUEST),
Scheduling(Response.Status.BAD_REQUEST),
- UnauthorizedRole(Response.Status.UNAUTHORIZED),
+ UnauthorizedGroup(Response.Status.UNAUTHORIZED),
Unauthorized(Response.Status.UNAUTHORIZED),
Unknown(Response.Status.BAD_REQUEST),
Workflow(Response.Status.BAD_REQUEST);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
index 5a92daa..30193f6 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
@@ -38,12 +38,12 @@ public enum EntityViolationType {
InvalidPasswordPolicy("org.apache.syncope.core.persistence.validation.passwordpolicy"),
InvalidPolicy("org.apache.syncope.core.persistence.validation.policy"),
InvalidPropagationTask("org.apache.syncope.core.persistence.validation.propagationtask"),
- InvalidRPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.rPlainSchema"),
- InvalidRDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.rDerSchema"),
- InvalidRVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.rVirSchema"),
+ InvalidGPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.gPlainSchema"),
+ InvalidGDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.gDerSchema"),
+ InvalidGVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.gVirSchema"),
InvalidReport("org.apache.syncope.core.persistence.validation.report"),
InvalidResource("org.apache.syncope.core.persistence.validation.externalresource"),
- InvalidRoleOwner("org.apache.syncope.core.persistence.validation.role.owner"),
+ InvalidGroupOwner("org.apache.syncope.core.persistence.validation.group.owner"),
InvalidSchemaEncrypted("org.apache.syncope.core.persistence.validation.schema.encrypted"),
InvalidSchemaEnum("org.apache.syncope.core.persistence.validation.schema.enum"),
InvalidSchemaMultivalueUnique("org.apache.syncope.core.persistence.validation.schema.multivalueUnique"),
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
index 7dd60d6..c329d72 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
@@ -42,14 +42,14 @@ public enum IntMappingType {
Username(AttributableType.USER),
Password(AttributableType.USER),
// -------------------------
- // Role attribute types (the same in RoleMappingType)
+ // Group attribute types (the same in GroupMappingType)
// -------------------------
- RolePlainSchema(AttributableType.ROLE),
- RoleDerivedSchema(AttributableType.ROLE),
- RoleVirtualSchema(AttributableType.ROLE),
- RoleId(AttributableType.ROLE),
- RoleName(AttributableType.ROLE),
- RoleOwnerSchema(AttributableType.ROLE),
+ GroupPlainSchema(AttributableType.GROUP),
+ GroupDerivedSchema(AttributableType.GROUP),
+ GroupVirtualSchema(AttributableType.GROUP),
+ GroupId(AttributableType.GROUP),
+ GroupName(AttributableType.GROUP),
+ GroupOwnerSchema(AttributableType.GROUP),
// -------------------------
// Membership attribute types (the same in MembershipMappingType)
// -------------------------
@@ -58,7 +58,7 @@ public enum IntMappingType {
MembershipVirtualSchema(AttributableType.MEMBERSHIP),
MembershipId(AttributableType.MEMBERSHIP);
- private AttributableType attributableType;
+ private final AttributableType attributableType;
private IntMappingType(final AttributableType attributableType) {
this.attributableType = attributableType;
@@ -91,11 +91,11 @@ public enum IntMappingType {
* @return set of attribute types.
*/
public static Set<IntMappingType> getAttributeTypes(final AttributableType attributableType) {
- final EnumSet<?> enumset;
+ EnumSet<?> enumset;
switch (attributableType) {
- case ROLE:
- enumset = EnumSet.allOf(RoleMappingType.class);
+ case GROUP:
+ enumset = EnumSet.allOf(GroupMappingType.class);
break;
case MEMBERSHIP:
@@ -105,9 +105,10 @@ public enum IntMappingType {
case USER:
default:
enumset = EnumSet.allOf(UserMappingType.class);
+ break;
}
- final Set<IntMappingType> result = new HashSet<IntMappingType>(enumset.size());
+ final Set<IntMappingType> result = new HashSet<>(enumset.size());
for (Object obj : enumset) {
result.add(IntMappingType.valueOf(obj.toString()));
}
@@ -116,9 +117,8 @@ public enum IntMappingType {
}
public static Set<IntMappingType> getEmbedded() {
- return EnumSet.of(
- IntMappingType.UserId, IntMappingType.Username, IntMappingType.Password,
- IntMappingType.RoleId, IntMappingType.RoleName, IntMappingType.RoleOwnerSchema,
+ return EnumSet.of(IntMappingType.UserId, IntMappingType.Username, IntMappingType.Password,
+ IntMappingType.GroupId, IntMappingType.GroupName, IntMappingType.GroupOwnerSchema,
IntMappingType.MembershipId);
}
@@ -131,8 +131,8 @@ public enum IntMappingType {
*/
public static boolean contains(final AttributableType attributableType, final String type) {
switch (attributableType) {
- case ROLE:
- for (RoleMappingType c : RoleMappingType.values()) {
+ case GROUP:
+ for (GroupMappingType c : GroupMappingType.values()) {
if (c.name().equals(type)) {
return true;
}
@@ -174,16 +174,16 @@ public enum IntMappingType {
}
/**
- * Role attribute types.
+ * Group attribute types.
*/
- private enum RoleMappingType {
-
- RolePlainSchema,
- RoleDerivedSchema,
- RoleVirtualSchema,
- RoleId,
- RoleName,
- RoleOwnerSchema;
+ private enum GroupMappingType {
+
+ GroupPlainSchema,
+ GroupDerivedSchema,
+ GroupVirtualSchema,
+ GroupId,
+ GroupName,
+ GroupOwnerSchema;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java
index 448fceb..175a1ef 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java
@@ -18,16 +18,10 @@
*/
package org.apache.syncope.common.lib.types;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.annotation.SchemaList;
@XmlType
-public class PasswordPolicySpec implements PolicySpec {
+public class PasswordPolicySpec extends AbstractPolicySpec {
private static final long serialVersionUID = -7988778083915548547L;
@@ -47,17 +41,6 @@ public class PasswordPolicySpec implements PolicySpec {
private int minLength;
/**
- * Substrings not permitted.
- */
- private List<String> wordsNotPermitted;
-
- /**
- * User attribute values not permitted.
- */
- @SchemaList
- private List<String> schemasNotPermitted;
-
- /**
* Specify if one or more non alphanumeric characters are required.
*/
private boolean nonAlphanumericRequired;
@@ -147,16 +130,6 @@ public class PasswordPolicySpec implements PolicySpec {
*/
private boolean allowNullPassword;
- /**
- * Substrings not permitted as prefix.
- */
- private List<String> prefixesNotPermitted;
-
- /**
- * Substrings not permitted as suffix.
- */
- private List<String> suffixesNotPermitted;
-
public boolean isDigitRequired() {
return digitRequired;
}
@@ -261,36 +234,6 @@ public class PasswordPolicySpec implements PolicySpec {
this.nonAlphanumericRequired = nonAlphanumericRequired;
}
- @XmlElementWrapper(name = "prefixesNotPermitted")
- @XmlElement(name = "prefix")
- @JsonProperty("prefixesNotPermitted")
- public List<String> getPrefixesNotPermitted() {
- if (prefixesNotPermitted == null) {
- prefixesNotPermitted = new ArrayList<String>();
- }
- return prefixesNotPermitted;
- }
-
- @XmlElementWrapper(name = "schemasNotPermitted")
- @XmlElement(name = "schema")
- @JsonProperty("schemasNotPermitted")
- public List<String> getSchemasNotPermitted() {
- if (schemasNotPermitted == null) {
- schemasNotPermitted = new ArrayList<String>();
- }
- return schemasNotPermitted;
- }
-
- @XmlElementWrapper(name = "suffixesNotPermitted")
- @XmlElement(name = "suffix")
- @JsonProperty("suffixesNotPermitted")
- public List<String> getSuffixesNotPermitted() {
- if (suffixesNotPermitted == null) {
- suffixesNotPermitted = new ArrayList<String>();
- }
- return suffixesNotPermitted;
- }
-
public boolean isUppercaseRequired() {
return uppercaseRequired;
}
@@ -299,16 +242,6 @@ public class PasswordPolicySpec implements PolicySpec {
this.uppercaseRequired = uppercaseRequired;
}
- @XmlElementWrapper(name = "wordsNotPermitted")
- @XmlElement(name = "word")
- @JsonProperty("wordsNotPermitted")
- public List<String> getWordsNotPermitted() {
- if (wordsNotPermitted == null) {
- wordsNotPermitted = new ArrayList<String>();
- }
- return wordsNotPermitted;
- }
-
public boolean isAlphanumericRequired() {
return alphanumericRequired;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceAssociationActionType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceAssociationActionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceAssociationActionType.java
index 7693ca3..3d7955d 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceAssociationActionType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceAssociationActionType.java
@@ -24,15 +24,15 @@ import javax.xml.bind.annotation.XmlEnum;
public enum ResourceAssociationActionType {
/**
- * Add association between user/role on Syncope and external resource(s) without any propagation.
+ * Add association between user/group on Syncope and external resource(s) without any propagation.
*/
LINK,
/**
- * Add user/role into external resource(s).
+ * Add user/group into external resource(s).
*/
PROVISION,
/**
- * Assign (link + provision) external resource(s) with user/role.
+ * Assign (link + provision) external resource(s) with user/group.
*/
ASSIGN
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceDeassociationActionType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceDeassociationActionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceDeassociationActionType.java
index c88f453..aea4fa3 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceDeassociationActionType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceDeassociationActionType.java
@@ -24,15 +24,15 @@ import javax.xml.bind.annotation.XmlEnum;
public enum ResourceDeassociationActionType {
/**
- * Remove association between user/role on Syncope and external resource(s) without any propagation.
+ * Remove association between user/group on Syncope and external resource(s) without any propagation.
*/
UNLINK,
/**
- * Remove user/role from external resource(s).
+ * Remove user/group from external resource(s).
*/
DEPROVISION,
/**
- * Unassign (unlink + de-provision) external resource(s) from user/role.
+ * Unassign (unlink + de-provision) external resource(s) from user/group.
*/
UNASSIGN
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java
index 0acd314..538f19a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java
@@ -24,11 +24,11 @@ import javax.xml.bind.annotation.XmlEnum;
public enum SubjectType {
USER,
- ROLE;
+ GROUP;
public AttributableType asAttributableType() {
return this == USER
? AttributableType.USER
- : AttributableType.ROLE;
+ : AttributableType.GROUP;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java
index e0040de..a904209 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java
@@ -36,19 +36,19 @@ public class SyncPolicySpec implements PolicySpec {
* User attributes and fields for matching during synchronization.
*/
@SchemaList(extended = true)
- private final List<String> uAltSearchSchemas = new ArrayList<String>();
+ private final List<String> uAltSearchSchemas = new ArrayList<>();
@ClassList
private String userJavaRule;
/**
- * Role attributes and fields for matching during synchronization.
+ * Group attributes and fields for matching during synchronization.
*/
@SchemaList(extended = true)
- private final List<String> rAltSearchSchemas = new ArrayList<String>();
+ private final List<String> gAltSearchSchemas = new ArrayList<>();
@ClassList
- private String roleJavaRule;
+ private String groupJavaRule;
/**
* Conflict resolution action.
@@ -72,19 +72,19 @@ public class SyncPolicySpec implements PolicySpec {
return uAltSearchSchemas;
}
- @XmlElementWrapper(name = "roleAltSearchSchemas")
- @XmlElement(name = "roleAltSearchSchema")
- @JsonProperty("roleAltSearchSchemas")
+ @XmlElementWrapper(name = "groupAltSearchSchemas")
+ @XmlElement(name = "groupAltSearchSchema")
+ @JsonProperty("groupAltSearchSchemas")
public List<String> getrAltSearchSchemas() {
- return rAltSearchSchemas;
+ return gAltSearchSchemas;
}
- public String getRoleJavaRule() {
- return roleJavaRule;
+ public String getGroupJavaRule() {
+ return groupJavaRule;
}
- public void setRoleJavaRule(final String roleJavaRule) {
- this.roleJavaRule = roleJavaRule;
+ public void setGroupJavaRule(final String groupJavaRule) {
+ this.groupJavaRule = groupJavaRule;
}
public String getUserJavaRule() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/pom.xml
----------------------------------------------------------------------
diff --git a/common/pom.xml b/common/pom.xml
index a137eb5..db8b41c 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -33,6 +33,10 @@ under the License.
<artifactId>syncope-common</artifactId>
<packaging>pom</packaging>
+ <properties>
+ <rootpom.basedir>${basedir}/..</rootpom.basedir>
+ </properties>
+
<modules>
<module>lib</module>
<module>rest-api</module>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/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
new file mode 100644
index 0000000..2bbe9b7
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
@@ -0,0 +1,312 @@
+/*
+ * 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 java.util.List;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.model.wadl.Description;
+import org.apache.cxf.jaxrs.model.wadl.Descriptions;
+import org.apache.cxf.jaxrs.model.wadl.DocTarget;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.BulkAction;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
+import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
+import org.apache.syncope.common.lib.wrap.ResourceName;
+
+/**
+ * REST operations for groups.
+ */
+@Path("groups")
+public interface GroupService extends JAXRSService {
+
+ /**
+ * Returns children groups of given group.
+ *
+ * @param groupKey key of group to get children from
+ * @return children groups of given group
+ */
+ @GET
+ @Path("{groupKey}/children")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ List<GroupTO> children(@NotNull @PathParam("groupKey") Long groupKey);
+
+ /**
+ * Returns parent group of the given group (or null if no parent exists).
+ *
+ * @param groupKey key of group to get parent group from
+ * @return parent group of the given group (or null if no parent exists)
+ */
+ @GET
+ @Path("{groupKey}/parent")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ GroupTO parent(@NotNull @PathParam("groupKey") Long groupKey);
+
+ /**
+ * Reads the group matching the provided groupKey.
+ *
+ * @param groupKey key of group to be read
+ * @return group with matching id
+ */
+ @GET
+ @Path("{groupKey}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ GroupTO read(@NotNull @PathParam("groupKey") Long groupKey);
+
+ /**
+ * This method is similar to {@link #read(Long)}, but uses different authentication handling to ensure that a user
+ * can read his own groups.
+ *
+ * @param groupKey key of group to be read
+ * @return group with matching id
+ */
+ @Descriptions({
+ @Description(target = DocTarget.METHOD,
+ value = "This method is similar to <tt>read()</tt>, but uses different authentication handling to "
+ + "ensure that a user can read his own groups.")
+ })
+ @GET
+ @Path("{groupKey}/own")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ GroupTO readSelf(@NotNull @PathParam("groupKey") Long groupKey);
+
+ /**
+ * Returns a paged list of existing groups.
+ *
+ * @return paged list of all existing groups
+ */
+ @GET
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ PagedResult<GroupTO> list();
+
+ /**
+ * Returns a paged list of existing groups.
+ *
+ * @param orderBy list of ordering clauses, separated by comma
+ * @return paged list of all existing groups
+ */
+ @GET
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ PagedResult<GroupTO> list(@QueryParam(PARAM_ORDERBY) String orderBy);
+
+ /**
+ * Returns a paged list of existing groups matching page/size conditions.
+ *
+ * @param page result page number
+ * @param size number of entries per page
+ * @return paged list of existing groups matching page/size conditions
+ */
+ @GET
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ PagedResult<GroupTO> list(
+ @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+ @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
+
+ /**
+ * Returns a paged list of existing groups matching page/size conditions.
+ *
+ * @param page result page number
+ * @param size number of entries per page
+ * @param orderBy list of ordering clauses, separated by comma
+ * @return paged list of existing groups matching page/size conditions
+ */
+ @GET
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ PagedResult<GroupTO> list(
+ @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+ @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
+ @QueryParam(PARAM_ORDERBY) String orderBy);
+
+ /**
+ * Returns a paged list of groups matching the provided FIQL search condition.
+ *
+ * @param fiql FIQL search expression
+ * @return paged list of groups matching the provided FIQL search condition
+ */
+ @GET
+ @Path("search")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ PagedResult<GroupTO> search(@NotNull @QueryParam(PARAM_FIQL) String fiql);
+
+ /**
+ * Returns a paged list of groups matching the provided FIQL search condition.
+ *
+ * @param fiql FIQL search expression
+ * @param orderBy list of ordering clauses, separated by comma
+ * @return paged list of groups matching the provided FIQL search condition
+ */
+ @GET
+ @Path("search")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ PagedResult<GroupTO> search(
+ @NotNull @QueryParam(PARAM_FIQL) String fiql, @QueryParam(PARAM_ORDERBY) String orderBy);
+
+ /**
+ * Returns a paged list of groups matching the provided FIQL search condition.
+ *
+ * @param fiql FIQL search expression
+ * @param page result page number
+ * @param size number of entries per page
+ * @return paged list of groups matching the provided FIQL search condition
+ */
+ @GET
+ @Path("search")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ PagedResult<GroupTO> search(@QueryParam(PARAM_FIQL) String fiql,
+ @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+ @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
+
+ /**
+ * Returns a paged list of groups matching the provided FIQL search condition.
+ *
+ * @param fiql FIQL search expression
+ * @param page result page number
+ * @param size number of entries per page
+ * @param orderBy list of ordering clauses, separated by comma
+ * @return paged list of groups matching the provided FIQL search condition
+ */
+ @GET
+ @Path("search")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ PagedResult<GroupTO> search(@QueryParam(PARAM_FIQL) String fiql,
+ @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+ @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
+ @QueryParam(PARAM_ORDERBY) String orderBy);
+
+ /**
+ * Creates a new group.
+ *
+ * @param groupTO group to be created
+ * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created group as well as the group itself
+ * enriched with propagation status information - {@link GroupTO} as <tt>Entity</tt>
+ */
+ @Descriptions({
+ @Description(target = DocTarget.RESPONSE,
+ value = "Featuring <tt>Location</tt> header of created group as well as the "
+ + "group itself enriched with propagation status information - <tt>GroupTO</tt> as <tt>Entity</tt>")
+ })
+ @POST
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ Response create(@NotNull GroupTO groupTO);
+
+ /**
+ * Updates group matching the provided groupKey.
+ *
+ * @param groupKey key of group to be updated
+ * @param groupMod modification to be applied to group matching the provided groupKey
+ * @return <tt>Response</tt> object featuring the updated group enriched with propagation status information
+ * - {@link GroupTO} as <tt>Entity</tt>
+ */
+ @Descriptions({
+ @Description(target = DocTarget.RESPONSE,
+ value = "Featuring the updated group enriched with propagation status information - "
+ + "<tt>GroupTO</tt> as <tt>Entity</tt>")
+ })
+ @POST
+ @Path("{groupKey}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ Response update(@NotNull @PathParam("groupKey") Long groupKey, @NotNull GroupMod groupMod);
+
+ /**
+ * Deletes group matching provided groupKey.
+ *
+ * @param groupKey key of group to be deleted
+ * @return <tt>Response</tt> object featuring the deleted group enriched with propagation status information
+ * - {@link GroupTO} as <tt>Entity</tt>
+ */
+ @Descriptions({
+ @Description(target = DocTarget.RESPONSE,
+ value = "Featuring the deleted group enriched with propagation status information - "
+ + "<tt>GroupTO</tt> as <tt>Entity</tt>")
+ })
+ @DELETE
+ @Path("{groupKey}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ Response delete(@NotNull @PathParam("groupKey") Long groupKey);
+
+ /**
+ * Executes resource-related operations on given group.
+ *
+ * @param groupKey group id.
+ * @param type resource association action type
+ * @param resourceNames external resources to be used for propagation-related operations
+ * @return <tt>Response</tt> object featuring
+ * {@link BulkActionResult} as <tt>Entity</tt>
+ */
+ @Descriptions({
+ @Description(target = DocTarget.RESPONSE,
+ value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>")
+ })
+ @POST
+ @Path("{groupKey}/deassociate/{type}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ Response bulkDeassociation(@NotNull @PathParam("groupKey") Long groupKey,
+ @NotNull @PathParam("type") ResourceDeassociationActionType type,
+ @NotNull List<ResourceName> resourceNames);
+
+ /**
+ * Executes resource-related operations on given group.
+ *
+ * @param groupKey group id.
+ * @param type resource association action type
+ * @param resourceNames external resources to be used for propagation-related operations
+ * @return <tt>Response</tt> object featuring {@link BulkActionResult} as <tt>Entity</tt>
+ */
+ @Descriptions({
+ @Description(target = DocTarget.RESPONSE,
+ value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>")
+ })
+ @POST
+ @Path("{groupKey}/associate/{type}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ Response bulkAssociation(@NotNull @PathParam("groupKey") Long groupKey,
+ @NotNull @PathParam("type") ResourceAssociationActionType type,
+ @NotNull List<ResourceName> resourceNames);
+
+ /**
+ * Executes the provided bulk action.
+ *
+ * @param bulkAction list of group ids against which the bulk action will be performed.
+ * @return Bulk action result
+ */
+ @POST
+ @Path("bulk")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ BulkActionResult bulk(@NotNull BulkAction bulkAction);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
index 7108b49..cd5c473 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
@@ -20,20 +20,20 @@ package org.apache.syncope.common.rest.api.service;
public interface JAXRSService {
- final String PARAM_FIQL = "fiql";
+ String PARAM_FIQL = "fiql";
- final String PARAM_PAGE = "page";
+ String PARAM_PAGE = "page";
- final String DEFAULT_PARAM_PAGE = "1";
+ String DEFAULT_PARAM_PAGE = "1";
- final int DEFAULT_PARAM_PAGE_VALUE = Integer.valueOf(DEFAULT_PARAM_PAGE);
+ int DEFAULT_PARAM_PAGE_VALUE = Integer.valueOf(DEFAULT_PARAM_PAGE);
- final String PARAM_SIZE = "size";
+ String PARAM_SIZE = "size";
- final String DEFAULT_PARAM_SIZE = "25";
+ String DEFAULT_PARAM_SIZE = "25";
- final int DEFAULT_PARAM_SIZE_VALUE = Integer.valueOf(DEFAULT_PARAM_SIZE);
+ int DEFAULT_PARAM_SIZE_VALUE = Integer.valueOf(DEFAULT_PARAM_SIZE);
- final String PARAM_ORDERBY = "orderby";
+ String PARAM_ORDERBY = "orderby";
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
index 9199d37..06b6b32 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
@@ -51,8 +51,8 @@ public interface ResourceService extends JAXRSService {
* Returns connector object from the external resource, for the given type and key.
*
* @param resourceKey Name of resource to read connector object from
- * @param type user / role
- * @param key user key / role key
+ * @param type user /group
+ * @param key user key / group key
* @return connector object from the external resource, for the given type and key
*/
@GET
@@ -128,12 +128,12 @@ public interface ResourceService extends JAXRSService {
boolean check(@NotNull ResourceTO resourceTO);
/**
- * De-associate users or roles (depending on the provided subject type) from the given resource.
+ * De-associate users or groups (depending on the provided subject type) from the given resource.
*
* @param resourceKey name of resource
- * @param subjectType subject type (user or role)
+ * @param subjectType subject type (user or group)
* @param type resource de-association action type
- * @param subjectKeys users or roles against which the bulk action will be performed
+ * @param subjectKeys users or groups against which the bulk action will be performed
* @return <tt>Response</tt> object featuring {@link BulkActionResult} as <tt>Entity</tt>
*/
@Descriptions({
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
deleted file mode 100644
index 5d1b737..0000000
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
+++ /dev/null
@@ -1,312 +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 java.util.List;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.apache.cxf.jaxrs.model.wadl.Description;
-import org.apache.cxf.jaxrs.model.wadl.Descriptions;
-import org.apache.cxf.jaxrs.model.wadl.DocTarget;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
-import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
-import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
-import org.apache.syncope.common.lib.wrap.ResourceName;
-
-/**
- * REST operations for roles.
- */
-@Path("roles")
-public interface RoleService extends JAXRSService {
-
- /**
- * Returns children roles of given role.
- *
- * @param roleKey key of role to get children from
- * @return children roles of given role
- */
- @GET
- @Path("{roleKey}/children")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- List<RoleTO> children(@NotNull @PathParam("roleKey") Long roleKey);
-
- /**
- * Returns parent role of the given role (or null if no parent exists).
- *
- * @param roleKey key of role to get parent role from
- * @return parent role of the given role (or null if no parent exists)
- */
- @GET
- @Path("{roleKey}/parent")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- RoleTO parent(@NotNull @PathParam("roleKey") Long roleKey);
-
- /**
- * Reads the role matching the provided roleKey.
- *
- * @param roleKey key of role to be read
- * @return role with matching id
- */
- @GET
- @Path("{roleKey}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- RoleTO read(@NotNull @PathParam("roleKey") Long roleKey);
-
- /**
- * This method is similar to {@link #read(Long)}, but uses different authentication handling to ensure that a user
- * can read his own roles.
- *
- * @param roleKey key of role to be read
- * @return role with matching id
- */
- @Descriptions({
- @Description(target = DocTarget.METHOD,
- value = "This method is similar to <tt>read()</tt>, but uses different authentication handling to "
- + "ensure that a user can read his own roles.")
- })
- @GET
- @Path("{roleKey}/own")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- RoleTO readSelf(@NotNull @PathParam("roleKey") Long roleKey);
-
- /**
- * Returns a paged list of existing roles.
- *
- * @return paged list of all existing roles
- */
- @GET
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<RoleTO> list();
-
- /**
- * Returns a paged list of existing roles.
- *
- * @param orderBy list of ordering clauses, separated by comma
- * @return paged list of all existing roles
- */
- @GET
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<RoleTO> list(@QueryParam(PARAM_ORDERBY) String orderBy);
-
- /**
- * Returns a paged list of existing roles matching page/size conditions.
- *
- * @param page result page number
- * @param size number of entries per page
- * @return paged list of existing roles matching page/size conditions
- */
- @GET
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<RoleTO> list(
- @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
- @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
-
- /**
- * Returns a paged list of existing roles matching page/size conditions.
- *
- * @param page result page number
- * @param size number of entries per page
- * @param orderBy list of ordering clauses, separated by comma
- * @return paged list of existing roles matching page/size conditions
- */
- @GET
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<RoleTO> list(
- @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
- @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
- @QueryParam(PARAM_ORDERBY) String orderBy);
-
- /**
- * Returns a paged list of roles matching the provided FIQL search condition.
- *
- * @param fiql FIQL search expression
- * @return paged list of roles matching the provided FIQL search condition
- */
- @GET
- @Path("search")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<RoleTO> search(@NotNull @QueryParam(PARAM_FIQL) String fiql);
-
- /**
- * Returns a paged list of roles matching the provided FIQL search condition.
- *
- * @param fiql FIQL search expression
- * @param orderBy list of ordering clauses, separated by comma
- * @return paged list of roles matching the provided FIQL search condition
- */
- @GET
- @Path("search")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<RoleTO> search(
- @NotNull @QueryParam(PARAM_FIQL) String fiql, @QueryParam(PARAM_ORDERBY) String orderBy);
-
- /**
- * Returns a paged list of roles matching the provided FIQL search condition.
- *
- * @param fiql FIQL search expression
- * @param page result page number
- * @param size number of entries per page
- * @return paged list of roles matching the provided FIQL search condition
- */
- @GET
- @Path("search")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<RoleTO> search(@QueryParam(PARAM_FIQL) String fiql,
- @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
- @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
-
- /**
- * Returns a paged list of roles matching the provided FIQL search condition.
- *
- * @param fiql FIQL search expression
- * @param page result page number
- * @param size number of entries per page
- * @param orderBy list of ordering clauses, separated by comma
- * @return paged list of roles matching the provided FIQL search condition
- */
- @GET
- @Path("search")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<RoleTO> search(@QueryParam(PARAM_FIQL) String fiql,
- @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
- @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
- @QueryParam(PARAM_ORDERBY) String orderBy);
-
- /**
- * Creates a new role.
- *
- * @param roleTO role to be created
- * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created role as well as the role itself
- * enriched with propagation status information - {@link RoleTO} as <tt>Entity</tt>
- */
- @Descriptions({
- @Description(target = DocTarget.RESPONSE,
- value = "Featuring <tt>Location</tt> header of created role as well as the "
- + "role itself enriched with propagation status information - <tt>RoleTO</tt> as <tt>Entity</tt>")
- })
- @POST
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- Response create(@NotNull RoleTO roleTO);
-
- /**
- * Updates role matching the provided roleKey.
- *
- * @param roleKey key of role to be updated
- * @param roleMod modification to be applied to role matching the provided roleKey
- * @return <tt>Response</tt> object featuring the updated role enriched with propagation status information
- * - {@link RoleTO} as <tt>Entity</tt>
- */
- @Descriptions({
- @Description(target = DocTarget.RESPONSE,
- value = "Featuring the updated role enriched with propagation status information - "
- + "<tt>RoleTO</tt> as <tt>Entity</tt>")
- })
- @POST
- @Path("{roleKey}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- Response update(@NotNull @PathParam("roleKey") Long roleKey, @NotNull RoleMod roleMod);
-
- /**
- * Deletes role matching provided roleKey.
- *
- * @param roleKey key of role to be deleted
- * @return <tt>Response</tt> object featuring the deleted role enriched with propagation status information
- * - {@link RoleTO} as <tt>Entity</tt>
- */
- @Descriptions({
- @Description(target = DocTarget.RESPONSE,
- value = "Featuring the deleted role enriched with propagation status information - "
- + "<tt>RoleTO</tt> as <tt>Entity</tt>")
- })
- @DELETE
- @Path("{roleKey}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- Response delete(@NotNull @PathParam("roleKey") Long roleKey);
-
- /**
- * Executes resource-related operations on given role.
- *
- * @param roleKey role id.
- * @param type resource association action type
- * @param resourceNames external resources to be used for propagation-related operations
- * @return <tt>Response</tt> object featuring
- * {@link BulkActionResult} as <tt>Entity</tt>
- */
- @Descriptions({
- @Description(target = DocTarget.RESPONSE,
- value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>")
- })
- @POST
- @Path("{roleKey}/deassociate/{type}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- Response bulkDeassociation(@NotNull @PathParam("roleKey") Long roleKey,
- @NotNull @PathParam("type") ResourceDeassociationActionType type,
- @NotNull List<ResourceName> resourceNames);
-
- /**
- * Executes resource-related operations on given role.
- *
- * @param roleKey role id.
- * @param type resource association action type
- * @param resourceNames external resources to be used for propagation-related operations
- * @return <tt>Response</tt> object featuring {@link BulkActionResult} as <tt>Entity</tt>
- */
- @Descriptions({
- @Description(target = DocTarget.RESPONSE,
- value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>")
- })
- @POST
- @Path("{roleKey}/associate/{type}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- Response bulkAssociation(@NotNull @PathParam("roleKey") Long roleKey,
- @NotNull @PathParam("type") ResourceAssociationActionType type,
- @NotNull List<ResourceName> resourceNames);
-
- /**
- * Executes the provided bulk action.
- *
- * @param bulkAction list of role ids against which the bulk action will be performed.
- * @return Bulk action result
- */
- @POST
- @Path("bulk")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- BulkActionResult bulk(@NotNull BulkAction bulkAction);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
index 92aa86b..b74ec2b 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
@@ -39,7 +39,7 @@ public interface WorkflowService extends JAXRSService {
/**
* Exports workflow definition for matching kind.
*
- * @param kind user or role
+ * @param kind user or group
* @return workflow definition for matching kind
*/
@GET
@@ -49,7 +49,7 @@ public interface WorkflowService extends JAXRSService {
/**
* Exports workflow diagram representation.
*
- * @param kind user or role
+ * @param kind user or group
* @return workflow diagram representation
*/
@GET
@@ -60,7 +60,7 @@ public interface WorkflowService extends JAXRSService {
/**
* Imports workflow definition for matching kind.
*
- * @param kind user or role
+ * @param kind user or group
* @param definition workflow definition for matching kind
*/
@PUT
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
index 9874e4d..17e1a7e 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
@@ -29,7 +29,7 @@ import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainSchema;
import org.apache.syncope.core.provisioning.api.data.ConfigurationDataBinder;
-import org.apache.syncope.core.workflow.api.RoleWorkflowAdapter;
+import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -55,7 +55,7 @@ public class ConfigurationLogic extends AbstractTransactionalLogic<ConfTO> {
private UserWorkflowAdapter uwfAdapter;
@Autowired
- private RoleWorkflowAdapter rwfAdapter;
+ private GroupWorkflowAdapter gwfAdapter;
@PreAuthorize("hasRole('CONFIGURATION_DELETE')")
public void delete(final String key) {
@@ -96,7 +96,7 @@ public class ConfigurationLogic extends AbstractTransactionalLogic<ConfTO> {
@Transactional(readOnly = true)
public void export(final OutputStream os) {
try {
- exporter.export(os, uwfAdapter.getPrefix(), rwfAdapter.getPrefix());
+ exporter.export(os, uwfAdapter.getPrefix(), gwfAdapter.getPrefix());
LOG.debug("Database content successfully exported");
} catch (Exception e) {
LOG.error("While exporting database content", e);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
new file mode 100644
index 0000000..a3fd17a
--- /dev/null
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
@@ -0,0 +1,405 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.annotation.Resource;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.BulkAction;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
+import org.apache.syncope.core.persistence.api.dao.UserDAO;
+import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
+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.provisioning.api.AttributableTransformer;
+import org.apache.syncope.core.provisioning.api.GroupProvisioningManager;
+import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
+import org.apache.syncope.core.misc.security.AuthContextUtil;
+import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionInterceptor;
+
+/**
+ * Note that this controller does not extend {@link AbstractTransactionalLogic}, hence does not provide any
+ * Spring's Transactional logic at class level.
+ */
+@Component
+public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
+
+ @Autowired
+ protected GroupDAO groupDAO;
+
+ @Autowired
+ protected UserDAO userDAO;
+
+ @Autowired
+ protected SubjectSearchDAO searchDAO;
+
+ @Autowired
+ protected GroupDataBinder binder;
+
+ @Autowired
+ protected PropagationManager propagationManager;
+
+ @Autowired
+ protected PropagationTaskExecutor taskExecutor;
+
+ @Autowired
+ protected AttributableTransformer attrTransformer;
+
+ @Resource(name = "anonymousUser")
+ protected String anonymousUser;
+
+ @Autowired
+ protected GroupProvisioningManager provisioningManager;
+
+ @PreAuthorize("hasAnyRole('GROUP_READ', T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT)")
+ @Transactional(readOnly = true)
+ @Override
+ public GroupTO read(final Long groupKey) {
+ Group group;
+ // bypass group entitlements check
+ if (anonymousUser.equals(AuthContextUtil.getAuthenticatedUsername())) {
+ group = groupDAO.find(groupKey);
+ } else {
+ group = groupDAO.authFetch(groupKey);
+ }
+
+ if (group == null) {
+ throw new NotFoundException("Group " + groupKey);
+ }
+
+ return binder.getGroupTO(group);
+ }
+
+ @PreAuthorize("isAuthenticated() "
+ + "and not(hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT))")
+ @Transactional(readOnly = true)
+ public GroupTO readSelf(final Long groupKey) {
+ // Explicit search instead of using binder.getGroupFromId() in order to bypass auth checks - will do here
+ Group group = groupDAO.find(groupKey);
+ if (group == null) {
+ throw new NotFoundException("Group " + groupKey);
+ }
+
+ Set<Long> ownedGroupIds;
+ User authUser = userDAO.find(AuthContextUtil.getAuthenticatedUsername());
+ if (authUser == null) {
+ ownedGroupIds = Collections.<Long>emptySet();
+ } else {
+ ownedGroupIds = authUser.getGroupKeys();
+ }
+
+ Set<Long> allowedGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+ allowedGroupIds.addAll(ownedGroupIds);
+ if (!allowedGroupIds.contains(group.getKey())) {
+ throw new UnauthorizedGroupException(group.getKey());
+ }
+
+ return binder.getGroupTO(group);
+ }
+
+ @PreAuthorize("hasRole('GROUP_READ')")
+ @Transactional(readOnly = true)
+ public GroupTO parent(final Long groupKey) {
+ Group group = groupDAO.authFetch(groupKey);
+
+ Set<Long> allowedGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+ if (group.getParent() != null && !allowedGroupIds.contains(group.getParent().getKey())) {
+ throw new UnauthorizedGroupException(group.getParent().getKey());
+ }
+
+ GroupTO result = group.getParent() == null
+ ? null
+ : binder.getGroupTO(group.getParent());
+
+ return result;
+ }
+
+ @PreAuthorize("hasRole('GROUP_READ')")
+ @Transactional(readOnly = true)
+ public List<GroupTO> children(final Long groupKey) {
+ Group group = groupDAO.authFetch(groupKey);
+
+ Set<Long> allowedGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+
+ List<Group> children = groupDAO.findChildren(group);
+ List<GroupTO> childrenTOs = new ArrayList<>(children.size());
+ for (Group child : children) {
+ if (allowedGroupIds.contains(child.getKey())) {
+ childrenTOs.add(binder.getGroupTO(child));
+ }
+ }
+
+ return childrenTOs;
+ }
+
+ @PreAuthorize("isAuthenticated()")
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
+ @Override
+ public int count() {
+ return groupDAO.count();
+ }
+
+ @PreAuthorize("isAuthenticated()")
+ @Transactional(readOnly = true)
+ @Override
+ public List<GroupTO> list(final int page, final int size, final List<OrderByClause> orderBy) {
+ List<Group> groups = groupDAO.findAll(page, size, orderBy);
+
+ List<GroupTO> groupTOs = new ArrayList<>(groups.size());
+ for (Group group : groups) {
+ groupTOs.add(binder.getGroupTO(group));
+ }
+
+ return groupTOs;
+ }
+
+ @PreAuthorize("isAuthenticated()")
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
+ @Override
+ public int searchCount(final SearchCond searchCondition) {
+ final Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+ return searchDAO.count(adminGroupIds, searchCondition, SubjectType.GROUP);
+ }
+
+ @PreAuthorize("isAuthenticated()")
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
+ @Override
+ public List<GroupTO> search(final SearchCond searchCondition, final int page, final int size,
+ final List<OrderByClause> orderBy) {
+
+ final List<Group> matchingGroups = searchDAO.search(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.
+ getOwnedEntitlementNames()),
+ searchCondition, page, size, orderBy, SubjectType.GROUP);
+
+ final List<GroupTO> result = new ArrayList<>(matchingGroups.size());
+ for (Group group : matchingGroups) {
+ result.add(binder.getGroupTO(group));
+ }
+
+ return result;
+ }
+
+ @PreAuthorize("hasRole('GROUP_CREATE')")
+ public GroupTO create(final GroupTO groupTO) {
+ // Check that this operation is allowed to be performed by caller
+ Set<Long> allowedGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+ if (groupTO.getParent() != 0 && !allowedGroupIds.contains(groupTO.getParent())) {
+ throw new UnauthorizedGroupException(groupTO.getParent());
+ }
+
+ // Attributable transformation (if configured)
+ GroupTO actual = attrTransformer.transform(groupTO);
+ LOG.debug("Transformed: {}", actual);
+
+ /*
+ * Actual operations: workflow, propagation
+ */
+ Map.Entry<Long, List<PropagationStatus>> created = provisioningManager.create(groupTO);
+ final GroupTO savedTO = binder.getGroupTO(created.getKey());
+ savedTO.getPropagationStatusTOs().addAll(created.getValue());
+ return savedTO;
+ }
+
+ @PreAuthorize("hasRole('GROUP_UPDATE')")
+ @Override
+ public GroupTO update(final GroupMod groupMod) {
+ // Check that this operation is allowed to be performed by caller
+ groupDAO.authFetch(groupMod.getKey());
+
+ // Attribute value transformation (if configured)
+ GroupMod actual = attrTransformer.transform(groupMod);
+ LOG.debug("Transformed: {}", actual);
+
+ Map.Entry<Long, List<PropagationStatus>> updated = provisioningManager.update(groupMod);
+
+ final GroupTO updatedTO = binder.getGroupTO(updated.getKey());
+ updatedTO.getPropagationStatusTOs().addAll(updated.getValue());
+ return updatedTO;
+ }
+
+ @PreAuthorize("hasRole('GROUP_DELETE')")
+ @Override
+ public GroupTO delete(final Long groupKey) {
+ List<Group> ownedGroups = groupDAO.findOwnedByGroup(groupKey);
+ if (!ownedGroups.isEmpty()) {
+ List<String> owned = new ArrayList<>(ownedGroups.size());
+ for (Group group : ownedGroups) {
+ owned.add(group.getKey() + " " + group.getName());
+ }
+
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.GroupOwnership);
+ sce.getElements().addAll(owned);
+ throw sce;
+ }
+
+ List<PropagationStatus> statuses = provisioningManager.delete(groupKey);
+
+ GroupTO groupTO = new GroupTO();
+ groupTO.setKey(groupKey);
+
+ groupTO.getPropagationStatusTOs().addAll(statuses);
+
+ return groupTO;
+ }
+
+ @PreAuthorize("(hasRole('GROUP_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE)")
+ public BulkActionResult bulk(final BulkAction bulkAction) {
+ BulkActionResult res = new BulkActionResult();
+
+ if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
+ for (String groupKey : bulkAction.getTargets()) {
+ try {
+ res.add(delete(Long.valueOf(groupKey)).getKey(), BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing delete for group {}", groupKey, e);
+ res.add(groupKey, BulkActionResult.Status.FAILURE);
+ }
+ }
+ } else {
+ LOG.warn("Unsupported bulk action: {}", bulkAction.getOperation());
+ }
+
+ return res;
+ }
+
+ @PreAuthorize("hasRole('GROUP_UPDATE')")
+ @Transactional(rollbackFor = { Throwable.class })
+ @Override
+ public GroupTO unlink(final Long groupKey, final Collection<String> resources) {
+ final GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupKey);
+ groupMod.getResourcesToRemove().addAll(resources);
+ final Long updatedResult = provisioningManager.unlink(groupMod);
+
+ return binder.getGroupTO(updatedResult);
+ }
+
+ @PreAuthorize("hasRole('GROUP_UPDATE')")
+ @Transactional(rollbackFor = { Throwable.class })
+ @Override
+ public GroupTO link(final Long groupKey, final Collection<String> resources) {
+ final GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupKey);
+ groupMod.getResourcesToAdd().addAll(resources);
+ return binder.getGroupTO(provisioningManager.link(groupMod));
+ }
+
+ @PreAuthorize("hasRole('GROUP_UPDATE')")
+ @Transactional(rollbackFor = { Throwable.class })
+ @Override
+ public GroupTO unassign(final Long groupKey, final Collection<String> resources) {
+ final GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupKey);
+ groupMod.getResourcesToRemove().addAll(resources);
+ return update(groupMod);
+ }
+
+ @PreAuthorize("hasRole('GROUP_UPDATE')")
+ @Transactional(rollbackFor = { Throwable.class })
+ @Override
+ public GroupTO assign(
+ final Long groupKey, final Collection<String> resources, final boolean changePwd, final String password) {
+
+ final GroupMod userMod = new GroupMod();
+ userMod.setKey(groupKey);
+ userMod.getResourcesToAdd().addAll(resources);
+ return update(userMod);
+ }
+
+ @PreAuthorize("hasRole('GROUP_UPDATE')")
+ @Transactional(rollbackFor = { Throwable.class })
+ @Override
+ public GroupTO deprovision(final Long groupKey, final Collection<String> resources) {
+ final Group group = groupDAO.authFetch(groupKey);
+
+ List<PropagationStatus> statuses = provisioningManager.deprovision(groupKey, resources);
+
+ final GroupTO updatedTO = binder.getGroupTO(group);
+ updatedTO.getPropagationStatusTOs().addAll(statuses);
+ return updatedTO;
+ }
+
+ @PreAuthorize("hasRole('GROUP_UPDATE')")
+ @Transactional(rollbackFor = { Throwable.class })
+ @Override
+ public GroupTO provision(
+ final Long groupKey, final Collection<String> resources, final boolean changePwd, final String password) {
+ final GroupTO original = binder.getGroupTO(groupKey);
+
+ //trick: assign and retrieve propagation statuses ...
+ original.getPropagationStatusTOs().addAll(
+ assign(groupKey, resources, changePwd, password).getPropagationStatusTOs());
+
+ // .... rollback.
+ TransactionInterceptor.currentTransactionStatus().setRollbackOnly();
+ return original;
+ }
+
+ @Override
+ protected GroupTO resolveReference(final Method method, final Object... args) throws UnresolvedReferenceException {
+ Long key = null;
+
+ if (ArrayUtils.isNotEmpty(args)) {
+ for (int i = 0; key == null && i < args.length; i++) {
+ if (args[i] instanceof Long) {
+ key = (Long) args[i];
+ } else if (args[i] instanceof GroupTO) {
+ key = ((GroupTO) args[i]).getKey();
+ } else if (args[i] instanceof GroupMod) {
+ key = ((GroupMod) args[i]).getKey();
+ }
+ }
+ }
+
+ if ((key != null) && !key.equals(0l)) {
+ try {
+ return binder.getGroupTO(key);
+ } catch (Throwable ignore) {
+ LOG.debug("Unresolved reference", ignore);
+ throw new UnresolvedReferenceException(ignore);
+ }
+ }
+
+ throw new UnresolvedReferenceException();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
index b85b74c..baeb1ce 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
@@ -34,7 +34,7 @@ import org.apache.syncope.common.lib.types.SubjectType;
import org.apache.syncope.core.persistence.api.dao.DuplicateException;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.AttributableUtil;
import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
@@ -68,7 +68,7 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
private UserDAO userDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private ResourceDataBinder binder;
@@ -170,7 +170,7 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
Subject<?, ?, ?> subject = type == SubjectType.USER
? userDAO.find(id)
- : roleDAO.find(id);
+ : groupDAO.find(id);
if (subject == null) {
throw new NotFoundException(type + " " + id);
}
[40/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
index 3067ca5..5f006d0 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
@@ -30,12 +30,12 @@ import org.apache.syncope.common.lib.types.MatchingRule;
import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.common.lib.types.UnmatchingRule;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
import org.apache.syncope.core.provisioning.api.AttributableTransformer;
import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.sync.SyncActions;
-import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
+import org.apache.syncope.core.misc.security.UnauthorizedException;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
import org.apache.syncope.core.provisioning.api.sync.SyncopeSyncResultHandler;
import org.identityconnectors.framework.common.objects.SyncDelta;
@@ -47,12 +47,12 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
implements SyncopeSyncResultHandler {
@Autowired
- protected SyncUtilities syncUtilities;
+ protected SyncUtils syncUtilities;
@Autowired
protected AttributableTransformer attrTransformer;
- protected abstract AttributableUtil getAttributableUtil();
+ protected abstract AttributableUtils getAttributableUtils();
protected abstract String getName(AbstractSubjectTO subjectTO);
@@ -83,7 +83,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
}
}
- protected List<ProvisioningResult> assign(final SyncDelta delta, final AttributableUtil attrUtil)
+ protected List<ProvisioningResult> assign(final SyncDelta delta, final AttributableUtils attrUtils)
throws JobExecutionException {
if (!profile.getTask().isPerformCreate()) {
LOG.debug("SyncTask not configured for create");
@@ -91,13 +91,13 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
}
final AbstractSubjectTO subjectTO =
- connObjectUtil.getSubjectTO(delta.getObject(), profile.getTask(), attrUtil);
+ connObjectUtils.getSubjectTO(delta.getObject(), profile.getTask(), attrUtils);
subjectTO.getResources().add(profile.getTask().getResource().getKey());
final ProvisioningResult result = new ProvisioningResult();
result.setOperation(ResourceOperation.CREATE);
- result.setSubjectType(attrUtil.getType());
+ result.setSubjectType(attrUtils.getType());
result.setStatus(ProvisioningResult.Status.SUCCESS);
// Attributable transformation (if configured)
@@ -114,13 +114,13 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
_delta = action.beforeAssign(this.getProfile(), _delta, transformed);
}
- create(transformed, _delta, attrUtil, UnmatchingRule.toEventName(UnmatchingRule.ASSIGN), result);
+ create(transformed, _delta, attrUtils, UnmatchingRule.toEventName(UnmatchingRule.ASSIGN), result);
}
return Collections.singletonList(result);
}
- protected List<ProvisioningResult> create(final SyncDelta delta, final AttributableUtil attrUtil)
+ protected List<ProvisioningResult> create(final SyncDelta delta, final AttributableUtils attrUtils)
throws JobExecutionException {
if (!profile.getTask().isPerformCreate()) {
@@ -129,7 +129,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
}
final AbstractSubjectTO subjectTO =
- connObjectUtil.getSubjectTO(delta.getObject(), profile.getTask(), attrUtil);
+ connObjectUtils.getSubjectTO(delta.getObject(), profile.getTask(), attrUtils);
// Attributable transformation (if configured)
AbstractSubjectTO transformed = attrTransformer.transform(subjectTO);
@@ -137,7 +137,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
final ProvisioningResult result = new ProvisioningResult();
result.setOperation(ResourceOperation.CREATE);
- result.setSubjectType(attrUtil.getType());
+ result.setSubjectType(attrUtils.getType());
result.setStatus(ProvisioningResult.Status.SUCCESS);
result.setName(getName(transformed));
@@ -150,7 +150,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
_delta = action.beforeProvision(this.getProfile(), _delta, transformed);
}
- create(transformed, _delta, attrUtil, UnmatchingRule.toEventName(UnmatchingRule.PROVISION), result);
+ create(transformed, _delta, attrUtils, UnmatchingRule.toEventName(UnmatchingRule.PROVISION), result);
}
return Collections.<ProvisioningResult>singletonList(result);
@@ -159,7 +159,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
private void create(
final AbstractSubjectTO subjectTO,
final SyncDelta delta,
- final AttributableUtil attrUtil,
+ final AttributableUtils attrUtils,
final String operation,
final ProvisioningResult result)
throws JobExecutionException {
@@ -179,13 +179,13 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
} catch (PropagationException e) {
// A propagation failure doesn't imply a synchronization failure.
// The propagation exception status will be reported into the propagation task execution.
- LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
+ LOG.error("Could not propagate {} {}", attrUtils.getType(), delta.getUid().getUidValue(), e);
output = e;
resultStatus = Result.FAILURE;
} catch (Exception e) {
result.setStatus(ProvisioningResult.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
- LOG.error("Could not create {} {} ", attrUtil.getType(), delta.getUid().getUidValue(), e);
+ LOG.error("Could not create {} {} ", attrUtils.getType(), delta.getUid().getUidValue(), e);
output = e;
resultStatus = Result.FAILURE;
}
@@ -194,7 +194,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
}
protected List<ProvisioningResult> update(SyncDelta delta, final List<Long> subjects,
- final AttributableUtil attrUtil)
+ final AttributableUtils attrUtils)
throws JobExecutionException {
if (!profile.getTask().isPerformUpdate()) {
@@ -211,14 +211,14 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
final ProvisioningResult result = new ProvisioningResult();
result.setOperation(ResourceOperation.UPDATE);
- result.setSubjectType(attrUtil.getType());
+ result.setSubjectType(attrUtils.getType());
result.setStatus(ProvisioningResult.Status.SUCCESS);
result.setId(key);
AbstractSubjectTO before = getSubjectTO(key);
if (before == null) {
result.setStatus(ProvisioningResult.Status.FAILURE);
- result.setMessage(String.format("Subject '%s(%d)' not found", attrUtil.getType().name(), key));
+ result.setMessage(String.format("Subject '%s(%d)' not found", attrUtils.getType().name(), key));
} else {
result.setName(getName(before));
}
@@ -250,17 +250,17 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
output = updated;
resultStatus = Result.SUCCESS;
result.setName(getName(updated));
- LOG.debug("{} {} successfully updated", attrUtil.getType(), key);
+ LOG.debug("{} {} successfully updated", attrUtils.getType(), key);
} catch (PropagationException e) {
// A propagation failure doesn't imply a synchronization failure.
// The propagation exception status will be reported into the propagation task execution.
- LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
+ LOG.error("Could not propagate {} {}", attrUtils.getType(), delta.getUid().getUidValue(), e);
output = e;
resultStatus = Result.FAILURE;
} catch (Exception e) {
result.setStatus(ProvisioningResult.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
- LOG.error("Could not update {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
+ LOG.error("Could not update {} {}", attrUtils.getType(), delta.getUid().getUidValue(), e);
output = e;
resultStatus = Result.FAILURE;
}
@@ -275,7 +275,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
protected List<ProvisioningResult> deprovision(
SyncDelta delta,
final List<Long> subjects,
- final AttributableUtil attrUtil,
+ final AttributableUtils attrUtils,
final boolean unlink)
throws JobExecutionException {
@@ -296,7 +296,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
final ProvisioningResult result = new ProvisioningResult();
result.setOperation(ResourceOperation.DELETE);
- result.setSubjectType(attrUtil.getType());
+ result.setSubjectType(attrUtils.getType());
result.setStatus(ProvisioningResult.Status.SUCCESS);
result.setId(id);
@@ -304,7 +304,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
if (before == null) {
result.setStatus(ProvisioningResult.Status.FAILURE);
- result.setMessage(String.format("Subject '%s(%d)' not found", attrUtil.getType().name(), id));
+ result.setMessage(String.format("Subject '%s(%d)' not found", attrUtils.getType().name(), id));
}
if (!profile.isDryRun()) {
@@ -333,17 +333,17 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
}
resultStatus = Result.SUCCESS;
- LOG.debug("{} {} successfully updated", attrUtil.getType(), id);
+ LOG.debug("{} {} successfully updated", attrUtils.getType(), id);
} catch (PropagationException e) {
// A propagation failure doesn't imply a synchronization failure.
// The propagation exception status will be reported into the propagation task execution.
- LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
+ LOG.error("Could not propagate {} {}", attrUtils.getType(), delta.getUid().getUidValue(), e);
output = e;
resultStatus = Result.FAILURE;
} catch (Exception e) {
result.setStatus(ProvisioningResult.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
- LOG.error("Could not update {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
+ LOG.error("Could not update {} {}", attrUtils.getType(), delta.getUid().getUidValue(), e);
output = e;
resultStatus = Result.FAILURE;
}
@@ -361,7 +361,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
protected List<ProvisioningResult> link(
SyncDelta delta,
final List<Long> subjects,
- final AttributableUtil attrUtil,
+ final AttributableUtils attrUtils,
final boolean unlink)
throws JobExecutionException {
@@ -382,7 +382,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
final ProvisioningResult result = new ProvisioningResult();
result.setOperation(ResourceOperation.NONE);
- result.setSubjectType(attrUtil.getType());
+ result.setSubjectType(attrUtils.getType());
result.setStatus(ProvisioningResult.Status.SUCCESS);
result.setId(id);
@@ -390,7 +390,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
if (before == null) {
result.setStatus(ProvisioningResult.Status.FAILURE);
- result.setMessage(String.format("Subject '%s(%d)' not found", attrUtil.getType().name(), id));
+ result.setMessage(String.format("Subject '%s(%d)' not found", attrUtils.getType().name(), id));
}
if (!profile.isDryRun()) {
@@ -418,17 +418,17 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
}
resultStatus = Result.SUCCESS;
- LOG.debug("{} {} successfully updated", attrUtil.getType(), id);
+ LOG.debug("{} {} successfully updated", attrUtils.getType(), id);
} catch (PropagationException e) {
// A propagation failure doesn't imply a synchronization failure.
// The propagation exception status will be reported into the propagation task execution.
- LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
+ LOG.error("Could not propagate {} {}", attrUtils.getType(), delta.getUid().getUidValue(), e);
output = e;
resultStatus = Result.FAILURE;
} catch (Exception e) {
result.setStatus(ProvisioningResult.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
- LOG.error("Could not update {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
+ LOG.error("Could not update {} {}", attrUtils.getType(), delta.getUid().getUidValue(), e);
output = e;
resultStatus = Result.FAILURE;
}
@@ -443,7 +443,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
}
protected List<ProvisioningResult> delete(
- SyncDelta delta, final List<Long> subjects, final AttributableUtil attrUtil)
+ SyncDelta delta, final List<Long> subjects, final AttributableUtils attrUtils)
throws JobExecutionException {
if (!profile.getTask().isPerformDelete()) {
@@ -468,7 +468,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
result.setId(id);
result.setName(getName(before));
result.setOperation(ResourceOperation.DELETE);
- result.setSubjectType(attrUtil.getType());
+ result.setSubjectType(attrUtils.getType());
result.setStatus(ProvisioningResult.Status.SUCCESS);
if (!profile.isDryRun()) {
@@ -483,7 +483,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
} catch (Exception e) {
result.setStatus(ProvisioningResult.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
- LOG.error("Could not delete {} {}", attrUtil.getType(), id, e);
+ LOG.error("Could not delete {} {}", attrUtils.getType(), id, e);
output = e;
}
@@ -497,18 +497,18 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
delResults.add(result);
} catch (NotFoundException e) {
- LOG.error("Could not find {} {}", attrUtil.getType(), id, e);
- } catch (UnauthorizedGroupException e) {
- LOG.error("Not allowed to read {} {}", attrUtil.getType(), id, e);
+ LOG.error("Could not find {} {}", attrUtils.getType(), id, e);
+ } catch (UnauthorizedException e) {
+ LOG.error("Not allowed to read {} {}", attrUtils.getType(), id, e);
} catch (Exception e) {
- LOG.error("Could not delete {} {}", attrUtil.getType(), id, e);
+ LOG.error("Could not delete {} {}", attrUtils.getType(), id, e);
}
}
return delResults;
}
- private List<ProvisioningResult> ignore(SyncDelta delta, final AttributableUtil attrUtil, final boolean matching)
+ private List<ProvisioningResult> ignore(SyncDelta delta, final AttributableUtils attrUtils, final boolean matching)
throws JobExecutionException {
LOG.debug("Subject to ignore {}", delta.getObject().getUid().getUidValue());
@@ -519,7 +519,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
result.setId(null);
result.setName(delta.getObject().getUid().getUidValue());
result.setOperation(ResourceOperation.NONE);
- result.setSubjectType(attrUtil.getType());
+ result.setSubjectType(attrUtils.getType());
result.setStatus(ProvisioningResult.Status.SUCCESS);
ignoreResults.add(result);
@@ -541,7 +541,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
protected final void doHandle(final SyncDelta delta)
throws JobExecutionException {
- final AttributableUtil attrUtil = getAttributableUtil();
+ final AttributableUtils attrUtils = getAttributableUtils();
LOG.debug("Process {} for {} as {}",
delta.getDeltaType(), delta.getUid().getUidValue(), delta.getObject().getObjectClass());
@@ -552,7 +552,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
try {
List<Long> subjectKeys = syncUtilities.findExisting(
- uid, delta.getObject(), profile.getTask().getResource(), attrUtil);
+ uid, delta.getObject(), profile.getTask().getResource(), attrUtils);
if (subjectKeys.size() > 1) {
switch (profile.getResAct()) {
@@ -576,13 +576,13 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
if (subjectKeys.isEmpty()) {
switch (profile.getTask().getUnmatchingRule()) {
case ASSIGN:
- profile.getResults().addAll(assign(delta, attrUtil));
+ profile.getResults().addAll(assign(delta, attrUtils));
break;
case PROVISION:
- profile.getResults().addAll(create(delta, attrUtil));
+ profile.getResults().addAll(create(delta, attrUtils));
break;
case IGNORE:
- profile.getResults().addAll(ignore(delta, attrUtil, false));
+ profile.getResults().addAll(ignore(delta, attrUtils, false));
break;
default:
// do nothing
@@ -590,22 +590,22 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
} else {
switch (profile.getTask().getMatchingRule()) {
case UPDATE:
- profile.getResults().addAll(update(delta, subjectKeys, attrUtil));
+ profile.getResults().addAll(update(delta, subjectKeys, attrUtils));
break;
case DEPROVISION:
- profile.getResults().addAll(deprovision(delta, subjectKeys, attrUtil, false));
+ profile.getResults().addAll(deprovision(delta, subjectKeys, attrUtils, false));
break;
case UNASSIGN:
- profile.getResults().addAll(deprovision(delta, subjectKeys, attrUtil, true));
+ profile.getResults().addAll(deprovision(delta, subjectKeys, attrUtils, true));
break;
case LINK:
- profile.getResults().addAll(link(delta, subjectKeys, attrUtil, false));
+ profile.getResults().addAll(link(delta, subjectKeys, attrUtils, false));
break;
case UNLINK:
- profile.getResults().addAll(link(delta, subjectKeys, attrUtil, true));
+ profile.getResults().addAll(link(delta, subjectKeys, attrUtils, true));
break;
case IGNORE:
- profile.getResults().addAll(ignore(delta, attrUtil, true));
+ profile.getResults().addAll(ignore(delta, attrUtils, true));
break;
default:
// do nothing
@@ -615,7 +615,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
if (subjectKeys.isEmpty()) {
LOG.debug("No match found for deletion");
} else {
- profile.getResults().addAll(delete(delta, subjectKeys, attrUtil));
+ profile.getResults().addAll(delete(delta, subjectKeys, attrUtils));
}
}
} catch (IllegalStateException | IllegalArgumentException e) {
@@ -630,9 +630,8 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
final Object output,
final Object... input) {
- notificationManager.createTasks(
- AuditElements.EventCategoryType.SYNCHRONIZATION,
- getAttributableUtil().getType().name().toLowerCase(),
+ notificationManager.createTasks(AuditElements.EventCategoryType.SYNCHRONIZATION,
+ getAttributableUtils().getType().name().toLowerCase(),
profile.getTask().getResource().getKey(),
event,
result,
@@ -640,9 +639,8 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
output,
input);
- auditManager.audit(
- AuditElements.EventCategoryType.SYNCHRONIZATION,
- getAttributableUtil().getType().name().toLowerCase(),
+ auditManager.audit(AuditElements.EventCategoryType.SYNCHRONIZATION,
+ getAttributableUtils().getType().name().toLowerCase(),
profile.getTask().getResource().getKey(),
event,
result,
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
index ec33571..d07ad34 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
@@ -20,7 +20,7 @@ package org.apache.syncope.core.provisioning.java.sync;
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.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
import org.apache.syncope.core.provisioning.api.GroupProvisioningManager;
import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
@@ -32,7 +32,7 @@ import org.apache.syncope.core.provisioning.api.sync.ProvisioningActions;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningProfile;
import org.apache.syncope.core.provisioning.api.sync.SyncopeResultHandler;
import org.apache.syncope.core.misc.AuditManager;
-import org.apache.syncope.core.misc.ConnObjectUtil;
+import org.apache.syncope.core.misc.ConnObjectUtils;
import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
@@ -55,10 +55,10 @@ public abstract class AbstractSyncopeResultHandler<T extends ProvisioningTask, A
protected GroupDAO groupDAO;
/**
- * ConnectorObject util.
+ * ConnectorObject utils.
*/
@Autowired
- protected ConnObjectUtil connObjectUtil;
+ protected ConnObjectUtils connObjectUtils;
/**
* Notification Manager.
@@ -97,10 +97,10 @@ public abstract class AbstractSyncopeResultHandler<T extends ProvisioningTask, A
protected GroupWorkflowAdapter gwfAdapter;
@Autowired
- protected UserDataBinder userTransfer;
+ protected UserDataBinder userDataBinder;
@Autowired
- protected GroupDataBinder groupTransfer;
+ protected GroupDataBinder groupDataBinder;
@Autowired
protected UserProvisioningManager userProvisioningManager;
@@ -109,7 +109,7 @@ public abstract class AbstractSyncopeResultHandler<T extends ProvisioningTask, A
protected GroupProvisioningManager groupProvisioningManager;
@Autowired
- protected AttributableUtilFactory attrUtilFactory;
+ protected AttributableUtilsFactory attrUtilsFactory;
/**
* Sync profile.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupPushResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupPushResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupPushResultHandlerImpl.java
index 66d8efa..c38e5d6 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupPushResultHandlerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupPushResultHandlerImpl.java
@@ -27,7 +27,7 @@ import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.Mapping;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
import org.apache.syncope.core.persistence.api.entity.Subject;
@@ -41,25 +41,25 @@ import org.identityconnectors.framework.common.objects.Uid;
public class GroupPushResultHandlerImpl extends AbstractPushResultHandler implements GroupPushResultHandler {
@Override
- protected AttributableUtil getAttributableUtil() {
- return attrUtilFactory.getInstance(AttributableType.GROUP);
+ protected AttributableUtils getAttributableUtils() {
+ return attrUtilsFactory.getInstance(AttributableType.GROUP);
}
@Override
protected Subject<?, ?, ?> deprovision(final Subject<?, ?, ?> sbj) {
- final GroupTO before = groupTransfer.getGroupTO(Group.class.cast(sbj));
+ final GroupTO before = groupDataBinder.getGroupTO(Group.class.cast(sbj));
final List<String> noPropResources = new ArrayList<>(before.getResources());
noPropResources.remove(profile.getTask().getResource().getKey());
- taskExecutor.execute(propagationManager.getGroupDeleteTaskIds(before.getKey(), noPropResources));
+ taskExecutor.execute(propagationManager.getGroupDeleteTasks(before.getKey(), noPropResources));
return groupDAO.authFetch(before.getKey());
}
@Override
protected Subject<?, ?, ?> provision(final Subject<?, ?, ?> sbj, final Boolean enabled) {
- final GroupTO before = groupTransfer.getGroupTO(Group.class.cast(sbj));
+ final GroupTO before = groupDataBinder.getGroupTO(Group.class.cast(sbj));
final List<String> noPropResources = new ArrayList<>(before.getResources());
noPropResources.remove(profile.getTask().getResource().getKey());
@@ -67,7 +67,7 @@ public class GroupPushResultHandlerImpl extends AbstractPushResultHandler implem
final PropagationByResource propByRes = new PropagationByResource();
propByRes.add(ResourceOperation.CREATE, profile.getTask().getResource().getKey());
- taskExecutor.execute(propagationManager.getGroupCreateTaskIds(
+ taskExecutor.execute(propagationManager.getGroupCreateTasks(
before.getKey(),
Collections.unmodifiableCollection(before.getVirAttrs()),
propByRes,
@@ -118,7 +118,7 @@ public class GroupPushResultHandlerImpl extends AbstractPushResultHandler implem
@Override
protected AbstractSubjectTO getSubjectTO(final long key) {
try {
- return groupTransfer.getGroupTO(key);
+ return groupDataBinder.getGroupTO(key);
} catch (Exception e) {
LOG.warn("Error retrieving user {}", key, e);
return null;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
index b52cc0c..36e3215 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
@@ -30,7 +30,7 @@ import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
import org.apache.syncope.core.provisioning.api.sync.GroupSyncResultHandler;
import org.identityconnectors.framework.common.objects.SyncDelta;
@@ -45,8 +45,8 @@ public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implem
}
@Override
- protected AttributableUtil getAttributableUtil() {
- return attrUtilFactory.getInstance(AttributableType.GROUP);
+ protected AttributableUtils getAttributableUtils() {
+ return attrUtilsFactory.getInstance(AttributableType.GROUP);
}
@Override
@@ -57,7 +57,7 @@ public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implem
@Override
protected AbstractSubjectTO getSubjectTO(final long key) {
try {
- return groupTransfer.getGroupTO(key);
+ return groupDataBinder.getGroupTO(key);
} catch (Exception e) {
LOG.warn("Error retrieving group {}", key, e);
return null;
@@ -68,12 +68,12 @@ public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implem
protected AbstractSubjectMod getSubjectMod(
final AbstractSubjectTO subjectTO, final SyncDelta delta) {
- return connObjectUtil.getAttributableMod(
+ return connObjectUtils.getAttributableMod(
subjectTO.getKey(),
delta.getObject(),
subjectTO,
profile.getTask(),
- attrUtilFactory.getInstance(AttributableType.GROUP));
+ attrUtilsFactory.getInstance(AttributableType.GROUP));
}
@Override
@@ -85,7 +85,7 @@ public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implem
Map.Entry<Long, List<PropagationStatus>> created = groupProvisioningManager.create(groupTO, groupOwnerMap,
Collections.singleton(profile.getTask().getResource().getKey()));
- groupTO = groupTransfer.getGroupTO(created.getKey());
+ groupTO = groupDataBinder.getGroupTO(created.getKey());
result.setId(created.getKey());
result.setName(getName(subjectTO));
@@ -108,7 +108,7 @@ public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implem
groupMod.getResourcesToAdd().add(profile.getTask().getResource().getKey());
}
- return groupTransfer.getGroupTO(gwfAdapter.update(groupMod).getResult());
+ return groupDataBinder.getGroupTO(gwfAdapter.update(groupMod).getResult());
}
@Override
@@ -133,7 +133,7 @@ public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implem
groupOwnerMap.put(updated.getKey(), groupOwner);
}
- final GroupTO after = groupTransfer.getGroupTO(updated.getKey());
+ final GroupTO after = groupDataBinder.getGroupTO(updated.getKey());
result.setName(getName(after));
@@ -143,7 +143,7 @@ public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implem
@Override
protected void deprovision(final Long id, final boolean unlink) {
taskExecutor.execute(
- propagationManager.getGroupDeleteTaskIds(id, profile.getTask().getResource().getKey()));
+ propagationManager.getGroupDeleteTasks(id, profile.getTask().getResource().getKey()));
if (unlink) {
final UserMod userMod = new UserMod();
@@ -156,7 +156,7 @@ public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implem
protected void delete(final Long id) {
try {
taskExecutor.execute(
- propagationManager.getGroupDeleteTaskIds(id, profile.getTask().getResource().getKey()));
+ propagationManager.getGroupDeleteTasks(id, profile.getTask().getResource().getKey()));
} catch (Exception e) {
// A propagation failure doesn't imply a synchronization failure.
// The propagation exception status will be reported into the propagation task execution.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
index 526b494..fc68ec0 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.AbstractSubjectMod;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.UserMod;
@@ -87,7 +88,7 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
private AuditManager auditManager;
@Autowired
- private SyncUtilities syncUtilities;
+ private SyncUtils syncUtilities;
protected Map<Long, Long> membersBeforeGroupUpdate = Collections.<Long, Long>emptyMap();
@@ -205,12 +206,12 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
Result result;
- WorkflowResult<Map.Entry<UserMod, Boolean>> updated = null;
+ WorkflowResult<Pair<UserMod, Boolean>> updated = null;
try {
updated = uwfAdapter.update(userMod);
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(
updated, false, Collections.singleton(resourceName));
taskExecutor.execute(tasks);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PushJobImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PushJobImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PushJobImpl.java
index 5716eb7..7bec3af 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PushJobImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PushJobImpl.java
@@ -20,10 +20,9 @@ package org.apache.syncope.core.provisioning.java.sync;
import java.util.Collections;
import java.util.List;
-import java.util.Set;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
@@ -83,8 +82,6 @@ public class PushJobImpl extends AbstractProvisioningJob<PushTask, PushActions>
final boolean dryRun) throws JobExecutionException {
LOG.debug("Execute synchronization (push) with resource {}", pushTask.getResource());
- final Set<Long> authorizations = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
-
final ProvisioningProfile<PushTask, PushActions> profile = new ProvisioningProfile<>(connector, pushTask);
if (actions != null) {
profile.getActions().addAll(actions);
@@ -109,9 +106,13 @@ public class PushJobImpl extends AbstractProvisioningJob<PushTask, PushActions>
}
if (uMapping != null) {
- final int count = userDAO.count(authorizations);
+ final int count = userDAO.count(SyncopeConstants.FULL_ADMIN_REALMS);
for (int page = 1; page <= (count / PAGE_SIZE) + 1; page++) {
- final List<User> localUsers = getUsers(authorizations, pushTask, page);
+ final List<User> localUsers = StringUtils.isBlank(pushTask.getUserFilter())
+ ? userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, page, PAGE_SIZE)
+ : searchDAO.<User>search(SyncopeConstants.FULL_ADMIN_REALMS,
+ SearchCondConverter.convert(pushTask.getUserFilter()),
+ Collections.<OrderByClause>emptyList(), SubjectType.USER);
for (User localUser : localUsers) {
try {
@@ -126,15 +127,22 @@ public class PushJobImpl extends AbstractProvisioningJob<PushTask, PushActions>
}
if (rMapping != null) {
- final List<Group> localGroups = geGroups(authorizations, pushTask);
-
- for (Group localGroup : localGroups) {
- try {
- // group propagation
- rhandler.handle(localGroup.getKey());
- } catch (Exception e) {
- LOG.warn("Failure pushing group '{}' on '{}'", localGroup, pushTask.getResource(), e);
- throw new JobExecutionException("While pushing groups on connector", e);
+ final int count = groupDAO.count(SyncopeConstants.FULL_ADMIN_REALMS);
+ for (int page = 1; page <= (count / PAGE_SIZE) + 1; page++) {
+ final List<Group> localGroups = StringUtils.isBlank(pushTask.getGroupFilter())
+ ? groupDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, page, PAGE_SIZE)
+ : searchDAO.<Group>search(SyncopeConstants.FULL_ADMIN_REALMS,
+ SearchCondConverter.convert(pushTask.getGroupFilter()),
+ Collections.<OrderByClause>emptyList(), SubjectType.GROUP);
+
+ for (Group localGroup : localGroups) {
+ try {
+ // group propagation
+ rhandler.handle(localGroup.getKey());
+ } catch (Exception e) {
+ LOG.warn("Failure pushing group '{}' on '{}'", localGroup, pushTask.getResource(), e);
+ throw new JobExecutionException("While pushing groups on connector", e);
+ }
}
}
}
@@ -151,25 +159,4 @@ public class PushJobImpl extends AbstractProvisioningJob<PushTask, PushActions>
return result;
}
-
- private List<User> getUsers(final Set<Long> authorizations, final PushTask pushTask, final int page) {
- final String filter = pushTask.getUserFilter();
- if (StringUtils.isBlank(filter)) {
- return userDAO.findAll(authorizations, page, PAGE_SIZE);
- } else {
- return searchDAO.<User>search(
- authorizations, SearchCondConverter.convert(filter),
- Collections.<OrderByClause>emptyList(), SubjectType.USER);
- }
- }
-
- private List<Group> geGroups(final Set<Long> authorizations, final PushTask pushTask) {
- final String filter = pushTask.getGroupFilter();
- if (StringUtils.isBlank(filter)) {
- return groupDAO.findAll();
- } else {
- return searchDAO.<Group>search(authorizations, SearchCondConverter.convert(filter),
- Collections.<OrderByClause>emptyList(), SubjectType.GROUP);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobImpl.java
index 9b49d6a..28cd5b4 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobImpl.java
@@ -25,7 +25,6 @@ import org.apache.syncope.common.lib.mod.GroupMod;
import org.apache.syncope.common.lib.types.SyncPolicySpec;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
import org.apache.syncope.core.persistence.api.entity.group.GMapping;
import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
@@ -33,7 +32,7 @@ import org.apache.syncope.core.persistence.api.entity.user.UMapping;
import org.apache.syncope.core.provisioning.api.Connector;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningProfile;
import org.apache.syncope.core.provisioning.api.sync.SyncActions;
-import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
+import org.apache.syncope.core.misc.security.UnauthorizedException;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.provisioning.api.job.SyncJob;
import org.apache.syncope.core.provisioning.api.sync.GroupSyncResultHandler;
@@ -60,10 +59,10 @@ public class SyncJobImpl extends AbstractProvisioningJob<SyncTask, SyncActions>
private GroupWorkflowAdapter gwfAdapter;
@Autowired
- protected SyncUtilities syncUtilities;
+ protected SyncUtils syncUtilities;
protected void setGroupOwners(final GroupSyncResultHandler rhandler)
- throws UnauthorizedGroupException, NotFoundException {
+ throws UnauthorizedException, NotFoundException {
for (Map.Entry<Long, String> entry : rhandler.getGroupOwnerMap().entrySet()) {
GroupMod groupMod = new GroupMod();
@@ -193,7 +192,7 @@ public class SyncJobImpl extends AbstractProvisioningJob<SyncTask, SyncActions>
}
}
- final String result = createReport(profile.getResults(), syncTask.getResource().getSyncTraceLevel(), dryRun);
+ String result = createReport(profile.getResults(), syncTask.getResource().getSyncTraceLevel(), dryRun);
LOG.debug("Sync result: {}", result);
@@ -204,11 +203,9 @@ public class SyncJobImpl extends AbstractProvisioningJob<SyncTask, SyncActions>
SyncPolicySpec syncPolicySpec;
if (task instanceof SyncTask) {
- final SyncPolicy syncPolicy = task.getResource().getSyncPolicy() == null
- ? policyDAO.getGlobalSyncPolicy()
- : task.getResource().getSyncPolicy();
-
- syncPolicySpec = syncPolicy == null ? null : syncPolicy.getSpecification(SyncPolicySpec.class);
+ syncPolicySpec = task.getResource().getSyncPolicy() == null
+ ? null
+ : task.getResource().getSyncPolicy().getSpecification(SyncPolicySpec.class);
} else {
syncPolicySpec = null;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtilities.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtilities.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtilities.java
deleted file mode 100644
index 7f89474..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtilities.java
+++ /dev/null
@@ -1,419 +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.provisioning.java.sync;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.common.lib.types.SyncPolicySpec;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.dao.SubjectDAO;
-import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.core.persistence.api.dao.search.SubjectCond;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
-import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.Subject;
-import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
-import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
-import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.provisioning.api.Connector;
-import org.apache.syncope.core.provisioning.api.sync.SyncCorrelationRule;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeUtil;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.OperationalAttributes;
-import org.identityconnectors.framework.common.objects.filter.EqualsFilter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class SyncUtilities {
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(SyncUtilities.class);
-
- /**
- * Policy DAO.
- */
- @Autowired
- protected PolicyDAO policyDAO;
-
- /**
- * Entitlement DAO.
- */
- @Autowired
- protected EntitlementDAO entitlementDAO;
-
- /**
- * Schema DAO.
- */
- @Autowired
- protected PlainSchemaDAO plainSchemaDAO;
-
- /**
- * User DAO.
- */
- @Autowired
- protected UserDAO userDAO;
-
- /**
- * Group DAO.
- */
- @Autowired
- protected GroupDAO groupDAO;
-
- /**
- * Search DAO.
- */
- @Autowired
- protected SubjectSearchDAO searchDAO;
-
- @Autowired
- protected AttributableUtilFactory attrUtilFactory;
-
- public Long findMatchingAttributableKey(
- final ObjectClass oclass,
- final String name,
- final ExternalResource resource,
- final Connector connector) {
-
- Long result = null;
-
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(oclass);
-
- final List<ConnectorObject> found = connector.search(oclass,
- new EqualsFilter(new Name(name)), connector.getOperationOptions(
- attrUtil.getMappingItems(resource, MappingPurpose.SYNCHRONIZATION)));
-
- if (found.isEmpty()) {
- LOG.debug("No {} found on {} with __NAME__ {}", oclass, resource, name);
- } else {
- if (found.size() > 1) {
- LOG.warn("More than one {} found on {} with __NAME__ {} - taking first only", oclass, resource, name);
- }
-
- ConnectorObject connObj = found.iterator().next();
- try {
- List<Long> subjectKeys = findExisting(connObj.getUid().getUidValue(), connObj, resource, attrUtil);
- if (subjectKeys.isEmpty()) {
- LOG.debug("No matching {} found for {}, aborting", attrUtil.getType(), connObj);
- } else {
- if (subjectKeys.size() > 1) {
- LOG.warn("More than one {} found {} - taking first only", attrUtil.getType(), subjectKeys);
- }
-
- result = subjectKeys.iterator().next();
- }
- } catch (IllegalArgumentException e) {
- LOG.warn(e.getMessage());
- }
- }
-
- return result;
- }
-
- private SubjectDAO<?, ?, ?> getSubjectDAO(final MappingItem accountIdItem) {
- return AttributableType.USER == accountIdItem.getIntMappingType().getAttributableType() ? userDAO : groupDAO;
- }
-
- private List<Long> findByAccountIdItem(
- final String uid, final ExternalResource resource, final AttributableUtil attrUtil) {
- final List<Long> result = new ArrayList<>();
-
- final MappingItem accountIdItem = attrUtil.getAccountIdItem(resource);
- switch (accountIdItem.getIntMappingType()) {
- case UserPlainSchema:
- case GroupPlainSchema:
- final PlainAttrValue value = attrUtil.newPlainAttrValue();
-
- PlainSchema schema = plainSchemaDAO.find(accountIdItem.getIntAttrName(), attrUtil.plainSchemaClass());
- if (schema == null) {
- value.setStringValue(uid);
- } else {
- try {
- value.parseValue(schema, uid);
- } catch (ParsingValidationException e) {
- LOG.error("While parsing provided __UID__ {}", uid, e);
- value.setStringValue(uid);
- }
- }
-
- List<? extends Subject<?, ?, ?>> subjects =
- getSubjectDAO(accountIdItem).findByAttrValue(accountIdItem.getIntAttrName(), value, attrUtil);
- for (Subject<?, ?, ?> subject : subjects) {
- result.add(subject.getKey());
- }
- break;
-
- case UserDerivedSchema:
- case GroupDerivedSchema:
- subjects = getSubjectDAO(accountIdItem).
- findByDerAttrValue(accountIdItem.getIntAttrName(), uid, attrUtil);
- for (Subject<?, ?, ?> subject : subjects) {
- result.add(subject.getKey());
- }
- break;
-
- case Username:
- User user = userDAO.find(uid);
- if (user != null) {
- result.add(user.getKey());
- }
- break;
-
- case UserId:
- user = userDAO.find(Long.parseLong(uid));
- if (user != null) {
- result.add(user.getKey());
- }
- break;
-
- case GroupName:
- List<Group> groups = groupDAO.find(uid);
- for (Group group : groups) {
- result.add(group.getKey());
- }
- break;
-
- case GroupId:
- Group group = groupDAO.find(Long.parseLong(uid));
- if (group != null) {
- result.add(group.getKey());
- }
- break;
-
- default:
- LOG.error("Invalid accountId type '{}'", accountIdItem.getIntMappingType());
- }
-
- return result;
- }
-
- private List<Long> search(final SearchCond searchCond, final SubjectType type) {
- final List<Long> result = new ArrayList<>();
-
- List<Subject<?, ?, ?>> subjects = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
- searchCond, Collections.<OrderByClause>emptyList(), type);
- for (Subject<?, ?, ?> subject : subjects) {
- result.add(subject.getKey());
- }
-
- return result;
- }
-
- private List<Long> findByCorrelationRule(
- final ConnectorObject connObj, final SyncCorrelationRule rule, final SubjectType type) {
-
- return search(rule.getSearchCond(connObj), type);
- }
-
- private List<Long> findByAttributableSearch(
- final ConnectorObject connObj,
- final List<String> altSearchSchemas,
- final ExternalResource resource,
- final AttributableUtil attrUtil) {
-
- // search for external attribute's name/value of each specified name
- final Map<String, Attribute> extValues = new HashMap<>();
-
- for (MappingItem item : attrUtil.getMappingItems(resource, MappingPurpose.SYNCHRONIZATION)) {
- extValues.put(item.getIntAttrName(), connObj.getAttributeByName(item.getExtAttrName()));
- }
-
- // search for user/group by attribute(s) specified in the policy
- SearchCond searchCond = null;
-
- for (String schema : altSearchSchemas) {
- Attribute value = extValues.get(schema);
-
- if (value == null) {
- throw new IllegalArgumentException(
- "Connector object does not contains the attributes to perform the search: " + schema);
- }
-
- AttributeCond.Type type;
- String expression = null;
-
- if (value.getValue() == null || value.getValue().isEmpty()
- || (value.getValue().size() == 1 && value.getValue().get(0) == null)) {
-
- type = AttributeCond.Type.ISNULL;
- } else {
- type = AttributeCond.Type.EQ;
- expression = value.getValue().size() > 1
- ? value.getValue().toString()
- : value.getValue().get(0).toString();
- }
-
- SearchCond nodeCond;
- // users: just id or username can be selected to be used
- // groups: just id or name can be selected to be used
- if ("key".equalsIgnoreCase(schema)
- || "username".equalsIgnoreCase(schema) || "name".equalsIgnoreCase(schema)) {
-
- SubjectCond cond = new SubjectCond();
- cond.setSchema(schema);
- cond.setType(type);
- cond.setExpression(expression);
-
- nodeCond = SearchCond.getLeafCond(cond);
- } else {
- AttributeCond cond = new AttributeCond();
- cond.setSchema(schema);
- cond.setType(type);
- cond.setExpression(expression);
-
- nodeCond = SearchCond.getLeafCond(cond);
- }
-
- searchCond = searchCond == null
- ? nodeCond
- : SearchCond.getAndCond(searchCond, nodeCond);
- }
-
- return search(searchCond, SubjectType.valueOf(attrUtil.getType().name()));
- }
-
- private SyncCorrelationRule getCorrelationRule(final AttributableType type, final SyncPolicySpec policySpec) {
- String clazz;
-
- switch (type) {
- case USER:
- clazz = policySpec.getUserJavaRule();
- break;
- case GROUP:
- clazz = policySpec.getGroupJavaRule();
- break;
- case MEMBERSHIP:
- case CONFIGURATION:
- default:
- clazz = null;
- }
-
- SyncCorrelationRule res = null;
-
- if (StringUtils.isNotBlank(clazz)) {
- try {
- res = (SyncCorrelationRule) Class.forName(clazz).newInstance();
- } catch (Exception e) {
- LOG.error("Failure instantiating correlation rule class '{}'", clazz, e);
- }
- }
-
- return res;
- }
-
- private List<String> getAltSearchSchemas(final AttributableType type, final SyncPolicySpec policySpec) {
- List<String> result = Collections.emptyList();
-
- switch (type) {
- case USER:
- result = policySpec.getuAltSearchSchemas();
- break;
- case GROUP:
- result = policySpec.getrAltSearchSchemas();
- break;
- case MEMBERSHIP:
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- /**
- * Find users / groups based on mapped uid value (or previous uid value, if updated).
- *
- * @param uid for finding by account id
- * @param connObj for finding by attribute value
- * @param resource external resource
- * @param attrUtil attributable util
- * @return list of matching users / groups
- */
- public List<Long> findExisting(
- final String uid,
- final ConnectorObject connObj,
- final ExternalResource resource,
- final AttributableUtil attrUtil) {
-
- SyncPolicySpec syncPolicySpec = null;
- if (resource.getSyncPolicy() == null) {
- SyncPolicy globalSP = policyDAO.getGlobalSyncPolicy();
- if (globalSP != null) {
- syncPolicySpec = globalSP.getSpecification(SyncPolicySpec.class);
- }
- } else {
- syncPolicySpec = resource.getSyncPolicy().getSpecification(SyncPolicySpec.class);
- }
-
- SyncCorrelationRule syncRule = null;
- List<String> altSearchSchemas = null;
-
- if (syncPolicySpec != null) {
- syncRule = getCorrelationRule(attrUtil.getType(), syncPolicySpec);
- altSearchSchemas = getAltSearchSchemas(attrUtil.getType(), syncPolicySpec);
- }
-
- return syncRule == null ? altSearchSchemas == null || altSearchSchemas.isEmpty()
- ? findByAccountIdItem(uid, resource, attrUtil)
- : findByAttributableSearch(connObj, altSearchSchemas, resource, attrUtil)
- : findByCorrelationRule(connObj, syncRule, SubjectType.valueOf(attrUtil.getType().name()));
- }
-
- public Boolean readEnabled(final ConnectorObject connectorObject, final ProvisioningTask task) {
- Boolean enabled = null;
- if (task.isSyncStatus()) {
- Attribute status = AttributeUtil.find(OperationalAttributes.ENABLE_NAME, connectorObject.getAttributes());
- if (status != null && status.getValue() != null && !status.getValue().isEmpty()) {
- enabled = (Boolean) status.getValue().get(0);
- }
- }
-
- return enabled;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
new file mode 100644
index 0000000..7dabe8f
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
@@ -0,0 +1,403 @@
+/*
+ * 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.provisioning.java.sync;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.common.lib.types.SyncPolicySpec;
+import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
+import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
+import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.dao.SubjectDAO;
+import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
+import org.apache.syncope.core.persistence.api.dao.UserDAO;
+import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
+import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
+import org.apache.syncope.core.persistence.api.dao.search.SubjectCond;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.Subject;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.provisioning.api.Connector;
+import org.apache.syncope.core.provisioning.api.sync.SyncCorrelationRule;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeUtil;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.OperationalAttributes;
+import org.identityconnectors.framework.common.objects.filter.EqualsFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SyncUtils {
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(SyncUtils.class);
+
+ /**
+ * Policy DAO.
+ */
+ @Autowired
+ protected PolicyDAO policyDAO;
+
+ /**
+ * Schema DAO.
+ */
+ @Autowired
+ protected PlainSchemaDAO plainSchemaDAO;
+
+ /**
+ * User DAO.
+ */
+ @Autowired
+ protected UserDAO userDAO;
+
+ /**
+ * Group DAO.
+ */
+ @Autowired
+ protected GroupDAO groupDAO;
+
+ /**
+ * Search DAO.
+ */
+ @Autowired
+ protected SubjectSearchDAO searchDAO;
+
+ @Autowired
+ protected AttributableUtilsFactory attrUtilsFactory;
+
+ public Long findMatchingAttributableKey(
+ final ObjectClass oclass,
+ final String name,
+ final ExternalResource resource,
+ final Connector connector) {
+
+ Long result = null;
+
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(oclass);
+
+ final List<ConnectorObject> found = connector.search(oclass,
+ new EqualsFilter(new Name(name)), connector.getOperationOptions(
+ attrUtils.getMappingItems(resource, MappingPurpose.SYNCHRONIZATION)));
+
+ if (found.isEmpty()) {
+ LOG.debug("No {} found on {} with __NAME__ {}", oclass, resource, name);
+ } else {
+ if (found.size() > 1) {
+ LOG.warn("More than one {} found on {} with __NAME__ {} - taking first only", oclass, resource, name);
+ }
+
+ ConnectorObject connObj = found.iterator().next();
+ try {
+ List<Long> subjectKeys = findExisting(connObj.getUid().getUidValue(), connObj, resource, attrUtils);
+ if (subjectKeys.isEmpty()) {
+ LOG.debug("No matching {} found for {}, aborting", attrUtils.getType(), connObj);
+ } else {
+ if (subjectKeys.size() > 1) {
+ LOG.warn("More than one {} found {} - taking first only", attrUtils.getType(), subjectKeys);
+ }
+
+ result = subjectKeys.iterator().next();
+ }
+ } catch (IllegalArgumentException e) {
+ LOG.warn(e.getMessage());
+ }
+ }
+
+ return result;
+ }
+
+ private SubjectDAO<?, ?, ?> getSubjectDAO(final MappingItem accountIdItem) {
+ return AttributableType.USER == accountIdItem.getIntMappingType().getAttributableType() ? userDAO : groupDAO;
+ }
+
+ private List<Long> findByAccountIdItem(
+ final String uid, final ExternalResource resource, final AttributableUtils attrUtils) {
+ final List<Long> result = new ArrayList<>();
+
+ final MappingItem accountIdItem = attrUtils.getAccountIdItem(resource);
+ switch (accountIdItem.getIntMappingType()) {
+ case UserPlainSchema:
+ case GroupPlainSchema:
+ final PlainAttrValue value = attrUtils.newPlainAttrValue();
+
+ PlainSchema schema = plainSchemaDAO.find(accountIdItem.getIntAttrName(), attrUtils.plainSchemaClass());
+ if (schema == null) {
+ value.setStringValue(uid);
+ } else {
+ try {
+ value.parseValue(schema, uid);
+ } catch (ParsingValidationException e) {
+ LOG.error("While parsing provided __UID__ {}", uid, e);
+ value.setStringValue(uid);
+ }
+ }
+
+ List<? extends Subject<?, ?, ?>> subjects =
+ getSubjectDAO(accountIdItem).findByAttrValue(accountIdItem.getIntAttrName(), value, attrUtils);
+ for (Subject<?, ?, ?> subject : subjects) {
+ result.add(subject.getKey());
+ }
+ break;
+
+ case UserDerivedSchema:
+ case GroupDerivedSchema:
+ subjects = getSubjectDAO(accountIdItem).
+ findByDerAttrValue(accountIdItem.getIntAttrName(), uid, attrUtils);
+ for (Subject<?, ?, ?> subject : subjects) {
+ result.add(subject.getKey());
+ }
+ break;
+
+ case Username:
+ User user = userDAO.find(uid);
+ if (user != null) {
+ result.add(user.getKey());
+ }
+ break;
+
+ case UserId:
+ user = userDAO.find(Long.parseLong(uid));
+ if (user != null) {
+ result.add(user.getKey());
+ }
+ break;
+
+ case GroupName:
+ Group group = groupDAO.find(uid);
+ if (group != null) {
+ result.add(group.getKey());
+ }
+ break;
+
+ case GroupId:
+ group = groupDAO.find(Long.parseLong(uid));
+ if (group != null) {
+ result.add(group.getKey());
+ }
+ break;
+
+ default:
+ LOG.error("Invalid accountId type '{}'", accountIdItem.getIntMappingType());
+ }
+
+ return result;
+ }
+
+ private List<Long> search(final SearchCond searchCond, final SubjectType type) {
+ final List<Long> result = new ArrayList<>();
+
+ List<Subject<?, ?, ?>> subjects = searchDAO.search(
+ SyncopeConstants.FULL_ADMIN_REALMS, searchCond, Collections.<OrderByClause>emptyList(), type);
+ for (Subject<?, ?, ?> subject : subjects) {
+ result.add(subject.getKey());
+ }
+
+ return result;
+ }
+
+ private List<Long> findByCorrelationRule(
+ final ConnectorObject connObj, final SyncCorrelationRule rule, final SubjectType type) {
+
+ return search(rule.getSearchCond(connObj), type);
+ }
+
+ private List<Long> findByAttributableSearch(
+ final ConnectorObject connObj,
+ final List<String> altSearchSchemas,
+ final ExternalResource resource,
+ final AttributableUtils attrUtils) {
+
+ // search for external attribute's name/value of each specified name
+ final Map<String, Attribute> extValues = new HashMap<>();
+
+ for (MappingItem item : attrUtils.getMappingItems(resource, MappingPurpose.SYNCHRONIZATION)) {
+ extValues.put(item.getIntAttrName(), connObj.getAttributeByName(item.getExtAttrName()));
+ }
+
+ // search for user/group by attribute(s) specified in the policy
+ SearchCond searchCond = null;
+
+ for (String schema : altSearchSchemas) {
+ Attribute value = extValues.get(schema);
+
+ if (value == null) {
+ throw new IllegalArgumentException(
+ "Connector object does not contains the attributes to perform the search: " + schema);
+ }
+
+ AttributeCond.Type type;
+ String expression = null;
+
+ if (value.getValue() == null || value.getValue().isEmpty()
+ || (value.getValue().size() == 1 && value.getValue().get(0) == null)) {
+
+ type = AttributeCond.Type.ISNULL;
+ } else {
+ type = AttributeCond.Type.EQ;
+ expression = value.getValue().size() > 1
+ ? value.getValue().toString()
+ : value.getValue().get(0).toString();
+ }
+
+ SearchCond nodeCond;
+ // users: just id or username can be selected to be used
+ // groups: just id or name can be selected to be used
+ if ("key".equalsIgnoreCase(schema)
+ || "username".equalsIgnoreCase(schema) || "name".equalsIgnoreCase(schema)) {
+
+ SubjectCond cond = new SubjectCond();
+ cond.setSchema(schema);
+ cond.setType(type);
+ cond.setExpression(expression);
+
+ nodeCond = SearchCond.getLeafCond(cond);
+ } else {
+ AttributeCond cond = new AttributeCond();
+ cond.setSchema(schema);
+ cond.setType(type);
+ cond.setExpression(expression);
+
+ nodeCond = SearchCond.getLeafCond(cond);
+ }
+
+ searchCond = searchCond == null
+ ? nodeCond
+ : SearchCond.getAndCond(searchCond, nodeCond);
+ }
+
+ return search(searchCond, SubjectType.valueOf(attrUtils.getType().name()));
+ }
+
+ private SyncCorrelationRule getCorrelationRule(final AttributableType type, final SyncPolicySpec policySpec) {
+ String clazz;
+
+ switch (type) {
+ case USER:
+ clazz = policySpec.getUserJavaRule();
+ break;
+ case GROUP:
+ clazz = policySpec.getGroupJavaRule();
+ break;
+ case MEMBERSHIP:
+ case CONFIGURATION:
+ default:
+ clazz = null;
+ }
+
+ SyncCorrelationRule res = null;
+
+ if (StringUtils.isNotBlank(clazz)) {
+ try {
+ res = (SyncCorrelationRule) Class.forName(clazz).newInstance();
+ } catch (Exception e) {
+ LOG.error("Failure instantiating correlation rule class '{}'", clazz, e);
+ }
+ }
+
+ return res;
+ }
+
+ private List<String> getAltSearchSchemas(final AttributableType type, final SyncPolicySpec policySpec) {
+ List<String> result = Collections.emptyList();
+
+ switch (type) {
+ case USER:
+ result = policySpec.getuAltSearchSchemas();
+ break;
+ case GROUP:
+ result = policySpec.getrAltSearchSchemas();
+ break;
+ case MEMBERSHIP:
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ /**
+ * Find users / groups based on mapped uid value (or previous uid value, if updated).
+ *
+ * @param uid for finding by account id
+ * @param connObj for finding by attribute value
+ * @param resource external resource
+ * @param attrUtils attributable util
+ * @return list of matching users / groups
+ */
+ public List<Long> findExisting(
+ final String uid,
+ final ConnectorObject connObj,
+ final ExternalResource resource,
+ final AttributableUtils attrUtils) {
+
+ SyncPolicySpec syncPolicySpec = null;
+ if (resource.getSyncPolicy() != null) {
+ syncPolicySpec = resource.getSyncPolicy().getSpecification(SyncPolicySpec.class);
+ }
+
+ SyncCorrelationRule syncRule = null;
+ List<String> altSearchSchemas = null;
+
+ if (syncPolicySpec != null) {
+ syncRule = getCorrelationRule(attrUtils.getType(), syncPolicySpec);
+ altSearchSchemas = getAltSearchSchemas(attrUtils.getType(), syncPolicySpec);
+ }
+
+ return syncRule == null ? altSearchSchemas == null || altSearchSchemas.isEmpty()
+ ? findByAccountIdItem(uid, resource, attrUtils)
+ : findByAttributableSearch(connObj, altSearchSchemas, resource, attrUtils)
+ : findByCorrelationRule(connObj, syncRule, SubjectType.valueOf(attrUtils.getType().name()));
+ }
+
+ public Boolean readEnabled(final ConnectorObject connectorObject, final ProvisioningTask task) {
+ Boolean enabled = null;
+ if (task.isSyncStatus()) {
+ Attribute status = AttributeUtil.find(OperationalAttributes.ENABLE_NAME, connectorObject.getAttributes());
+ if (status != null && status.getValue() != null && !status.getValue().isEmpty()) {
+ enabled = (Boolean) status.getValue().get(0);
+ }
+ }
+
+ return enabled;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserPushResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserPushResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserPushResultHandlerImpl.java
index 61637a4..87d72e6 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserPushResultHandlerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserPushResultHandlerImpl.java
@@ -27,7 +27,7 @@ import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.Mapping;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
import org.apache.syncope.core.persistence.api.entity.Subject;
@@ -41,18 +41,18 @@ import org.identityconnectors.framework.common.objects.Uid;
public class UserPushResultHandlerImpl extends AbstractPushResultHandler implements UserPushResultHandler {
@Override
- protected AttributableUtil getAttributableUtil() {
- return attrUtilFactory.getInstance(AttributableType.USER);
+ protected AttributableUtils getAttributableUtils() {
+ return attrUtilsFactory.getInstance(AttributableType.USER);
}
@Override
protected Subject<?, ?, ?> deprovision(final Subject<?, ?, ?> sbj) {
- final UserTO before = userTransfer.getUserTO(sbj.getKey());
+ final UserTO before = userDataBinder.getUserTO(sbj.getKey());
final List<String> noPropResources = new ArrayList<>(before.getResources());
noPropResources.remove(profile.getTask().getResource().getKey());
- taskExecutor.execute(propagationManager.getUserDeleteTaskIds(before.getKey(),
+ taskExecutor.execute(propagationManager.getUserDeleteTasks(before.getKey(),
Collections.singleton(profile.getTask().getResource().getKey()), noPropResources));
return userDAO.authFetch(before.getKey());
@@ -60,7 +60,7 @@ public class UserPushResultHandlerImpl extends AbstractPushResultHandler impleme
@Override
protected Subject<?, ?, ?> provision(final Subject<?, ?, ?> sbj, final Boolean enabled) {
- final UserTO before = userTransfer.getUserTO(sbj.getKey());
+ final UserTO before = userDataBinder.getUserTO(sbj.getKey());
final List<String> noPropResources = new ArrayList<>(before.getResources());
noPropResources.remove(profile.getTask().getResource().getKey());
@@ -68,7 +68,7 @@ public class UserPushResultHandlerImpl extends AbstractPushResultHandler impleme
final PropagationByResource propByRes = new PropagationByResource();
propByRes.add(ResourceOperation.CREATE, profile.getTask().getResource().getKey());
- taskExecutor.execute(propagationManager.getUserCreateTaskIds(
+ taskExecutor.execute(propagationManager.getUserCreateTasks(
before.getKey(),
enabled,
propByRes,
@@ -122,7 +122,7 @@ public class UserPushResultHandlerImpl extends AbstractPushResultHandler impleme
@Override
protected AbstractSubjectTO getSubjectTO(final long key) {
try {
- return userTransfer.getUserTO(key);
+ return userDataBinder.getUserTO(key);
} catch (Exception e) {
LOG.warn("Error retrieving user {}", key, e);
return null;
[23/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/rest/RoleRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/RoleRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/RoleRestClient.java
deleted file mode 100644
index 5cffe09..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/RoleRestClient.java
+++ /dev/null
@@ -1,184 +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 javax.ws.rs.core.Response;
-import org.apache.syncope.client.console.commons.status.StatusBean;
-import org.apache.syncope.client.console.commons.status.StatusUtils;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
-import org.apache.syncope.common.lib.to.ConnObjectTO;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
-import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
-import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.common.lib.wrap.ResourceName;
-import org.apache.syncope.common.rest.api.CollectionWrapper;
-import org.apache.syncope.common.rest.api.service.ResourceService;
-import org.apache.syncope.common.rest.api.service.RoleService;
-import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
-import org.springframework.stereotype.Component;
-
-/**
- * Console client for invoking Rest Role's services.
- */
-@Component
-public class RoleRestClient extends AbstractSubjectRestClient {
-
- private static final long serialVersionUID = -8549081557283519638L;
-
- @Override
- public int count() {
- return getService(RoleService.class).list(1, 1).getTotalCount();
- }
-
- public List<RoleTO> list() {
- return getService(RoleService.class).list(1, 1000).getResult();
- }
-
- @Override
- public List<RoleTO> list(final int page, final int size, final SortParam<String> sort) {
- return getService(RoleService.class).list(page, size, toOrderBy(sort)).getResult();
- }
-
- @Override
- public int searchCount(final String fiql) {
- return getService(RoleService.class).search(fiql, 1, 1).getTotalCount();
- }
-
- @Override
- public List<RoleTO> search(final String fiql, final int page, final int size, final SortParam<String> sort) {
- return getService(RoleService.class).search(fiql, page, size, toOrderBy(sort)).getResult();
- }
-
- @Override
- public ConnObjectTO getConnectorObject(final String resourceName, final Long id) {
- return getService(ResourceService.class).getConnectorObject(resourceName, SubjectType.ROLE, id);
- }
-
- public RoleTO create(final RoleTO roleTO) {
- Response response = getService(RoleService.class).create(roleTO);
- return response.readEntity(RoleTO.class);
- }
-
- public RoleTO read(final Long id) {
- return getAnonymousService(RoleService.class).read(id);
- }
-
- public RoleTO update(final String etag, final RoleMod roleMod) {
- RoleTO result;
- synchronized (this) {
- RoleService service = getService(etag, RoleService.class);
- result = service.update(roleMod.getKey(), roleMod).readEntity(RoleTO.class);
- resetClient(RoleService.class);
- }
- return result;
- }
-
- @Override
- public RoleTO delete(final String etag, final Long id) {
- RoleTO result;
- synchronized (this) {
- RoleService service = getService(etag, RoleService.class);
- result = service.delete(id).readEntity(RoleTO.class);
- resetClient(RoleService.class);
- }
- return result;
- }
-
- @Override
- public BulkActionResult bulkAction(final BulkAction action) {
- return getService(RoleService.class).bulk(action);
- }
-
- public void unlink(final String etag, final long roleId, final List<StatusBean> statuses) {
- synchronized (this) {
- RoleService service = getService(etag, RoleService.class);
- service.bulkDeassociation(roleId, ResourceDeassociationActionType.UNLINK,
- CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
- ResourceName.class));
- resetClient(RoleService.class);
- }
- }
-
- public void link(final String etag, final long roleId, final List<StatusBean> statuses) {
- synchronized (this) {
- RoleService service = getService(etag, RoleService.class);
- service.bulkAssociation(roleId, ResourceAssociationActionType.LINK,
- CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
- ResourceName.class));
- resetClient(RoleService.class);
- }
- }
-
- public BulkActionResult deprovision(final String etag, final long roleId, final List<StatusBean> statuses) {
- BulkActionResult result;
- synchronized (this) {
- RoleService service = getService(etag, RoleService.class);
- result = service.bulkDeassociation(roleId, ResourceDeassociationActionType.DEPROVISION,
- CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
- ResourceName.class)).
- readEntity(BulkActionResult.class);
- resetClient(RoleService.class);
- }
- return result;
- }
-
- public BulkActionResult provision(final String etag, final long roleId, final List<StatusBean> statuses) {
- BulkActionResult result;
- synchronized (this) {
- RoleService service = getService(etag, RoleService.class);
- result = service.bulkAssociation(roleId, ResourceAssociationActionType.PROVISION,
- CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
- ResourceName.class)).
- readEntity(BulkActionResult.class);
- resetClient(RoleService.class);
- }
- return result;
- }
-
- public BulkActionResult unassign(final String etag, final long roleId, final List<StatusBean> statuses) {
- BulkActionResult result;
- synchronized (this) {
- RoleService service = getService(etag, RoleService.class);
- result = service.bulkDeassociation(roleId, ResourceDeassociationActionType.UNASSIGN,
- CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
- ResourceName.class)).
- readEntity(BulkActionResult.class);
- resetClient(RoleService.class);
- }
- return result;
- }
-
- public BulkActionResult assign(final String etag, final long roleId, final List<StatusBean> statuses) {
- BulkActionResult result;
- synchronized (this) {
- RoleService service = getService(etag, RoleService.class);
- result = service.bulkAssociation(roleId, ResourceAssociationActionType.ASSIGN,
- CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
- ResourceName.class)).
- readEntity(BulkActionResult.class);
- resetClient(RoleService.class);
- }
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java
index 159e5d9..3e7cc44 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java
@@ -32,7 +32,7 @@ public abstract class ActionLink implements Serializable {
CREATE("create"),
EDIT("read"),
USER_TEMPLATE("read"),
- ROLE_TEMPLATE("read"),
+ GROUP_TEMPLATE("read"),
RESET("update"),
ENABLE("update"),
SEARCH("read"),
@@ -54,7 +54,7 @@ public abstract class ActionLink implements Serializable {
PROVISION("update"),
MANAGE_RESOURCES("update"),
MANAGE_USERS("update"),
- MANAGE_ROLES("update");
+ MANAGE_GROUPS("update");
private final String actionId;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java
index 8582741..35e4a65 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java
@@ -51,12 +51,12 @@ public class ActionLinksPanel extends Panel {
super.add(new Fragment("panelClaim", "emptyFragment", this));
super.add(new Fragment("panelManageResources", "emptyFragment", this));
super.add(new Fragment("panelManageUsers", "emptyFragment", this));
- super.add(new Fragment("panelManageRoles", "emptyFragment", this));
+ super.add(new Fragment("panelManageGroups", "emptyFragment", this));
super.add(new Fragment("panelCreate", "emptyFragment", this));
super.add(new Fragment("panelEdit", "emptyFragment", this));
super.add(new Fragment("panelReset", "emptyFragment", this));
super.add(new Fragment("panelUserTemplate", "emptyFragment", this));
- super.add(new Fragment("panelRoleTemplate", "emptyFragment", this));
+ super.add(new Fragment("panelGroupTemplate", "emptyFragment", this));
super.add(new Fragment("panelEnable", "emptyFragment", this));
super.add(new Fragment("panelSearch", "emptyFragment", this));
super.add(new Fragment("panelDelete", "emptyFragment", this));
@@ -149,10 +149,10 @@ public class ActionLinksPanel extends Panel {
}.feedbackPanelAutomaticReload(link.feedbackPanelAutomaticReload()));
break;
- case MANAGE_ROLES:
- fragment = new Fragment("panelManageRoles", "fragmentManageRoles", this);
+ case MANAGE_GROUPS:
+ fragment = new Fragment("panelManageGroups", "fragmentManageGroups", this);
- fragment.addOrReplace(new ClearIndicatingAjaxLink<Void>("manageRolesLink", pageRef) {
+ fragment.addOrReplace(new ClearIndicatingAjaxLink<Void>("manageGroupsLink", pageRef) {
private static final long serialVersionUID = -6957616042924610293L;
@@ -219,10 +219,10 @@ public class ActionLinksPanel extends Panel {
}.feedbackPanelAutomaticReload(link.feedbackPanelAutomaticReload()));
break;
- case ROLE_TEMPLATE:
- fragment = new Fragment("panelRoleTemplate", "fragmentRoleTemplate", this);
+ case GROUP_TEMPLATE:
+ fragment = new Fragment("panelGroupTemplate", "fragmentGroupTemplate", this);
- fragment.addOrReplace(new ClearIndicatingAjaxLink<Void>("roleTemplateLink", pageRef) {
+ fragment.addOrReplace(new ClearIndicatingAjaxLink<Void>("groupTemplateLink", pageRef) {
private static final long serialVersionUID = -7978723352517770644L;
@@ -500,8 +500,8 @@ public class ActionLinksPanel extends Panel {
super.addOrReplace(new Fragment("panelManageUsers", "emptyFragment", this));
break;
- case MANAGE_ROLES:
- super.addOrReplace(new Fragment("panelManageRoles", "emptyFragment", this));
+ case MANAGE_GROUPS:
+ super.addOrReplace(new Fragment("panelManageGroups", "emptyFragment", this));
break;
case CREATE:
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
index 949cc83..6615b14 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
@@ -124,7 +124,7 @@ public class BinaryFieldPanel extends FieldPanel<String> {
final byte[] uploadedBytes = uploadedFile.getBytes();
final String uploaded = new String(
Base64.encodeBase64(uploadedBytes),
- SyncopeConstants.DEFAULT_ENCODING);
+ SyncopeConstants.DEFAULT_CHARSET);
field.setModelObject(uploaded);
target.add(field);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/DefaultMutableTreeNodeExpansion.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/DefaultMutableTreeNodeExpansion.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/DefaultMutableTreeNodeExpansion.java
index 50db23c..fa962bc 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/DefaultMutableTreeNodeExpansion.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/DefaultMutableTreeNodeExpansion.java
@@ -24,7 +24,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import javax.swing.tree.DefaultMutableTreeNode;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.wicket.MetaDataKey;
import org.apache.wicket.Session;
@@ -57,12 +57,12 @@ public class DefaultMutableTreeNodeExpansion implements Set<DefaultMutableTreeNo
@Override
public boolean add(final DefaultMutableTreeNode node) {
- RoleTO roleTO = (RoleTO) node.getUserObject();
+ GroupTO groupTO = (GroupTO) node.getUserObject();
boolean isAdded;
if (inverse) {
- isAdded = ids.remove(roleTO.getKey());
+ isAdded = ids.remove(groupTO.getKey());
} else {
- isAdded = ids.add(roleTO.getKey());
+ isAdded = ids.add(groupTO.getKey());
}
return isAdded;
}
@@ -70,12 +70,12 @@ public class DefaultMutableTreeNodeExpansion implements Set<DefaultMutableTreeNo
@Override
public boolean remove(final Object object) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) object;
- RoleTO roleTO = (RoleTO) node.getUserObject();
+ GroupTO groupTO = (GroupTO) node.getUserObject();
boolean isRemoved;
if (inverse) {
- isRemoved = ids.add(roleTO.getKey());
+ isRemoved = ids.add(groupTO.getKey());
} else {
- isRemoved = ids.remove(roleTO.getKey());
+ isRemoved = ids.remove(groupTO.getKey());
}
return isRemoved;
}
@@ -83,12 +83,12 @@ public class DefaultMutableTreeNodeExpansion implements Set<DefaultMutableTreeNo
@Override
public boolean contains(final Object object) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) object;
- RoleTO roleTO = (RoleTO) node.getUserObject();
+ GroupTO groupTO = (GroupTO) node.getUserObject();
boolean isContained;
if (inverse) {
- isContained = !ids.contains(roleTO.getKey());
+ isContained = !ids.contains(groupTO.getKey());
} else {
- isContained = ids.contains(roleTO.getKey());
+ isContained = ids.contains(groupTO.getKey());
}
return isContained;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.java
new file mode 100644
index 0000000..0638a73
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.java
@@ -0,0 +1,121 @@
+/*
+ * 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.wicket.markup.html.tree;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import org.apache.syncope.client.console.commons.GroupTreeBuilder;
+import org.apache.syncope.client.console.commons.XMLRolesReader;
+import org.apache.syncope.client.console.pages.Groups.TreeNodeClickUpdate;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.extensions.markup.html.repeater.tree.DefaultNestedTree;
+import org.apache.wicket.extensions.markup.html.repeater.tree.ITreeProvider;
+import org.apache.wicket.extensions.markup.html.repeater.tree.NestedTree;
+import org.apache.wicket.extensions.markup.html.repeater.tree.content.Folder;
+import org.apache.wicket.extensions.markup.html.repeater.tree.theme.WindowsTheme;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+public class TreeGroupPanel extends Panel {
+
+ private static final long serialVersionUID = 1762003213871836869L;
+
+ @SpringBean
+ private GroupTreeBuilder groupTreeBuilder;
+
+ @SpringBean
+ private XMLRolesReader xmlRolesReader;
+
+ private WebMarkupContainer treeContainer;
+
+ private NestedTree<DefaultMutableTreeNode> tree;
+
+ public TreeGroupPanel(final String id) {
+ super(id);
+
+ treeContainer = new WebMarkupContainer("treeContainer");
+ treeContainer.setOutputMarkupId(true);
+ add(treeContainer);
+ updateTree();
+ }
+
+ private void updateTree() {
+ final ITreeProvider<DefaultMutableTreeNode> treeProvider = new TreeGroupProvider(groupTreeBuilder, true);
+ final DefaultMutableTreeNodeExpansionModel treeModel = new DefaultMutableTreeNodeExpansionModel();
+
+ tree = new DefaultNestedTree<DefaultMutableTreeNode>("treeTable", treeProvider, treeModel) {
+
+ private static final long serialVersionUID = 7137658050662575546L;
+
+ @Override
+ protected Component newContentComponent(final String id, final IModel<DefaultMutableTreeNode> node) {
+ final DefaultMutableTreeNode treeNode = node.getObject();
+ final GroupTO groupTO = (GroupTO) treeNode.getUserObject();
+
+ return new Folder<DefaultMutableTreeNode>(id, TreeGroupPanel.this.tree, node) {
+
+ private static final long serialVersionUID = 9046323319920426493L;
+
+ @Override
+ protected boolean isClickable() {
+ return true;
+ }
+
+ @Override
+ protected IModel<?> newLabelModel(final IModel<DefaultMutableTreeNode> model) {
+ return new Model<>(groupTO.getDisplayName());
+ }
+
+ @Override
+ protected void onClick(final AjaxRequestTarget target) {
+ super.onClick(target);
+
+ send(getPage(), Broadcast.BREADTH, new TreeNodeClickUpdate(target, groupTO.getKey()));
+ }
+ };
+ }
+ };
+ tree.add(new WindowsTheme());
+ tree.setOutputMarkupId(true);
+
+ DefaultMutableTreeNodeExpansion.get().expandAll();
+
+ MetaDataRoleAuthorizationStrategy.authorize(tree, ENABLE, xmlRolesReader.getEntitlement("Groups", "read"));
+
+ treeContainer.addOrReplace(tree);
+ }
+
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ super.onEvent(event);
+
+ if (event.getPayload() instanceof TreeNodeClickUpdate) {
+ final TreeNodeClickUpdate update = (TreeNodeClickUpdate) event.getPayload();
+ updateTree();
+ update.getTarget().add(treeContainer);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupProvider.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupProvider.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupProvider.java
new file mode 100644
index 0000000..c0b55c3
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupProvider.java
@@ -0,0 +1,43 @@
+/*
+ * 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.wicket.markup.html.tree;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import org.apache.syncope.client.console.commons.GroupTreeBuilder;
+import org.apache.wicket.extensions.markup.html.repeater.util.TreeModelProvider;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+
+public class TreeGroupProvider extends TreeModelProvider<DefaultMutableTreeNode> {
+
+ private static final long serialVersionUID = -7741964777100892335L;
+
+ public TreeGroupProvider(final GroupTreeBuilder groupTreeBuilder) {
+ this(groupTreeBuilder, false);
+ }
+
+ public TreeGroupProvider(final GroupTreeBuilder groupTreeBuilde, final boolean rootVisible) {
+ super(groupTreeBuilde.build(), rootVisible);
+ }
+
+ @Override
+ public IModel<DefaultMutableTreeNode> model(final DefaultMutableTreeNode treeNode) {
+ return new Model<DefaultMutableTreeNode>(treeNode);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRolePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRolePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRolePanel.java
deleted file mode 100644
index b0be4e9..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRolePanel.java
+++ /dev/null
@@ -1,121 +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.wicket.markup.html.tree;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import org.apache.syncope.client.console.commons.RoleTreeBuilder;
-import org.apache.syncope.client.console.commons.XMLRolesReader;
-import org.apache.syncope.client.console.pages.Roles.TreeNodeClickUpdate;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.extensions.markup.html.repeater.tree.DefaultNestedTree;
-import org.apache.wicket.extensions.markup.html.repeater.tree.ITreeProvider;
-import org.apache.wicket.extensions.markup.html.repeater.tree.NestedTree;
-import org.apache.wicket.extensions.markup.html.repeater.tree.content.Folder;
-import org.apache.wicket.extensions.markup.html.repeater.tree.theme.WindowsTheme;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-public class TreeRolePanel extends Panel {
-
- private static final long serialVersionUID = 1762003213871836869L;
-
- @SpringBean
- private RoleTreeBuilder roleTreeBuilder;
-
- @SpringBean
- private XMLRolesReader xmlRolesReader;
-
- private WebMarkupContainer treeContainer;
-
- private NestedTree<DefaultMutableTreeNode> tree;
-
- public TreeRolePanel(final String id) {
- super(id);
-
- treeContainer = new WebMarkupContainer("treeContainer");
- treeContainer.setOutputMarkupId(true);
- add(treeContainer);
- updateTree();
- }
-
- private void updateTree() {
- final ITreeProvider<DefaultMutableTreeNode> treeProvider = new TreeRoleProvider(roleTreeBuilder, true);
- final DefaultMutableTreeNodeExpansionModel treeModel = new DefaultMutableTreeNodeExpansionModel();
-
- tree = new DefaultNestedTree<DefaultMutableTreeNode>("treeTable", treeProvider, treeModel) {
-
- private static final long serialVersionUID = 7137658050662575546L;
-
- @Override
- protected Component newContentComponent(final String id, final IModel<DefaultMutableTreeNode> node) {
- final DefaultMutableTreeNode treeNode = node.getObject();
- final RoleTO roleTO = (RoleTO) treeNode.getUserObject();
-
- return new Folder<DefaultMutableTreeNode>(id, TreeRolePanel.this.tree, node) {
-
- private static final long serialVersionUID = 9046323319920426493L;
-
- @Override
- protected boolean isClickable() {
- return true;
- }
-
- @Override
- protected IModel<?> newLabelModel(final IModel<DefaultMutableTreeNode> model) {
- return new Model<>(roleTO.getDisplayName());
- }
-
- @Override
- protected void onClick(final AjaxRequestTarget target) {
- super.onClick(target);
-
- send(getPage(), Broadcast.BREADTH, new TreeNodeClickUpdate(target, roleTO.getKey()));
- }
- };
- }
- };
- tree.add(new WindowsTheme());
- tree.setOutputMarkupId(true);
-
- DefaultMutableTreeNodeExpansion.get().expandAll();
-
- MetaDataRoleAuthorizationStrategy.authorize(tree, ENABLE, xmlRolesReader.getEntitlement("Roles", "read"));
-
- treeContainer.addOrReplace(tree);
- }
-
- @Override
- public void onEvent(final IEvent<?> event) {
- super.onEvent(event);
-
- if (event.getPayload() instanceof TreeNodeClickUpdate) {
- final TreeNodeClickUpdate update = (TreeNodeClickUpdate) event.getPayload();
- updateTree();
- update.getTarget().add(treeContainer);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRoleProvider.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRoleProvider.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRoleProvider.java
deleted file mode 100644
index 6fbe9a4..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/tree/TreeRoleProvider.java
+++ /dev/null
@@ -1,43 +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.wicket.markup.html.tree;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import org.apache.syncope.client.console.commons.RoleTreeBuilder;
-import org.apache.wicket.extensions.markup.html.repeater.util.TreeModelProvider;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-
-public class TreeRoleProvider extends TreeModelProvider<DefaultMutableTreeNode> {
-
- private static final long serialVersionUID = -7741964777100892335L;
-
- public TreeRoleProvider(final RoleTreeBuilder roleTreeBuilder) {
- this(roleTreeBuilder, false);
- }
-
- public TreeRoleProvider(final RoleTreeBuilder roleTreeBuilder, final boolean rootVisible) {
- super(roleTreeBuilder.build(), rootVisible);
- }
-
- @Override
- public IModel<DefaultMutableTreeNode> model(final DefaultMutableTreeNode treeNode) {
- return new Model<DefaultMutableTreeNode>(treeNode);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/META-INF/resources/css/style.css
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/resources/css/style.css b/client/console/src/main/resources/META-INF/resources/css/style.css
index 54d8f50..0978141 100644
--- a/client/console/src/main/resources/META-INF/resources/css/style.css
+++ b/client/console/src/main/resources/META-INF/resources/css/style.css
@@ -29,7 +29,7 @@ body {
margin: 0px 5px;
margin-top: 5px;
}
-#roletabs {
+#grouptabs {
margin: 0px 5px;
margin-top: 5px;
}
@@ -258,7 +258,7 @@ div#executions table td, div#executions table th { border: 1px solid #eee; paddi
color: #9C0;
}
-#navigationPane .roles {
+#navigationPane .groups {
color: #F90;
}
@@ -347,13 +347,13 @@ td.action{
text-align: right;
}
-.role-tree {
+.group-tree {
width: 30%;
display: block;
float: left;
}
-.roleTable {
+.groupTable {
line-height: 1.5em;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/META-INF/resources/img/actions/groups-icon.png
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/resources/img/actions/groups-icon.png b/client/console/src/main/resources/META-INF/resources/img/actions/groups-icon.png
new file mode 100644
index 0000000..9669486
Binary files /dev/null and b/client/console/src/main/resources/META-INF/resources/img/actions/groups-icon.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/META-INF/resources/img/actions/roles-icon.png
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/resources/img/actions/roles-icon.png b/client/console/src/main/resources/META-INF/resources/img/actions/roles-icon.png
deleted file mode 100644
index 9669486..0000000
Binary files a/client/console/src/main/resources/META-INF/resources/img/actions/roles-icon.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/META-INF/resources/img/menu/groups.png
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/resources/img/menu/groups.png b/client/console/src/main/resources/META-INF/resources/img/menu/groups.png
new file mode 100644
index 0000000..fba8be7
Binary files /dev/null and b/client/console/src/main/resources/META-INF/resources/img/menu/groups.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/META-INF/resources/img/menu/notsel/groups.png
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/resources/img/menu/notsel/groups.png b/client/console/src/main/resources/META-INF/resources/img/menu/notsel/groups.png
new file mode 100644
index 0000000..9b64b4b
Binary files /dev/null and b/client/console/src/main/resources/META-INF/resources/img/menu/notsel/groups.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/META-INF/resources/img/menu/notsel/roles.png
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/resources/img/menu/notsel/roles.png b/client/console/src/main/resources/META-INF/resources/img/menu/notsel/roles.png
deleted file mode 100644
index 9b64b4b..0000000
Binary files a/client/console/src/main/resources/META-INF/resources/img/menu/notsel/roles.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/META-INF/resources/img/menu/roles.png
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/resources/img/menu/roles.png b/client/console/src/main/resources/META-INF/resources/img/menu/roles.png
deleted file mode 100644
index fba8be7..0000000
Binary files a/client/console/src/main/resources/META-INF/resources/img/menu/roles.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/authorizations.xml
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/authorizations.xml b/client/console/src/main/resources/authorizations.xml
index 4610abf..8de4a1d 100644
--- a/client/console/src/main/resources/authorizations.xml
+++ b/client/console/src/main/resources/authorizations.xml
@@ -66,25 +66,25 @@ under the License.
</action>
</page>
- <page id="Roles">
+ <page id="Groups">
<action id="list">
- <entitlement>ROLE_LIST</entitlement>
+ <entitlement>GROUP_LIST</entitlement>
</action>
<action id="create">
- <entitlement>ROLE_CREATE</entitlement>
+ <entitlement>GROUP_CREATE</entitlement>
</action>
<action id="read">
- <entitlement>ROLE_READ</entitlement>
+ <entitlement>GROUP_READ</entitlement>
</action>
<action id="update">
- <entitlement>ROLE_UPDATE</entitlement>
+ <entitlement>GROUP_UPDATE</entitlement>
</action>
<action id="delete">
- <entitlement>ROLE_DELETE</entitlement>
+ <entitlement>GROUP_DELETE</entitlement>
</action>
</page>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/consoleContext.xml
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/consoleContext.xml b/client/console/src/main/resources/consoleContext.xml
index fbab64b..1acb7b4 100644
--- a/client/console/src/main/resources/consoleContext.xml
+++ b/client/console/src/main/resources/consoleContext.xml
@@ -68,7 +68,7 @@ under the License.
<property name="authorizations" value="authorizations.xml"/>
</bean>
- <bean id="roleTreeBuilder" class="org.apache.syncope.client.console.commons.RoleTreeBuilder"/>
+ <bean id="groupTreeBuilder" class="org.apache.syncope.client.console.commons.GroupTreeBuilder"/>
<bean id="syncopeClientFactory" class="org.apache.syncope.client.lib.SyncopeClientFactoryBean">
<property name="address" value="${scheme}://${host}:${port}/${rootPath}"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication.properties b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication.properties
index 83cb198..a5fe511 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
users=Users
-roles=Roles
+groups=Groups
configuration=Configuration
resources=Resources
connectors=Connectors
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication_it.properties
index 96edcee..1f1e827 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication_it.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
users=Utenti
-roles=Ruoli
+groups=Gruppi
configuration=Configurazione
resources=Risorse
connectors=Connettori
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication_pt_BR.properties
index a7e2880..de966d2 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeApplication_pt_BR.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
users=Usu\u00e1rios
-roles=Fun\u00e7\u00f5es
+groups=Grupos
configuration=Configura\u00e7\u00f5es
resources=Recursos
connectors=Conectores
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
index 1b274a9..8b7349b 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
@@ -88,8 +88,8 @@ under the License.
</span>
</li>
<li><span>
- <a href="#" wicket:id="roles"><img wicket:id="rolesIcon" alt="Roles" width="80" height="80" /><br />
- <wicket:message key="roles"/>
+ <a href="#" wicket:id="groups"><img wicket:id="groupsIcon" alt="Groups" width="80" height="80" /><br />
+ <wicket:message key="groups"/>
</a>
</span>
</li>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration.html
index 931bf2b..58a0241 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration.html
@@ -47,8 +47,8 @@ under the License.
<a href="#adminUser"><span><wicket:message key="adminUser"/></span></a>
</li>
<li><a href="#selfUser"><span><wicket:message key="selfUser"/></span></a></li>
- <li><a href="#adminRole"><span><wicket:message key="adminRole"/></span></a></li>
- <li><a href="#selfRole"><span><wicket:message key="selfRole"/></span></a></li>
+ <li><a href="#adminGroup"><span><wicket:message key="adminGroup"/></span></a></li>
+ <li><a href="#selfGroup"><span><wicket:message key="selfGroup"/></span></a></li>
<li><a href="#adminMembership"><span><wicket:message key="adminMembership"/></span></a></li>
<li><a href="#selfMembership"><span><wicket:message key="selfMembership"/></span></a></li>
</ul>
@@ -58,11 +58,11 @@ under the License.
<div id="selfUser" style="border-width: 1px;border-top-width: 0px;">
<span wicket:id="selfUserLayoutPanel">[self user layout panel]</span>
</div>
- <div id="adminRole" style="border-width: 1px;border-top-width: 0px;">
- <span wicket:id="adminRoleLayoutPanel">[admin role layout panel]</span>
+ <div id="adminGroup" style="border-width: 1px;border-top-width: 0px;">
+ <span wicket:id="adminGroupLayoutPanel">[admin group layout panel]</span>
</div>
- <div id="selfRole" style="border-width: 1px;border-top-width: 0px;">
- <span wicket:id="selfRoleLayoutPanel">[self role layout panel]</span>
+ <div id="selfGroup" style="border-width: 1px;border-top-width: 0px;">
+ <span wicket:id="selfGroupLayoutPanel">[self group layout panel]</span>
</div>
<div id="adminMembership" style="border-width: 1px;border-top-width: 0px;">
<span wicket:id="adminMembershipLayoutPanel">[admin membership layout panel]</span>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration.properties
index 19d534f..dea3e78 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration.properties
@@ -41,8 +41,8 @@ content=Text
layouts=Layouts
adminUser=Administrator User Form
selfUser=Self User Form
-adminRole=Administrator Role Form
-selfRole=Self Role Form
+adminGroup=Administrator Group Form
+selfGroup=Self Group Form
adminMembership=Administrator Membership Form
selfMembership=Self Membership Form
ext=Extensions
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration_it.properties
index 0f13761..36140b2 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration_it.properties
@@ -41,8 +41,8 @@ content=Testo
layouts=Layouts
adminUser=Form Amministrazione Utente
selfUser=Form Utente
-adminRole=Form Amministrazione Ruolo
-selfRole=Form Ruolo
+adminGroup=Form Amministrazione Gruppo
+selfGroup=Form Gruppo
adminMembership=Form Amministrazione Membership
selfMembership=Form Membership
ext=Estensioni
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration_pt_BR.properties
index 63f19b7..a39ea61 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Configuration_pt_BR.properties
@@ -41,8 +41,8 @@ content=Texto
layouts=Layouts
adminUser=Forma do usu\u00e1rio de administra\u00e7\u00e3o
selfUser=Forma Usu\u00e1rio
-adminRole=Forma Fun\u00e7\u00e3o de administra\u00e7\u00e3o
-selfRole=Form Fun\u00e7\u00e3o
+adminGroup=Forma de grupo de administra\u00e7\u00e3o
+selfGroup=Form Grupo
adminMembership=Forma de membro de administra\u00e7\u00e3o
selfMembership=Forma Membro
ext=Extens\u00f5es
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage.html
new file mode 100644
index 0000000..bbcd878
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage.html
@@ -0,0 +1,52 @@
+<!--
+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 style="margin: 5px;">
+ <p class="ui-widget ui-corner-all ui-widget-header">
+ <wicket:message key="title"/> <span wicket:id="displayName"/>
+ </p>
+ <form wicket:id="groupForm">
+ <div id="tabs">
+ <div style="display: block; clear: both">
+ <ul>
+ <li><a href="#details"><span><wicket:message key="details"/></span></a></li>
+ <li><a href="#templates"><span><wicket:message key="templates"/></span></a></li>
+ <li><a href="#plainAttrs"><span><wicket:message key="plainAttrs"/></span></a></li>
+ <li><a href="#derAttrs"><span><wicket:message key="derAttrs"/></span></a></li>
+ <li><a href="#virAttrs"><span><wicket:message key="virAttrs"/></span></a></li>
+ <li><a href="#resources"><span><wicket:message key="resources"/></span></a></li>
+ <li><a href="#entitlements"><span><wicket:message key="entitlements"/></span></a></li>
+ <li><a href="#security"><span><wicket:message key="security"/></span></a></li>
+ </ul>
+ </div>
+ <div wicket:id="groupPanel"></div>
+ </div>
+ <div style="bottom:0;margin:10px">
+ <input type="submit"
+ class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
+ wicket:id="submit"/>
+ <input type="button"
+ class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
+ wicket:id="cancel"/>
+ </div>
+ </form>
+ </div>
+ </wicket:extend>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage.properties
new file mode 100644
index 0000000..4ffa2fb
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage.properties
@@ -0,0 +1,48 @@
+# 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.
+required_alert=All form fields are required.
+title=Group
+details=Details
+plainAttrs=Plain attributes
+tab3=Derived attributes
+tab4=Virtual attributes
+resources=Resources
+entitlements=Entitlements
+security=Security
+add=+
+drop=-
+error=Generic error occurred during the operation
+firstResourcesList=Group's resources
+secondResourcesList=Available resources
+firstEntitlementsList=Group's entitlements
+secondEntitlementsList=Available entitlements
+derAttrs=Derived Attributes
+derAttrToRemove=Delete
+derAttrName=Name
+derAttrValue=Derived value
+
+virAttrs=Virtual Attributes
+virAttrToRemove=Delete
+virAttrName=Name
+virAttrValue=Virtual value
+
+addAttributeBtn=Add
+
+inheritPlainAttrs=Inherit plain attributes
+inheritDerAttrs=Inherit derived attributes
+inheritVirAttrs=Inherit virtual attributes
+templates=Templates
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage_it.properties
new file mode 100644
index 0000000..1c6efec
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage_it.properties
@@ -0,0 +1,50 @@
+# 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.
+required_alert=All form fields are required.
+title=Gruppo
+details=Dettagli
+plainAttrs=Attributi normali
+tab3=Attributi derivati
+tab4=Attributi virtuali
+resources=Risorse
+entitlements=Entitlement
+security=Sicurezza
+add=+
+drop=-
+error=Errore generico durante l'operazione
+firstResourcesList=Risorse ruolo
+secondResourcesList=Risorse disponibili
+firstResourcesList=Risorse gruppo
+secondResourcesList=Risorse disponibili
+derAttrs=Attributi derivati
+derAttrToRemove=Elimina
+derAttrName=Nome
+derAttrValue=Valore derivato
+
+virAttrs=Attributi virtuali
+virAttrToRemove=Elimina
+virAttrName=Nome
+virAttrValue=Valore virtuale
+
+addAttributeBtn=Aggiungi
+
+inheritPlainAttrs=Eredita attributi normali
+inheritDerAttrs=Eredita attributi derivati
+inheritVirAttrs=Eredita attributi virtuali
+templates=Modelo
+secondEntitlementsList=Entitlement disponibili
+firstEntitlementsList=Entitlement gruppo
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage_pt_BR.properties
new file mode 100644
index 0000000..0649585
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupModalPage_pt_BR.properties
@@ -0,0 +1,48 @@
+# 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.
+required_alert=Todos os campos s\u00e3o obrigat\u00f3rios
+title=Grupo
+details=Detalhes
+plainAttrs=Atributos Normal
+tab3=Atributos Derivados
+tab4=Atributos Virtuais
+resources=Recursos
+entitlements=Direitos
+security=Seguran\u00e7a
+add=+
+drop=-
+error=Um erro gen\u00e9rico ocorreu durante a opera\u00e7\u00e3o
+firstResourcesList=Recursos de grupos
+secondResourcesList=Recursos dispon\u00edveis
+firstEntitlementsList=Direitos de grupos
+secondEntitlementsList=Direitos dispon\u00edveis
+derAttrs=Atributos derivados
+derAttrToRemove=Exluir
+derAttrName=Nome
+derAttrValue=Valor Derivado
+
+virAttrs=Atributos Virtuais
+virAttrToRemove=Excluir
+virAttrName=Nome
+virAttrValue=Valor Virtual
+
+addAttributeBtn=Adicionar
+
+inheritPlainAttrs=Atributos Herdados Normal
+inheritDerAttrs=Atributos Derivados Herdados
+inheritVirAttrs=Atributos Virtuais Herdados
+templates=Modelli
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupSelectModalPage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupSelectModalPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupSelectModalPage.html
new file mode 100644
index 0000000..203ffa9
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/GroupSelectModalPage.html
@@ -0,0 +1,24 @@
+<!--
+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 wicket:id="treeTable"
+ style="width: 100%;display:block;margin:auto;" class="groupTable group-tree"/>
+ </wicket:extend>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups.html
new file mode 100644
index 0000000..a335c28
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups.html
@@ -0,0 +1,80 @@
+<!--
+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:head>
+ <style>
+ div.group-tree div.wicket-tree-table a {
+ color:black;
+ }
+ </style>
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $("#grouptabs").tabs();
+ });
+ </script>
+ </wicket:head>
+ <wicket:extend>
+ <div id="grouptabs">
+ <ul>
+ <li class="tabs-selected">
+ <a href="#tabs-tree">
+ <span><wicket:message key="tabs-tree"/>
+ </span>
+ </a>
+ </li>
+ <li>
+ <a href="#tabs-search">
+ <span><wicket:message key="tabs-search"/>
+ </span>
+ </a>
+ </li>
+ </ul>
+
+ <div id="tabs-tree" >
+ <div wicket:id="groupTabsContainer">
+ <span wicket:id="treePanel"></span>
+ <span wicket:id="summaryPanel"></span>
+ </div>
+ <div wicket:id="editGroupWin">[Show modal window for create/editing group]</div>
+ </div>
+
+ <div id="tabs-search">
+ <div>
+ <form wicket:id="searchForm">
+ <span wicket:id="searchPanel">searchPanel</span>
+
+ <br/>
+ <a wicket:id="search"
+ class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
+ <img src="img/search.png" alt="search"/>
+ <wicket:message key="search"/>
+ </a>
+ </form>
+ </div>
+
+ <div id="users-contain" class="ui-widget" style="width:auto">
+ <span wicket:id="searchResult">[search result]</span>
+ </div>
+ </div>
+
+ </div>
+
+ <wicket:child/>
+ </wicket:extend>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups.properties
new file mode 100644
index 0000000..bfe9385
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups.properties
@@ -0,0 +1,26 @@
+# 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.
+tabs-tree=Tree
+tabs-search=Search
+search=Search
+create_user=Create new user
+search_results_title=Search results
+search_noResults=No matches found.
+reset=Reset
+showingFrom=Showing
+showingTo=to
+showingOf=of
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups_it.properties
new file mode 100644
index 0000000..76e69f7
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups_it.properties
@@ -0,0 +1,26 @@
+# 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.
+tabs-tree=Albero
+tabs-search=Ricerca
+search=Cerca
+create_user=Crea nuovo utente
+search_results_title=Risultati ricerca:
+search_noResults=Nessuna corrispondenza trovata.
+reset=Reset
+showingFrom=Risultati da
+showingTo=a
+showingOf=di
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups_pt_BR.properties
new file mode 100644
index 0000000..8d80401
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Groups_pt_BR.properties
@@ -0,0 +1,26 @@
+# 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.
+tabs-tree=\u00C1rvore
+tabs-search=Buscar
+search=Buscar
+create_user=Criar novo usu\u00E1rio
+search_results_title=Resultados da busca
+search_noResults=N\u00E3o foram encontrados resultados
+reset=Resetar
+showingFrom=Mostrando
+showingTo=para
+showingOf=de
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage.properties
index 28db548..bd02e50 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage.properties
@@ -17,7 +17,7 @@
tab1=Plain attributes
tab2=Derived attributes
tab3=Virtual attributes
-title=Roles
+title=Groups
add=+
drop=-
edit=Edit
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage_it.properties
index 0776461..ebcfd3c 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage_it.properties
@@ -17,7 +17,7 @@
tab1=Attributi normali
tab2=Attributi derivati
tab3=Attributi virtuali
-title=Ruoli
+title=Gruppi
add=+
drop=-
edit=Edit
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage_pt_BR.properties
index 481bc0c..15e115d 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/MembershipModalPage_pt_BR.properties
@@ -17,7 +17,7 @@
tab1=Atributos Normal
tab2=Atributos Derivados
tab3=Atributos Virtuais
-title=Fun\u00e7\u00f5es
+title=Grupos
add=+
drop=-
edit=Alterar
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage.html
index 2ee6802..655778b 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage.html
@@ -159,21 +159,21 @@ under the License.
</div>
<div class="tablerow" style="width: auto;">
<div class="tablecolumn_field" style="width: auto; padding-right: 5px;">
- <span wicket:id="checkRoleAbout">[checkRoleAbout]</span>
+ <span wicket:id="checkGroupAbout">[checkGroupAbout]</span>
</div>
<div class="tablecolumn_label" style="width: auto;">
- <label for="checkRoleAbout"><wicket:message key="checkRoleAbout"/></label>
+ <label for="checkGroupAbout"><wicket:message key="checkGroupAbout"/></label>
</div>
</div>
<div id="userFilter">
<div id="title">
- <label for="roleFilter"><wicket:message key="roleFilter"/></label>
+ <label for="groupFilter"><wicket:message key="groupFilter"/></label>
</div>
<div id="warning">
- <label for="roleFilter"><wicket:message key="roleFilterWarning"/></label>
+ <label for="groupFilter"><wicket:message key="groupFilterWarning"/></label>
</div>
<div id="condition">
- <span wicket:id="roleAbout"/>
+ <span wicket:id="groupAbout"/>
</div>
</div>
</span>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage.properties
index f36d754..99b7dca 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage.properties
@@ -33,8 +33,8 @@ userFilter=User filter
userFilterWarning=Do not use this filter unless events are not targeted at users
userNotifications=User notifications
userNotificationsWarning=Do not select this checkbox unless events are not targeted at users
-roleFilter=Role filter
-roleFilterWarning=Do not use this filter unless events are not targeted at roles
+groupFilter=Group filter
+groupFilterWarning=Do not use this filter unless events are not targeted at groups
isActive=Enabled
checkUserAbout=Users
-checkRoleAbout=Roles
+checkGroupAbout=Groups
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage_it.properties
index 6d3b2b6..6015c91 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage_it.properties
@@ -33,8 +33,8 @@ userFilter=Filtro utenti
userFilterWarning=Non usare questo filtro se gli eventi catturati non riguardano espressamente utenti
userNotifications=Notifiche utente
userNotificationsWarning=Non selezionare questa checkbox se gli eventi catturati non riguardano espressamente utenti
-roleFilter=Filtro ruoli
-roleFilterWarning=Non usare questo filtro se gli eventi catturati non riguardano espressamente i ruoli
+groupFilter=Filtro gruppi
+groupFilterWarning=Non usare questo filtro se gli eventi catturati non riguardano espressamente i ruoli
isActive=Abilitata
checkUserAbout=Utenti
-checkRoleAbout=Ruoli
+checkGroupAbout=Gruppi
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage_pt_BR.properties
index 08879cb..867b98b 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/NotificationModalPage_pt_BR.properties
@@ -29,12 +29,12 @@ recipientAttrType=Tipo de atributo de destinat\u00e1rio de email.
recipientAttrName=Destinat\u00e1rios de e-mail para atributos de esquema
checkRecipients=Buscar Destinat\u00e1rios
checkAbout=Todos
-userFilter=User filter
+userFilter=Filtro de Usu\u00e1rio
userFilterWarning=N\u00e3o use este filtro n\u00e3o ser que os eventos n\u00e3o s\u00e3o direcionados a usu\u00e1rios
userNotifications=Notifica\u00e7\u00f5es do usu\u00e1rio
userNotificationsWarning=N\u00e3o selecione esta op\u00e7\u00e3o a menos que os eventos n\u00e3o s\u00e3o direcionados a usu\u00e1rios
-roleNotifications=Notifica\u00e7\u00f5es do fun\u00e7\u00f5es
-roleNotificationsWarning=N\u00e3o selecione esta op\u00e7\u00e3o a menos que os eventos n\u00e3o s\u00e3o direcionados a fun\u00e7\u00f5es
isActive=Ativada
checkUserAbout=Usu\u00e1rio
-checkRoleAbout=Fun\u00e7\u00e3o
+checkGroupAbout=Grupos
+groupFilter=Filtro de Grupo
+groupFilterWarning=N\u00e3o use este filtro, a menos que os eventos n\u00e3o s\u00e3o dirigidas a grupos
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage.html
index 504d72c..786c4e3 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage.html
@@ -27,7 +27,7 @@ under the License.
<li class="tabs-selected"><a href="#info"><span><wicket:message key="policyInfo"/></span></a></li>
<li><a href="#specification"><span><wicket:message key="policySpecification"/></span></a></li>
<li><a href="#resources"><span><wicket:message key="resources"/></span></a></li>
- <li><a href="#roles"><span><wicket:message key="roles"/></span></a></li>
+ <li><a href="#groups"><span><wicket:message key="groups"/></span></a></li>
</ul>
<div id="info">
@@ -86,9 +86,9 @@ under the License.
</div>
</div>
- <div id="roles">
+ <div id="groups">
<div id="users-contain" class="ui-widget" style="width:inherit;">
- <table class="ui-widget ui-widget-content table-hover" wicket:id="roles"/>
+ <table class="ui-widget ui-widget-content table-hover" wicket:id="groups"/>
</div>
</div>
</div>
@@ -104,6 +104,6 @@ under the License.
</form>
</div>
- <div wicket:id="metaEditModalWin">[Show modal window for meta editing (resources, roles)]</div>
+ <div wicket:id="metaEditModalWin">[Show modal window for meta editing (resources, groups)]</div>
</wicket:extend>
</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage.properties
index 4e7722f..e98ca25 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage.properties
@@ -67,9 +67,9 @@ permittedLoginRetries=Maximum number of subsequent failed logins
# Sync policy specification properties
#-----------------------------
uAltSearchSchemas=Alternative attributes for local search (users)
-rAltSearchSchemas=Alternative attributes for local search (roles)
+gAltSearchSchemas=Alternative attributes for local search (groups)
userJavaRule=Custom user correlation rule
-roleJavaRule=Custom role correlation rule
+groupJavaRule=Custom group correlation rule
conflictResolutionAction= Conflict resolution action
#-----------------------------
@@ -84,5 +84,5 @@ SYNC=Synchronization Policy
GLOBAL_SYNC=Global Synchronization Policy
#-----------------------------
resources=Resources
-roles=Roles
+groups=Groups
authResources=Authentication resources
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage_it.properties
index 4f8bf93..756411b 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage_it.properties
@@ -80,9 +80,9 @@ GLOBAL_SYNC=Policy globale di sincronizzazione
#-----------------------------
nonAlphanumericRequired=Carattere non alfanumerico richiesto
alphanumericRequired=Carattere alfanumerico richiesto
-rAltSearchSchemas=Attributi alternativi per ricerca locale (ruoli)
+gAltSearchSchemas=Attributi alternativi per ricerca locale (gruppi)
userJavaRule=Regola di correlazione (utenti)
-roleJavaRule=Regola di correlazione (ruoli)
+groupJavaRule=Regola di correlazione (gruppi)
resources=Risorse
-roles=Ruoli
+groups=Gruppi
authResources=Risorse di autenticazione
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage_pt_BR.properties
index 075756a..a69aeb4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PolicyModalPage_pt_BR.properties
@@ -67,9 +67,9 @@ permittedLoginRetries=N\u00famero m\u00e1ximo de subsequentes falhas de login
# Sync policy specification properties
#-----------------------------
uAltSearchSchemas=Atributos alternativos para busca local (usu\u00e1rios)
-rAltSearchSchemas=Atributos alternativos para busca local (fun\u00e7\u00f5es)
+gAltSearchSchemas=Atributos alternativos para busca local (grupos)
userJavaRule=Regra customizada de correla\u00e7\u00e3o de usu\u00e1rio
-roleJavaRule=Regra de correla\u00e7\u00e3o de fun\u00e7\u00e3o customizada
+groupJavaRule=Regra de correla\u00e7\u00e3o de grupo customizada
conflictResolutionAction= A\u00e7\u00e3o de resolu\u00e7\u00e3o de conflito
#-----------------------------
@@ -83,5 +83,5 @@ GLOBAL_PASSWORD=Pol\u00edtica Global de Senha
SYNC=Pol\u00edtica de Sincroniza\u00e7\u00e3o
GLOBAL_SYNC=Pol\u00edtica Global de sincroniza\u00e7\u00e3o
resources=Recursos
-roles=Fun\u00e7\u00f5es
+groups=Grupos
authResources=Recursos de autentica\u00e7\u00e3o
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage.html
index 37047cc..5ac1379 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage.html
@@ -169,15 +169,15 @@ under the License.
</div>
<div class="tablerow" style="width: auto;">
<div class="tablecolumn_field" style="width: auto; padding-right: 5px;">
- <span wicket:id="checkRoleFilter">[checkRoleFilter]</span>
+ <span wicket:id="checkGroupFilter">[checkGroupFilter]</span>
</div>
<div class="tablecolumn_label" style="width: auto;">
- <label for="checkRoleFilter"><wicket:message key="checkRoleFilter"/></label>
+ <label for="checkGroupFilter"><wicket:message key="checkGroupFilter"/></label>
</div>
</div>
- <div id="roleFilter" style="border: 1px solid #dddddd; padding-bottom: 2%; padding-top: 2%;">
+ <div id="groupFilter" style="border: 1px solid #dddddd; padding-bottom: 2%; padding-top: 2%;">
<div id="condition">
- <span wicket:id="roleFilter"/>
+ <span wicket:id="groupFilter"/>
</div>
</div>
</span>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage.properties
index 4343e45..b058db7 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage.properties
@@ -42,4 +42,4 @@ actionsClasses=Actions classes
matchingRule=Matching Rule
unmatchingRule=Unmatching Rule
checkUserFilter=User Filter
-checkRoleFilter=Role Filter
+checkGroupFilter=Group Filter
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage_it.properties
index 33134b2..52df2db 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage_it.properties
@@ -44,4 +44,4 @@ syncStatus=Sincronizza stato utente
matchingRule=Regola di corrispondenza
unmatchingRule=Regola di non corrispondenza
checkUserFilter=Filtro Utente
-checkRoleFilter=Filtero Ruolo
+checkGroupFilter=Filtro Gruppo
[28/57] syncope git commit: Experimenting with commons-collections'
CollectionUtils and Predicate: looks good!
Posted by il...@apache.org.
Experimenting with commons-collections' CollectionUtils and Predicate: looks good!
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/678e968c
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/678e968c
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/678e968c
Branch: refs/heads/master
Commit: 678e968cb9cfb5f11cbfbea0d17ed5d70dbde0b6
Parents: 4095f1e
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Apr 6 18:57:26 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Apr 6 18:57:26 2015 +0200
----------------------------------------------------------------------
common/lib/pom.xml | 6 +++++-
.../syncope/common/lib/to/AbstractSubjectTO.java | 14 +++++++-------
.../syncope/common/lib/types/WorkflowTasks.java | 2 +-
.../java/data/AbstractAttributableDataBinder.java | 4 +---
pom.xml | 8 +++++++-
5 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/678e968c/common/lib/pom.xml
----------------------------------------------------------------------
diff --git a/common/lib/pom.xml b/common/lib/pom.xml
index 2bdc6ea..14f8208 100644
--- a/common/lib/pom.xml
+++ b/common/lib/pom.xml
@@ -57,7 +57,11 @@ under the License.
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
http://git-wip-us.apache.org/repos/asf/syncope/blob/678e968c/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
index a2e1b3a..62c83eb 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
@@ -26,6 +26,8 @@ import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
@XmlType
public abstract class AbstractSubjectTO extends AbstractAttributableTO {
@@ -45,15 +47,13 @@ public abstract class AbstractSubjectTO extends AbstractAttributableTO {
public boolean removePropagationTO(final String resource) {
if (resource != null && getPropagationStatusTOs().isEmpty()) {
- final List<PropagationStatus> toBeRemoved = new ArrayList<>();
+ return CollectionUtils.filterInverse(propagationStatusTOs, new Predicate<PropagationStatus>() {
- for (PropagationStatus propagationTO : getPropagationStatusTOs()) {
- if (resource.equals(propagationTO.getResource())) {
- toBeRemoved.add(propagationTO);
+ @Override
+ public boolean evaluate(final PropagationStatus propagationStatus) {
+ return resource.equals(propagationStatus.getResource());
}
- }
-
- return propagationStatusTOs.removeAll(toBeRemoved);
+ });
}
return false;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/678e968c/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
index 8c487f8..d23b1bc 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
@@ -29,7 +29,7 @@ public class WorkflowTasks {
private List<String> tasks;
public WorkflowTasks() {
- this.tasks = new ArrayList<String>();
+ this.tasks = new ArrayList<>();
}
public WorkflowTasks(final Collection<String> tasks) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/678e968c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
index 65fc97e..a33e062 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
@@ -664,9 +664,7 @@ abstract class AbstractAttributableDataBinder {
}
// 3. user and group virtual attributes will be evaluated by the propagation manager only (if needed).
- if (AttributableType.USER == attrUtil.getType()
- || AttributableType.GROUP == attrUtil.getType()) {
-
+ if (AttributableType.USER == attrUtil.getType() || AttributableType.GROUP == attrUtil.getType()) {
for (AttrTO vattrTO : attributableTO.getVirAttrs()) {
VirSchema virSchema = virtAttrHander.getVirSchema(vattrTO.getSchema(), attrUtil.virSchemaClass());
http://git-wip-us.apache.org/repos/asf/syncope/blob/678e968c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 054db15..f5fe484 100644
--- a/pom.xml
+++ b/pom.xml
@@ -357,6 +357,7 @@ under the License.
<commons-codec.version>1.10</commons-codec.version>
<commons-jexl.version>2.1.1</commons-jexl.version>
<commons-lang.version>3.3.2</commons-lang.version>
+ <commons-collection.version>4.0</commons-collection.version>
<commons.logging.version>1.1.3</commons.logging.version>
<h2.version>1.4.186</h2.version>
@@ -651,7 +652,12 @@ under the License.
<artifactId>commons-lang3</artifactId>
<version>${commons-lang.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ <version>${commons-collection.version}</version>
+ </dependency>
+
<dependency>
<groupId>net.tirasa.connid</groupId>
<artifactId>connector-framework</artifactId>
[15/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java
----------------------------------------------------------------------
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 32d23fc..adc0a36 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
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import java.util.Set;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
@@ -50,13 +49,13 @@ public interface UserDAO extends SubjectDAO<UPlainAttr, UDerAttr, UVirAttr> {
List<User> findByResource(ExternalResource resource);
- List<User> findAll(Set<Long> adminRoles, int page, int itemsPerPage);
+ List<User> findAll(Set<Long> adminGroups, int page, int itemsPerPage);
- List<User> findAll(Set<Long> adminRoles, int page, int itemsPerPage, List<OrderByClause> orderBy);
+ List<User> findAll(Set<Long> adminGroups, int page, int itemsPerPage, List<OrderByClause> orderBy);
- int count(Set<Long> adminRoles);
+ int count(Set<Long> adminGroups);
- User save(User user) throws InvalidEntityException;
+ User save(User user);
void delete(Long key);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirAttrDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirAttrDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirAttrDAO.java
index 2c4e1cc..254372a 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirAttrDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirAttrDAO.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
public interface VirAttrDAO extends DAO<VirAttr, Long> {
@@ -28,7 +27,7 @@ public interface VirAttrDAO extends DAO<VirAttr, Long> {
<T extends VirAttr> List<T> findAll(Class<T> reference);
- <T extends VirAttr> T save(T virtualAttribute) throws InvalidEntityException;
+ <T extends VirAttr> T save(T virtualAttribute);
<T extends VirAttr> void delete(Long key, Class<T> reference);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirSchemaDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirSchemaDAO.java
index 2968f0e..149ef97 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirSchemaDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirSchemaDAO.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
@@ -32,7 +31,7 @@ public interface VirSchemaDAO extends DAO<VirSchema, String> {
<T extends VirAttr> List<T> findAttrs(VirSchema virSchema, Class<T> reference);
- <T extends VirSchema> T save(T virSchema) throws InvalidEntityException;
+ <T extends VirSchema> T save(T virSchema);
void delete(String key, AttributableUtil attributableUtil);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/MembershipCond.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/MembershipCond.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/MembershipCond.java
index 8f18347..6cbc6b3 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/MembershipCond.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/MembershipCond.java
@@ -25,22 +25,18 @@ public class MembershipCond extends AbstractSearchCond {
private static final long serialVersionUID = -728155256293925989L;
- private Long roleId;
+ private Long groupId;
- public MembershipCond() {
- super();
+ public Long getGroupId() {
+ return groupId;
}
- public Long getRoleId() {
- return roleId;
- }
-
- public void setRoleId(final Long roleId) {
- this.roleId = roleId;
+ public void setGroupId(final Long groupId) {
+ this.groupId = groupId;
}
@Override
public final boolean isValid() {
- return roleId != null;
+ return groupId != null;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SubjectCond.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SubjectCond.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SubjectCond.java
index b612293..48e762f 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SubjectCond.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SubjectCond.java
@@ -26,6 +26,7 @@ public class SubjectCond extends AttributeCond {
private static final long serialVersionUID = -1880319220462653955L;
public SubjectCond() {
+ super();
}
public SubjectCond(final Type conditionType) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttrTemplate.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttrTemplate.java
index 26397e0..6aaf916 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttrTemplate.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttrTemplate.java
@@ -18,13 +18,13 @@
*/
package org.apache.syncope.core.persistence.api.entity;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
public interface AttrTemplate<S extends Schema> extends Entity<Long> {
- Role getOwner();
+ Group getOwner();
- void setOwner(Role role);
+ void setOwner(Group group);
S getSchema();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/ExternalResource.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/ExternalResource.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/ExternalResource.java
index e61bda2..c221f41 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/ExternalResource.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/ExternalResource.java
@@ -19,7 +19,7 @@
package org.apache.syncope.core.persistence.api.entity;
import org.apache.syncope.core.persistence.api.entity.user.UMapping;
-import org.apache.syncope.core.persistence.api.entity.role.RMapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMapping;
import java.util.List;
import java.util.Set;
import org.apache.syncope.common.lib.types.ConnConfProperty;
@@ -55,7 +55,7 @@ public interface ExternalResource extends AnnotatedEntity<String> {
UMapping getUmapping();
- RMapping getRmapping();
+ GMapping getGmapping();
SyncToken getUsyncToken();
@@ -97,7 +97,7 @@ public interface ExternalResource extends AnnotatedEntity<String> {
void setUmapping(UMapping umapping);
- void setRmapping(RMapping rmapping);
+ void setGmapping(GMapping gmapping);
void setEnforceMandatoryCondition(boolean enforce);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
index 104cf12..0c55b14 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
@@ -36,7 +36,7 @@ public interface Notification extends Entity<Long> {
String getRecipients();
- String getRoleAbout();
+ String getGroupAbout();
String getSender();
@@ -66,7 +66,7 @@ public interface Notification extends Entity<Long> {
void setRecipients(String recipients);
- void setRoleAbout(String roleAbout);
+ void setGroupAbout(String groupAbout);
void setSelfAsRecipient(boolean selfAsRecipient);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttr.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttr.java
index 4250f2e..11e33b5 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttr.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttr.java
@@ -19,11 +19,10 @@
package org.apache.syncope.core.persistence.api.entity;
import java.util.List;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
public interface PlainAttr extends Attr<PlainSchema> {
- void addValue(String value, AttributableUtil attributableUtil) throws InvalidPlainAttrValueException;
+ void addValue(String value, AttributableUtil attributableUtil);
boolean removeValue(PlainAttrValue attrValue);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttrValue.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttrValue.java
index fffeb29..7735d4c 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttrValue.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/PlainAttrValue.java
@@ -20,7 +20,6 @@ package org.apache.syncope.core.persistence.api.entity;
import java.util.Date;
import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
public interface PlainAttrValue extends Entity<Long> {
@@ -44,7 +43,7 @@ public interface PlainAttrValue extends Entity<Long> {
String getValueAsString(AttrSchemaType type);
- void parseValue(PlainSchema schema, String value) throws ParsingValidationException;
+ void parseValue(PlainSchema schema, String value);
void setAttr(PlainAttr attr);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerAttr.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerAttr.java
new file mode 100644
index 0000000..59e665f
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerAttr.java
@@ -0,0 +1,34 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.DerAttr;
+
+public interface GDerAttr extends DerAttr {
+
+ @Override
+ Group getOwner();
+
+ @Override
+ GDerSchema getSchema();
+
+ GDerAttrTemplate getTemplate();
+
+ void setTemplate(GDerAttrTemplate template);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerAttrTemplate.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerAttrTemplate.java
new file mode 100644
index 0000000..ee92c6c
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerAttrTemplate.java
@@ -0,0 +1,25 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+
+public interface GDerAttrTemplate extends AttrTemplate<GDerSchema> {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerSchema.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerSchema.java
new file mode 100644
index 0000000..ef67148
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GDerSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.DerSchema;
+
+public interface GDerSchema extends DerSchema {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GMapping.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GMapping.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GMapping.java
new file mode 100644
index 0000000..b8105f3
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GMapping.java
@@ -0,0 +1,25 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.Mapping;
+
+public interface GMapping extends Mapping<GMappingItem> {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GMappingItem.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GMappingItem.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GMappingItem.java
new file mode 100644
index 0000000..3e1c126
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GMappingItem.java
@@ -0,0 +1,29 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.Mapping;
+import org.apache.syncope.core.persistence.api.entity.MappingItem;
+
+public interface GMappingItem extends MappingItem {
+
+ @Override
+ Mapping<GMappingItem> getMapping();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttr.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttr.java
new file mode 100644
index 0000000..cf3f551
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttr.java
@@ -0,0 +1,42 @@
+/*
+ * 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.group;
+
+import java.util.List;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+
+public interface GPlainAttr extends PlainAttr {
+
+ @Override
+ Group getOwner();
+
+ @Override
+ GPlainSchema getSchema();
+
+ GPlainAttrTemplate getTemplate();
+
+ void setTemplate(GPlainAttrTemplate template);
+
+ @Override
+ List<? extends GPlainAttrValue> getValues();
+
+ @Override
+ GPlainAttrUniqueValue getUniqueValue();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrTemplate.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrTemplate.java
new file mode 100644
index 0000000..c619c72
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrTemplate.java
@@ -0,0 +1,25 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+
+public interface GPlainAttrTemplate extends AttrTemplate<GPlainSchema> {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrUniqueValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrUniqueValue.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrUniqueValue.java
new file mode 100644
index 0000000..2ce9285
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrUniqueValue.java
@@ -0,0 +1,31 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue;
+
+public interface GPlainAttrUniqueValue extends PlainAttrUniqueValue {
+
+ @Override
+ GPlainAttr getAttr();
+
+ @Override
+ GPlainSchema getSchema();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrValue.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrValue.java
new file mode 100644
index 0000000..d63a38c
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainAttrValue.java
@@ -0,0 +1,28 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+
+public interface GPlainAttrValue extends PlainAttrValue {
+
+ @Override
+ GPlainAttr getAttr();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainSchema.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainSchema.java
new file mode 100644
index 0000000..f50dcfd
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GPlainSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+
+public interface GPlainSchema extends PlainSchema {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirAttr.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirAttr.java
new file mode 100644
index 0000000..9ef9f4a
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirAttr.java
@@ -0,0 +1,34 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+
+public interface GVirAttr extends VirAttr {
+
+ @Override
+ Group getOwner();
+
+ @Override
+ GVirSchema getSchema();
+
+ GVirAttrTemplate getTemplate();
+
+ void setTemplate(GVirAttrTemplate template);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirAttrTemplate.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirAttrTemplate.java
new file mode 100644
index 0000000..478a255
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirAttrTemplate.java
@@ -0,0 +1,25 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+
+public interface GVirAttrTemplate extends AttrTemplate<GVirSchema> {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirSchema.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirSchema.java
new file mode 100644
index 0000000..52a65c7
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/GVirSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.group;
+
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+
+public interface GVirSchema extends VirSchema {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/Group.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..3c9f5df
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/Group.java
@@ -0,0 +1,168 @@
+/*
+ * 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.group;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.Entitlement;
+import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.Schema;
+import org.apache.syncope.core.persistence.api.entity.Subject;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+
+public interface Group extends Subject<GPlainAttr, GDerAttr, GVirAttr> {
+
+ String getName();
+
+ Group getParent();
+
+ boolean addEntitlement(Entitlement entitlement);
+
+ boolean removeEntitlement(Entitlement entitlement);
+
+ /**
+ * Get all inherited attributes from the ancestors.
+ *
+ * @return a list of inherited and only inherited attributes.
+ */
+ List<? extends GPlainAttr> findLastInheritedAncestorPlainAttrs();
+
+ /**
+ * Get all inherited derived attributes from the ancestors.
+ *
+ * @return a list of inherited and only inherited attributes.
+ */
+ List<? extends GDerAttr> findLastInheritedAncestorDerAttrs();
+
+ /**
+ * Get all inherited virtual attributes from the ancestors.
+ *
+ * @return a list of inherited and only inherited attributes.
+ */
+ List<? extends GVirAttr> findLastInheritedAncestorVirAttrs();
+
+ /**
+ * Get first valid account policy.
+ *
+ * @return parent account policy if isInheritAccountPolicy is 'true' and parent is not null, local account policy
+ * otherwise.
+ */
+ AccountPolicy getAccountPolicy();
+
+ <T extends AttrTemplate<K>, K extends Schema> List<T> findInheritedTemplates(Class<T> reference);
+
+ <T extends AttrTemplate<K>, K extends Schema> T getAttrTemplate(
+ Class<T> reference, String schemaName);
+
+ <T extends AttrTemplate<K>, K extends Schema> List<K> getAttrTemplateSchemas(Class<T> reference);
+
+ <T extends AttrTemplate<K>, K extends Schema> List<T> getAttrTemplates(Class<T> reference);
+
+ Set<? extends Entitlement> getEntitlements();
+
+ /**
+ * Get first valid password policy.
+ *
+ * @return parent password policy if isInheritPasswordPolicy is 'true' and parent is not null, local password policy
+ * otherwise
+ */
+ PasswordPolicy getPasswordPolicy();
+
+ Group getGroupOwner();
+
+ User getUserOwner();
+
+ boolean isInheritAccountPolicy();
+
+ boolean isInheritPlainAttrs();
+
+ boolean isInheritDerAttrs();
+
+ boolean isInheritOwner();
+
+ boolean isInheritPasswordPolicy();
+
+ boolean isInheritTemplates();
+
+ boolean isInheritVirAttrs();
+
+ void setAccountPolicy(AccountPolicy accountPolicy);
+
+ void setInheritAccountPolicy(boolean condition);
+
+ void setInheritPlainAttrs(boolean inheritAttrs);
+
+ void setInheritDerAttrs(boolean inheritDerAttrs);
+
+ void setInheritOwner(boolean inheritOwner);
+
+ void setInheritPasswordPolicy(boolean condition);
+
+ void setInheritTemplates(boolean condition);
+
+ void setInheritVirAttrs(boolean inheritVirAttrs);
+
+ void setName(String name);
+
+ void setParent(Group parent);
+
+ void setPasswordPolicy(PasswordPolicy passwordPolicy);
+
+ void setGroupOwner(Group groupOwner);
+
+ void setUserOwner(User userOwner);
+
+ @Override
+ boolean addPlainAttr(GPlainAttr attr);
+
+ @Override
+ boolean addDerAttr(GDerAttr attr);
+
+ @Override
+ boolean addVirAttr(GVirAttr attr);
+
+ @Override
+ GPlainAttr getPlainAttr(String plainSchemaName);
+
+ @Override
+ List<? extends GPlainAttr> getPlainAttrs();
+
+ @Override
+ GDerAttr getDerAttr(String derSchemaName);
+
+ @Override
+ List<? extends GDerAttr> getDerAttrs();
+
+ @Override
+ GVirAttr getVirAttr(String virSchemaName);
+
+ @Override
+ List<? extends GVirAttr> getVirAttrs();
+
+ @Override
+ boolean removePlainAttr(GPlainAttr attr);
+
+ @Override
+ boolean removeDerAttr(GDerAttr derAttr);
+
+ @Override
+ boolean removeVirAttr(GVirAttr virAttr);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/membership/Membership.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/membership/Membership.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/membership/Membership.java
index 2288bcd..b83270a 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/membership/Membership.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/membership/Membership.java
@@ -20,16 +20,16 @@ package org.apache.syncope.core.persistence.api.entity.membership;
import java.util.List;
import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.User;
public interface Membership extends Attributable<MPlainAttr, MDerAttr, MVirAttr> {
- Role getRole();
+ Group getGroup();
User getUser();
- void setRole(Role role);
+ void setGroup(Group group);
void setUser(User user);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerAttr.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerAttr.java
deleted file mode 100644
index af2eb0b..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerAttr.java
+++ /dev/null
@@ -1,34 +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.role;
-
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
-
-public interface RDerAttr extends DerAttr {
-
- @Override
- Role getOwner();
-
- @Override
- RDerSchema getSchema();
-
- RDerAttrTemplate getTemplate();
-
- void setTemplate(RDerAttrTemplate template);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerAttrTemplate.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerAttrTemplate.java
deleted file mode 100644
index 605736e..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerAttrTemplate.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.role;
-
-import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-
-public interface RDerAttrTemplate extends AttrTemplate<RDerSchema> {
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerSchema.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerSchema.java
deleted file mode 100644
index 149b187..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RDerSchema.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.role;
-
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-
-public interface RDerSchema extends DerSchema {
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RMapping.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RMapping.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RMapping.java
deleted file mode 100644
index 4df8e28..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RMapping.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.role;
-
-import org.apache.syncope.core.persistence.api.entity.Mapping;
-
-public interface RMapping extends Mapping<RMappingItem> {
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RMappingItem.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RMappingItem.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RMappingItem.java
deleted file mode 100644
index 77b5ceb..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RMappingItem.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.role;
-
-import org.apache.syncope.core.persistence.api.entity.Mapping;
-import org.apache.syncope.core.persistence.api.entity.MappingItem;
-
-public interface RMappingItem extends MappingItem {
-
- @Override
- Mapping<RMappingItem> getMapping();
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttr.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttr.java
deleted file mode 100644
index c50ce33..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttr.java
+++ /dev/null
@@ -1,42 +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.role;
-
-import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-
-public interface RPlainAttr extends PlainAttr {
-
- @Override
- Role getOwner();
-
- @Override
- RPlainSchema getSchema();
-
- RPlainAttrTemplate getTemplate();
-
- void setTemplate(RPlainAttrTemplate template);
-
- @Override
- List<? extends RPlainAttrValue> getValues();
-
- @Override
- RPlainAttrUniqueValue getUniqueValue();
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrTemplate.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrTemplate.java
deleted file mode 100644
index 2f8ec74..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrTemplate.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.role;
-
-import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-
-public interface RPlainAttrTemplate extends AttrTemplate<RPlainSchema> {
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrUniqueValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrUniqueValue.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrUniqueValue.java
deleted file mode 100644
index 6de3a89..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrUniqueValue.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.role;
-
-import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue;
-
-public interface RPlainAttrUniqueValue extends PlainAttrUniqueValue {
-
- @Override
- RPlainAttr getAttr();
-
- @Override
- RPlainSchema getSchema();
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrValue.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrValue.java
deleted file mode 100644
index 3314397..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainAttrValue.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.role;
-
-import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-
-public interface RPlainAttrValue extends PlainAttrValue {
-
- @Override
- RPlainAttr getAttr();
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainSchema.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainSchema.java
deleted file mode 100644
index fdfefac..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RPlainSchema.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.role;
-
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-
-public interface RPlainSchema extends PlainSchema {
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirAttr.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirAttr.java
deleted file mode 100644
index 8c3f9ca..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirAttr.java
+++ /dev/null
@@ -1,34 +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.role;
-
-import org.apache.syncope.core.persistence.api.entity.VirAttr;
-
-public interface RVirAttr extends VirAttr {
-
- @Override
- Role getOwner();
-
- @Override
- RVirSchema getSchema();
-
- RVirAttrTemplate getTemplate();
-
- void setTemplate(RVirAttrTemplate template);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirAttrTemplate.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirAttrTemplate.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirAttrTemplate.java
deleted file mode 100644
index 3df1189..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirAttrTemplate.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.role;
-
-import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-
-public interface RVirAttrTemplate extends AttrTemplate<RVirSchema> {
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirSchema.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirSchema.java
deleted file mode 100644
index 39476fb..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/RVirSchema.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.role;
-
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
-
-public interface RVirSchema extends VirSchema {
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/Role.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/Role.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/Role.java
deleted file mode 100644
index e3e4b23..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/role/Role.java
+++ /dev/null
@@ -1,168 +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.role;
-
-import java.util.List;
-import java.util.Set;
-import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.Schema;
-import org.apache.syncope.core.persistence.api.entity.Subject;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-
-public interface Role extends Subject<RPlainAttr, RDerAttr, RVirAttr> {
-
- String getName();
-
- Role getParent();
-
- boolean addEntitlement(Entitlement entitlement);
-
- boolean removeEntitlement(Entitlement entitlement);
-
- /**
- * Get all inherited attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- List<? extends RPlainAttr> findLastInheritedAncestorPlainAttrs();
-
- /**
- * Get all inherited derived attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- List<? extends RDerAttr> findLastInheritedAncestorDerAttrs();
-
- /**
- * Get all inherited virtual attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- List<? extends RVirAttr> findLastInheritedAncestorVirAttrs();
-
- /**
- * Get first valid account policy.
- *
- * @return parent account policy if isInheritAccountPolicy is 'true' and parent is not null, local account policy
- * otherwise.
- */
- AccountPolicy getAccountPolicy();
-
- <T extends AttrTemplate<K>, K extends Schema> List<T> findInheritedTemplates(Class<T> reference);
-
- <T extends AttrTemplate<K>, K extends Schema> T getAttrTemplate(
- Class<T> reference, String schemaName);
-
- <T extends AttrTemplate<K>, K extends Schema> List<K> getAttrTemplateSchemas(Class<T> reference);
-
- <T extends AttrTemplate<K>, K extends Schema> List<T> getAttrTemplates(Class<T> reference);
-
- Set<? extends Entitlement> getEntitlements();
-
- /**
- * Get first valid password policy.
- *
- * @return parent password policy if isInheritPasswordPolicy is 'true' and parent is not null, local password policy
- * otherwise
- */
- PasswordPolicy getPasswordPolicy();
-
- Role getRoleOwner();
-
- User getUserOwner();
-
- boolean isInheritAccountPolicy();
-
- boolean isInheritPlainAttrs();
-
- boolean isInheritDerAttrs();
-
- boolean isInheritOwner();
-
- boolean isInheritPasswordPolicy();
-
- boolean isInheritTemplates();
-
- boolean isInheritVirAttrs();
-
- void setAccountPolicy(AccountPolicy accountPolicy);
-
- void setInheritAccountPolicy(boolean condition);
-
- void setInheritPlainAttrs(boolean inheritAttrs);
-
- void setInheritDerAttrs(boolean inheritDerAttrs);
-
- void setInheritOwner(boolean inheritOwner);
-
- void setInheritPasswordPolicy(boolean condition);
-
- void setInheritTemplates(boolean condition);
-
- void setInheritVirAttrs(boolean inheritVirAttrs);
-
- void setName(String name);
-
- void setParent(Role parent);
-
- void setPasswordPolicy(PasswordPolicy passwordPolicy);
-
- void setRoleOwner(Role roleOwner);
-
- void setUserOwner(User userOwner);
-
- @Override
- boolean addPlainAttr(RPlainAttr attr);
-
- @Override
- boolean addDerAttr(RDerAttr attr);
-
- @Override
- boolean addVirAttr(RVirAttr attr);
-
- @Override
- RPlainAttr getPlainAttr(String plainSchemaName);
-
- @Override
- List<? extends RPlainAttr> getPlainAttrs();
-
- @Override
- RDerAttr getDerAttr(String derSchemaName);
-
- @Override
- List<? extends RDerAttr> getDerAttrs();
-
- @Override
- RVirAttr getVirAttr(String virSchemaName);
-
- @Override
- List<? extends RVirAttr> getVirAttrs();
-
- @Override
- boolean removePlainAttr(RPlainAttr attr);
-
- @Override
- boolean removeDerAttr(RDerAttr derAttr);
-
- @Override
- boolean removeVirAttr(RVirAttr virAttr);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PushTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PushTask.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PushTask.java
index 7631a6b..deaf36f 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PushTask.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PushTask.java
@@ -20,11 +20,11 @@ package org.apache.syncope.core.persistence.api.entity.task;
public interface PushTask extends ProvisioningTask {
- String getRoleFilter();
+ String getGroupFilter();
String getUserFilter();
- void setRoleFilter(String roleFilter);
+ void setGroupFilter(String filter);
void setUserFilter(String filter);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/SyncTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/SyncTask.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/SyncTask.java
index f73dcfb..0d3b24c 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/SyncTask.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/SyncTask.java
@@ -18,12 +18,12 @@
*/
package org.apache.syncope.core.persistence.api.entity.task;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
public interface SyncTask extends ProvisioningTask {
- RoleTO getRoleTemplate();
+ GroupTO getGroupTemplate();
UserTO getUserTemplate();
@@ -31,7 +31,7 @@ public interface SyncTask extends ProvisioningTask {
void setFullReconciliation(boolean condition);
- void setRoleTemplate(RoleTO roleTemplate);
+ void setGroupTemplate(GroupTO groupTemplate);
void setUserTemplate(UserTO userTemplate);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
index 66898e4..5c3ec4d 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
@@ -25,7 +25,7 @@ import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.Subject;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
public interface User extends Subject<UPlainAttr, UDerAttr, UVirAttr> {
@@ -47,7 +47,7 @@ public interface User extends Subject<UPlainAttr, UDerAttr, UVirAttr> {
Date getLastLoginDate();
- Membership getMembership(Long roleKey);
+ Membership getMembership(Long groupKey);
List<? extends Membership> getMemberships();
@@ -57,9 +57,9 @@ public interface User extends Subject<UPlainAttr, UDerAttr, UVirAttr> {
List<String> getPasswordHistory();
- Set<Long> getRoleKeys();
+ Set<Long> getGroupKeys();
- List<Role> getRoles();
+ List<Group> getGroups();
String getSecurityAnswer();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentExporter.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentExporter.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentExporter.java
index 61535d6..4a3f975 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentExporter.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentExporter.java
@@ -93,7 +93,7 @@ public class XMLContentExporter extends AbstractContentDealer implements Content
Collections.singletonMap("TASK", "DTYPE <> 'PropagationTask'");
protected static final Map<String, Set<String>> COLUMNS_TO_BE_NULLIFIED =
- Collections.singletonMap("SYNCOPEROLE", Collections.singleton("USEROWNER_ID"));
+ Collections.singletonMap("SYNCOPEGROUP", Collections.singleton("USEROWNER_ID"));
private boolean isTableAllowed(final String tableName) {
boolean allowed = true;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractSubjectDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractSubjectDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractSubjectDAO.java
index 1096b50..93c54e9 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractSubjectDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractSubjectDAO.java
@@ -82,7 +82,7 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
*
* @param expression derived schema expression
* @param value derived attribute value
- * @param attrUtil USER / ROLE
+ * @param attrUtil USER / GROUP
* @return where clauses to use to build the query
*/
private Set<String> getWhereClause(final String expression, final String value, final AttributableUtil attrUtil) {
@@ -276,7 +276,7 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
}
/**
- * Find users / roles by derived attribute value. This method could fail if one or more string literals contained
+ * Find users / groups by derived attribute value. This method could fail if one or more string literals contained
* into the derived attribute value provided derive from identifier (schema name) replacement. When you are going to
* specify a derived attribute expression you must be quite sure that string literals used to build the expression
* cannot be found into the attribute values used to replace attribute schema names used as identifiers.
@@ -284,7 +284,7 @@ abstract class AbstractSubjectDAO<P extends PlainAttr, D extends DerAttr, V exte
* @param schemaName derived schema name
* @param value derived attribute value
* @param attrUtil AttributableUtil
- * @return list of users / roles
+ * @return list of users / groups
*/
@Override
public List<? extends Subject<P, D, V>> findByDerAttrValue(
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAttrTemplateDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAttrTemplateDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAttrTemplateDAO.java
index 233257b..2b33178 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAttrTemplateDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAttrTemplateDAO.java
@@ -27,16 +27,16 @@ import org.apache.syncope.core.persistence.api.entity.Schema;
import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
import org.apache.syncope.core.persistence.jpa.entity.AbstractAttrTemplate;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttrTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.util.ReflectionUtils;
@@ -53,12 +53,12 @@ public class JPAAttrTemplateDAO<S extends Schema>
? JPAMDerAttrTemplate.class
: MVirAttrTemplate.class.isAssignableFrom(reference)
? JPAMVirAttrTemplate.class
- : RPlainAttrTemplate.class.isAssignableFrom(reference)
- ? JPARPlainAttrTemplate.class
- : RDerAttrTemplate.class.isAssignableFrom(reference)
- ? JPARDerAttrTemplate.class
- : RVirAttrTemplate.class.isAssignableFrom(reference)
- ? JPARVirAttrTemplate.class
+ : GPlainAttrTemplate.class.isAssignableFrom(reference)
+ ? JPAGPlainAttrTemplate.class
+ : GDerAttrTemplate.class.isAssignableFrom(reference)
+ ? JPAGDerAttrTemplate.class
+ : GVirAttrTemplate.class.isAssignableFrom(reference)
+ ? JPAGVirAttrTemplate.class
: null;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerAttrDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerAttrDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerAttrDAO.java
index daf0cb1..ff32fb8 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerAttrDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerAttrDAO.java
@@ -24,11 +24,11 @@ import org.apache.syncope.core.persistence.api.dao.DerAttrDAO;
import org.apache.syncope.core.persistence.api.entity.Attributable;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MDerAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttr;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr;
import org.springframework.stereotype.Repository;
@@ -38,8 +38,8 @@ public class JPADerAttrDAO extends AbstractDAO<DerAttr, Long> implements DerAttr
public <T extends DerAttr> Class<? extends AbstractDerAttr> getJPAEntityReference(
final Class<T> reference) {
- return RDerAttr.class.isAssignableFrom(reference)
- ? JPARDerAttr.class
+ return GDerAttr.class.isAssignableFrom(reference)
+ ? JPAGDerAttr.class
: MDerAttr.class.isAssignableFrom(reference)
? JPAMDerAttr.class
: UDerAttr.class.isAssignableFrom(reference)
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
index 985851e..6e1db3f 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
@@ -32,13 +32,13 @@ import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
import org.apache.syncope.core.persistence.api.entity.user.UMappingItem;
import org.apache.syncope.core.persistence.jpa.entity.AbstractDerSchema;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerSchema;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerSchema;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@@ -56,8 +56,8 @@ public class JPADerSchemaDAO extends AbstractDAO<DerSchema, String> implements D
private ExternalResourceDAO resourceDAO;
private <T extends DerSchema> Class<? extends AbstractDerSchema> getJPAEntityReference(final Class<T> reference) {
- return RDerSchema.class.isAssignableFrom(reference)
- ? JPARDerSchema.class
+ return GDerSchema.class.isAssignableFrom(reference)
+ ? JPAGDerSchema.class
: MDerSchema.class.isAssignableFrom(reference)
? JPAMDerSchema.class
: UDerSchema.class.isAssignableFrom(reference)
[33/57] syncope git commit: [SYNCOPE-119] Introducing Realms
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
index 9f79e49..1dff1f2 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
@@ -28,6 +28,8 @@ import java.util.Set;
import javax.persistence.NoResultException;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.PolicyType;
import org.apache.syncope.common.lib.types.ResourceOperation;
@@ -422,15 +424,17 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
group.setPasswordPolicy(null);
}
- // remove attributes without a valid template
+ // remove plain attributes without a valid template
List<GPlainAttr> rToBeDeleted = new ArrayList<>();
- for (PlainAttr attr : group.getPlainAttrs()) {
- boolean found = false;
- for (GPlainAttrTemplate template : group.findInheritedTemplates(GPlainAttrTemplate.class)) {
- if (template.getSchema().equals(attr.getSchema())) {
- found = true;
- }
- }
+ for (final PlainAttr attr : group.getPlainAttrs()) {
+ boolean found = CollectionUtils.exists(group.findInheritedTemplates(GPlainAttrTemplate.class),
+ new Predicate<GPlainAttrTemplate>() {
+
+ @Override
+ public boolean evaluate(final GPlainAttrTemplate template) {
+ return template.getSchema().equals(attr.getSchema());
+ }
+ });
if (!found) {
rToBeDeleted.add((GPlainAttr) attr);
}
@@ -441,14 +445,16 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
}
// remove derived attributes without a valid template
- List<GDerAttr> rDerToBeDeleted = new ArrayList<GDerAttr>();
- for (DerAttr attr : group.getDerAttrs()) {
- boolean found = false;
- for (GDerAttrTemplate template : group.findInheritedTemplates(GDerAttrTemplate.class)) {
- if (template.getSchema().equals(attr.getSchema())) {
- found = true;
- }
- }
+ List<GDerAttr> rDerToBeDeleted = new ArrayList<>();
+ for (final DerAttr attr : group.getDerAttrs()) {
+ boolean found = CollectionUtils.exists(group.findInheritedTemplates(GDerAttrTemplate.class),
+ new Predicate<GDerAttrTemplate>() {
+
+ @Override
+ public boolean evaluate(final GDerAttrTemplate template) {
+ return template.getSchema().equals(attr.getSchema());
+ }
+ });
if (!found) {
rDerToBeDeleted.add((GDerAttr) attr);
}
@@ -459,14 +465,16 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
}
// remove virtual attributes without a valid template
- List<GVirAttr> rVirToBeDeleted = new ArrayList<GVirAttr>();
- for (VirAttr attr : group.getVirAttrs()) {
- boolean found = false;
- for (GVirAttrTemplate template : group.findInheritedTemplates(GVirAttrTemplate.class)) {
- if (template.getSchema().equals(attr.getSchema())) {
- found = true;
- }
- }
+ List<GVirAttr> rVirToBeDeleted = new ArrayList<>();
+ for (final VirAttr attr : group.getVirAttrs()) {
+ boolean found = CollectionUtils.exists(group.findInheritedTemplates(GVirAttrTemplate.class),
+ new Predicate<GVirAttrTemplate>() {
+
+ @Override
+ public boolean evaluate(final GVirAttrTemplate template) {
+ return template.getSchema().equals(attr.getSchema());
+ }
+ });
if (!found) {
LOG.debug("Removing {} from {} because no template is available for it", attr, group);
rVirToBeDeleted.add((GVirAttr) attr);
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
index 094840d..68c5677 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
@@ -32,6 +32,7 @@ import org.apache.syncope.core.persistence.api.entity.Policy;
import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
import org.apache.syncope.core.persistence.jpa.entity.JPAPolicy;
import org.apache.syncope.core.persistence.jpa.entity.JPAAccountPolicy;
+import org.apache.syncope.core.persistence.jpa.entity.JPARealm;
import org.springframework.stereotype.Repository;
@Repository
@@ -145,6 +146,15 @@ public class JPAPolicyDAO extends AbstractDAO<Policy, Long> implements PolicyDAO
@Override
public <T extends Policy> void delete(final T policy) {
+ if (policy instanceof AccountPolicy || policy instanceof PasswordPolicy) {
+ final String field = policy instanceof AccountPolicy ? "accountPolicy" : "passwordPolicy";
+ entityManager.createQuery(
+ "UPDATE " + JPARealm.class.getSimpleName() + " e SET e." + field + " = NULL "
+ + "WHERE e." + field + "=:policy").
+ setParameter("policy", policy).
+ executeUpdate();
+ }
+
entityManager.remove(policy);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
new file mode 100644
index 0000000..896277c
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
@@ -0,0 +1,146 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+import javax.persistence.NoResultException;
+import javax.persistence.TypedQuery;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.syncope.core.persistence.api.dao.MalformedPathException;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.jpa.entity.JPARealm;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class JPARealmDAO extends AbstractDAO<Realm, Long> implements RealmDAO {
+
+ private static final Pattern PATH_PATTERN = Pattern.compile("^(/[A-Za-z0-9]+)+");
+
+ @Override
+ public Realm getRoot() {
+ TypedQuery<Realm> query = entityManager.createQuery(
+ "SELECT e FROM " + JPARealm.class.getSimpleName() + " e WHERE e.parent IS NULL", Realm.class);
+
+ Realm result = null;
+ try {
+ result = query.getSingleResult();
+ } catch (NoResultException e) {
+ LOG.debug("Root realm not found", e);
+ }
+
+ return result;
+ }
+
+ @Override
+ public Realm find(final Long key) {
+ return entityManager.find(JPARealm.class, key);
+ }
+
+ @Override
+ public Realm find(final String fullPath) {
+ if ("/".equals(fullPath)) {
+ return getRoot();
+ }
+
+ if (!PATH_PATTERN.matcher(fullPath).matches()) {
+ throw new MalformedPathException(fullPath);
+ }
+
+ Realm root = getRoot();
+ if (root == null) {
+ return null;
+ }
+
+ Realm current = root;
+ for (final String pathElement : fullPath.substring(1).split("/")) {
+ current = CollectionUtils.find(findChildren(current), new Predicate<Realm>() {
+
+ @Override
+ public boolean evaluate(final Realm realm) {
+ return pathElement.equals(realm.getName());
+ }
+ });
+ if (current == null) {
+ return null;
+ }
+ }
+ return current;
+ }
+
+ @Override
+ public List<Realm> findChildren(final Realm realm) {
+ TypedQuery<Realm> query = entityManager.createQuery(
+ "SELECT e FROM " + JPARealm.class.getSimpleName() + " e WHERE e.parent=:realm", Realm.class);
+ query.setParameter("realm", realm);
+
+ return query.getResultList();
+ }
+
+ private void findDescendants(final List<Realm> result, final Realm realm) {
+ result.add(realm);
+ List<Realm> children = findChildren(realm);
+ if (children != null) {
+ for (Realm child : children) {
+ findDescendants(result, child);
+ }
+ }
+ }
+
+ @Override
+ public List<Realm> findDescendants(final Realm realm) {
+ List<Realm> result = new ArrayList<>();
+ findDescendants(result, realm);
+ return result;
+ }
+
+ @Override
+ public List<Realm> findAll() {
+ TypedQuery<Realm> query = entityManager.createQuery(
+ "SELECT e FROM " + JPARealm.class.getSimpleName() + " e ", Realm.class);
+ return query.getResultList();
+ }
+
+ @Override
+ public Realm save(final Realm realm) {
+ return entityManager.merge(realm);
+ }
+
+ @Override
+ public void delete(final Realm realm) {
+ for (Realm toBeDeleted : findDescendants(realm)) {
+ toBeDeleted.setParent(null);
+ entityManager.remove(toBeDeleted);
+ }
+ }
+
+ @Override
+ public void delete(final Long key) {
+ Realm realm = find(key);
+ if (realm == null) {
+ return;
+ }
+
+ delete(realm);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
index 7cb012a..a4cadf4 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -30,6 +30,7 @@ import org.apache.syncope.core.persistence.api.entity.Notification;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Policy;
import org.apache.syncope.core.persistence.api.entity.PushPolicy;
+import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.Report;
import org.apache.syncope.core.persistence.api.entity.ReportExec;
import org.apache.syncope.core.persistence.api.entity.ReportletConfInstance;
@@ -141,7 +142,9 @@ public class JPAEntityFactory implements EntityFactory {
public <KEY, T extends Entity<KEY>> T newEntity(final Class<T> reference) {
T result;
- if (reference.equals(User.class)) {
+ if (reference.equals(Realm.class)) {
+ result = (T) new JPARealm();
+ } else if (reference.equals(User.class)) {
result = (T) new JPAUser();
} else if (reference.equals(Group.class)) {
result = (T) new JPAGroup();
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java
new file mode 100644
index 0000000..22c48f6
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java
@@ -0,0 +1,116 @@
+/*
+ * 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 javax.persistence.Cacheable;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+import javax.validation.constraints.Size;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.jpa.validation.entity.RealmCheck;
+
+@Entity
+@Table(name = JPARealm.TABLE, uniqueConstraints =
+ @UniqueConstraint(columnNames = { "name", "parent_id" }))
+@Cacheable
+@RealmCheck
+public class JPARealm extends AbstractEntity<Long> implements Realm {
+
+ private static final long serialVersionUID = 5533247460239909964L;
+
+ public static final String TABLE = "Realm";
+
+ @Id
+ private Long id;
+
+ @Size(min = 1)
+ private String name;
+
+ @ManyToOne(optional = true)
+ private JPARealm parent;
+
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ private JPAPasswordPolicy passwordPolicy;
+
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ private JPAAccountPolicy accountPolicy;
+
+ @Override
+ public Long getKey() {
+ return id;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public Realm getParent() {
+ return parent;
+ }
+
+ @Override
+ public String getFullPath() {
+ return getParent() == null
+ ? StringUtils.EMPTY
+ : getParent().getFullPath() + "/" + getName();
+ }
+
+ @Override
+ public AccountPolicy getAccountPolicy() {
+ return accountPolicy == null && getParent() != null ? getParent().getAccountPolicy() : accountPolicy;
+ }
+
+ @Override
+ public PasswordPolicy getPasswordPolicy() {
+ return passwordPolicy == null && getParent() != null ? getParent().getPasswordPolicy() : passwordPolicy;
+ }
+
+ @Override
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public void setParent(final Realm parent) {
+ checkType(parent, JPARealm.class);
+ this.parent = (JPARealm) parent;
+ }
+
+ @Override
+ public void setAccountPolicy(final AccountPolicy accountPolicy) {
+ checkType(accountPolicy, JPAAccountPolicy.class);
+ this.accountPolicy = (JPAAccountPolicy) accountPolicy;
+ }
+
+ @Override
+ public void setPasswordPolicy(final PasswordPolicy passwordPolicy) {
+ checkType(passwordPolicy, JPAPasswordPolicy.class);
+ this.passwordPolicy = (JPAPasswordPolicy) passwordPolicy;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmCheck.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmCheck.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmCheck.java
new file mode 100644
index 0000000..a71417e
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmCheck.java
@@ -0,0 +1,41 @@
+/*
+ * 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.validation.entity;
+
+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;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = RealmValidator.class)
+@Documented
+public @interface RealmCheck {
+
+ String message() default "{org.apache.syncope.core.persistence.validation.realm}";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmValidator.java
new file mode 100644
index 0000000..aa92d00
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmValidator.java
@@ -0,0 +1,67 @@
+/*
+ * 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.validation.entity;
+
+import java.util.regex.Pattern;
+import javax.validation.ConstraintValidatorContext;
+import org.apache.syncope.common.lib.types.EntityViolationType;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+
+public class RealmValidator extends AbstractValidator<RealmCheck, Realm> {
+
+ private static final Pattern NAME_PATTERN = Pattern.compile("^[A-Za-z0-9]+");
+
+ @Override
+ public boolean isValid(final Realm object, final ConstraintValidatorContext context) {
+ context.disableDefaultConstraintViolation();
+
+ boolean isValid = true;
+
+ if ("/".equals(object.getName())) {
+ if (object.getParent() != null) {
+ isValid = false;
+
+ context.buildConstraintViolationWithTemplate(
+ getTemplate(EntityViolationType.InvalidRealm,
+ "Root realm cannot have a parent realm")).
+ addPropertyNode("parent").addConstraintViolation();
+ }
+ } else {
+ if (object.getParent() == null) {
+ isValid = false;
+
+ context.buildConstraintViolationWithTemplate(
+ getTemplate(EntityViolationType.InvalidRealm,
+ "A realm needs to reference a parent realm")).
+ addPropertyNode("parent").addConstraintViolation();
+ }
+
+ if (!NAME_PATTERN.matcher(object.getName()).matches()) {
+ isValid = false;
+
+ context.buildConstraintViolationWithTemplate(
+ getTemplate(EntityViolationType.InvalidRealm,
+ "Only letters and numbers are allowed in realm name")).
+ addPropertyNode("name").addConstraintViolation();
+ }
+ }
+
+ return isValid;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
index f10b6c5..ea3a058 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
@@ -39,6 +39,15 @@ under the License.
<table-generator name="SEQ_MAttrPlainValue" pk-column-value="SEQ_MAttrPlainValue" initial-value="100"/>
<table-generator name="SEQ_CAttrPlainValue" pk-column-value="SEQ_CAttrPlainValue" initial-value="100"/>
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.JPARealm">
+ <attributes>
+ <id name="id">
+ <generated-value generator="SEQ_Realm" strategy="TABLE"/>
+ <table-generator name="SEQ_Realm" pk-column-value="SEQ_Realm" initial-value="100"/>
+ </id>
+ </attributes>
+ </entity>
+
<entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUser">
<attributes>
<id name="id">
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
index f10b6c5..ea3a058 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
@@ -39,6 +39,15 @@ under the License.
<table-generator name="SEQ_MAttrPlainValue" pk-column-value="SEQ_MAttrPlainValue" initial-value="100"/>
<table-generator name="SEQ_CAttrPlainValue" pk-column-value="SEQ_CAttrPlainValue" initial-value="100"/>
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.JPARealm">
+ <attributes>
+ <id name="id">
+ <generated-value generator="SEQ_Realm" strategy="TABLE"/>
+ <table-generator name="SEQ_Realm" pk-column-value="SEQ_Realm" initial-value="100"/>
+ </id>
+ </attributes>
+ </entity>
+
<entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUser">
<attributes>
<id name="id">
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
index d0959c8..e26f6d0 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
@@ -39,6 +39,15 @@ under the License.
<table-generator name="SEQ_MAttrPlainValue" pk-column-value="SEQ_MAttrPlainValue" initial-value="100"/>
<table-generator name="SEQ_CAttrPlainValue" pk-column-value="SEQ_CAttrPlainValue" initial-value="100"/>
+ <entity class="org.apache.syncope.core.persistence.jpa.entity.JPARealm">
+ <attributes>
+ <id name="id">
+ <generated-value generator="SEQ_Realm" strategy="TABLE"/>
+ <table-generator name="SEQ_Realm" pk-column-value="SEQ_Realm" initial-value="100"/>
+ </id>
+ </attributes>
+ </entity>
+
<entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUser">
<attributes>
<id name="id">
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/main/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/content.xml b/core/persistence-jpa/src/main/resources/content.xml
index 7630245..e060c62 100644
--- a/core/persistence-jpa/src/main/resources/content.xml
+++ b/core/persistence-jpa/src/main/resources/content.xml
@@ -18,6 +18,8 @@ specific language governing permissions and limitations
under the License.
-->
<dataset>
+ <Realm id="1" name="/"/>
+
<SyncopeConf id="1"
creator="admin" lastModifier="admin"
creationDate="2014-06-20 11:00:00" lastChangeDate="2014-06-20 11:00:00"/>
@@ -109,6 +111,10 @@ under the License.
<Notification_events Notification_id="2" events="[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"/>
<!-- Authentication and authorization -->
+ <Entitlement name="REALM_LIST"/>
+ <Entitlement name="REALM_CREATE"/>
+ <Entitlement name="REALM_UPDATE"/>
+ <Entitlement name="REALM_DELETE"/>
<Entitlement name="SCHEMA_LIST"/>
<Entitlement name="SCHEMA_CREATE"/>
<Entitlement name="SCHEMA_READ"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
index dd59873..ccea7da 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/EntitlementTest.java
@@ -39,7 +39,7 @@ public class EntitlementTest extends AbstractTest {
@Test
public void findAll() {
List<Entitlement> list = entitlementDAO.findAll();
- assertEquals("did not get expected number of entitlements ", 86, list.size());
+ assertEquals("did not get expected number of entitlements ", 90, list.size());
}
@Test
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
new file mode 100644
index 0000000..a08a37f
--- /dev/null
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
@@ -0,0 +1,171 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.syncope.common.lib.types.EntityViolationType;
+import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
+import org.apache.syncope.core.persistence.api.dao.MalformedPathException;
+import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.jpa.AbstractTest;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class RealmTest extends AbstractTest {
+
+ @Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
+ private PolicyDAO policyDAO;
+
+ @Test
+ public void getRoot() {
+ assertNotNull(realmDAO.getRoot());
+ }
+
+ @Test
+ public void find() {
+ Realm realm = realmDAO.find(3L);
+ assertNotNull(realm);
+ assertEquals("even", realm.getName());
+ assertEquals(1, realm.getParent().getKey(), 0);
+ assertEquals(realmDAO.getRoot(), realm.getParent());
+
+ realm = realmDAO.find("/even/two");
+ assertNotNull(realm);
+ assertEquals(4, realm.getKey(), 0);
+ assertEquals("two", realm.getName());
+ assertEquals("/even/two", realm.getFullPath());
+ }
+
+ @Test(expected = MalformedPathException.class)
+ public void findInvalidPath() {
+ realmDAO.find("even/two");
+ }
+
+ @Test
+ public void findChildren() {
+ List<Realm> children = realmDAO.findChildren(realmDAO.find("/"));
+ assertEquals(2, children.size());
+ assertTrue(children.contains(realmDAO.find("/odd")));
+ assertTrue(children.contains(realmDAO.find("/even")));
+
+ children = realmDAO.findChildren(realmDAO.find("/odd"));
+ assertTrue(children.isEmpty());
+ }
+
+ @Test
+ public void findDescendants() {
+ assertTrue(CollectionUtils.disjunction(realmDAO.findAll(), realmDAO.findDescendants(realmDAO.getRoot())).
+ isEmpty());
+ }
+
+ @Test
+ public void findAll() {
+ List<Realm> list = realmDAO.findAll();
+ assertNotNull(list);
+ assertFalse(list.isEmpty());
+ for (Realm realm : list) {
+ assertNotNull(realm);
+ }
+ }
+
+ @Test
+ public void save() {
+ Realm realm = entityFactory.newEntity(Realm.class);
+ realm.setName("last");
+ realm.setParent(realmDAO.find("/even/two"));
+ assertNull(realm.getKey());
+
+ Realm actual = realmDAO.save(realm);
+ assertNotNull(actual.getKey());
+ assertEquals("last", actual.getName());
+ assertEquals("/even/two/last", actual.getFullPath());
+ assertEquals(realmDAO.find("/even/two"), actual.getParent());
+ assertNull(realm.getAccountPolicy());
+ assertNull(realm.getPasswordPolicy());
+
+ realm = actual;
+ realm.setAccountPolicy((AccountPolicy) policyDAO.find(6L));
+ realm.setPasswordPolicy((PasswordPolicy) policyDAO.find(4L));
+
+ actual = realmDAO.save(realm);
+ assertNotNull(actual.getAccountPolicy());
+ assertNotNull(actual.getPasswordPolicy());
+ }
+
+ @Test
+ public void saveInvalidName() {
+ Realm realm = entityFactory.newEntity(Realm.class);
+ realm.setName(" a name");
+ realm.setParent(realmDAO.getRoot());
+
+ try {
+ realmDAO.save(realm);
+ fail();
+ } catch (InvalidEntityException e) {
+ assertTrue(e.hasViolation(EntityViolationType.InvalidRealm));
+ }
+ }
+
+ @Test
+ public void saveNullParent() {
+ Realm realm = entityFactory.newEntity(Realm.class);
+ realm.setName("name");
+ realm.setParent(null);
+
+ try {
+ realmDAO.save(realm);
+ fail();
+ } catch (InvalidEntityException e) {
+ assertTrue(e.hasViolation(EntityViolationType.InvalidRealm));
+ }
+ }
+
+ @Test
+ public void delete() {
+ Realm realm = entityFactory.newEntity(Realm.class);
+ realm.setName("name");
+ realm.setParent(realmDAO.getRoot());
+
+ Realm actual = realmDAO.save(realm);
+ assertNotNull(actual);
+
+ Long key = actual.getKey();
+ assertNotNull(realmDAO.find(key));
+
+ realmDAO.delete(key);
+ assertNull(realmDAO.find(key));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/persistence-jpa/src/test/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/resources/content.xml b/core/persistence-jpa/src/test/resources/content.xml
index 6c6e527..339d706 100644
--- a/core/persistence-jpa/src/test/resources/content.xml
+++ b/core/persistence-jpa/src/test/resources/content.xml
@@ -18,6 +18,11 @@ specific language governing permissions and limitations
under the License.
-->
<dataset>
+ <Realm id="1" name="/"/>
+ <Realm id="2" name="odd" parent_id="1"/>
+ <Realm id="3" name="even" parent_id="1"/>
+ <Realm id="4" name="two" parent_id="3"/>
+
<SyncopeConf id="1"
creator="admin" lastModifier="admin"
creationDate="2014-06-20 11:00:00" lastChangeDate="2014-06-20 11:00:00"/>
@@ -127,66 +132,66 @@ under the License.
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00" suspended="0"/>
<SyncopeGroup id="1" name="root"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="2" name="child" parent_id="1"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="3" name="citizen"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="4" name="employee" parent_id="3"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="5" name="secretary" parent_id="4"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="6"
- name="director" parent_id="4" userOwner_id="5"
- inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
- inheritPasswordPolicy="0" inheritAccountPolicy="0"
- passwordPolicy_id="4"
- accountPolicy_id="6"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ name="director" parent_id="4" userOwner_id="5"
+ inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
+ inheritPasswordPolicy="0" inheritAccountPolicy="0"
+ passwordPolicy_id="4"
+ accountPolicy_id="6"
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="7"
- name="managingDirector" parent_id="6"
- inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
- inheritPasswordPolicy="1" inheritAccountPolicy="1" inheritOwner="1"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ name="managingDirector" parent_id="6"
+ inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
+ inheritPasswordPolicy="1" inheritAccountPolicy="1" inheritOwner="1"
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="8"
- name="otherchild" parent_id="1"
- inheritVirAttrs="1"
- passwordPolicy_id="4"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ name="otherchild" parent_id="1"
+ inheritVirAttrs="1"
+ passwordPolicy_id="4"
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="9" name="groupForWorkflowApproval" parent_id="1"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="10"
- name="managingConsultant" parent_id="6"
- inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
- inheritPasswordPolicy="1" inheritAccountPolicy="1" inheritOwner="0"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ name="managingConsultant" parent_id="6"
+ inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
+ inheritPasswordPolicy="1" inheritAccountPolicy="1" inheritOwner="0"
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="11" name="groupForWorkflowOptIn" parent_id="1"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="12" name="aGroupForPropagation" parent_id="1"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="13" name="bGroupForPropagation" parent_id="1"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<SyncopeGroup id="14"
- name="artDirector" parent_id="4"
- inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
- inheritPasswordPolicy="0" inheritAccountPolicy="0"
- passwordPolicy_id="8"
- accountPolicy_id="6"
- creator="admin" lastModifier="admin"
- creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+ name="artDirector" parent_id="4"
+ inheritPlainAttrs="1" inheritDerAttrs="1" inheritVirAttrs="1"
+ inheritPasswordPolicy="0" inheritAccountPolicy="0"
+ passwordPolicy_id="8"
+ accountPolicy_id="6"
+ creator="admin" lastModifier="admin"
+ creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<Membership id="1" user_id="1" group_id="1"
creator="admin" lastModifier="admin"
@@ -1019,6 +1024,10 @@ under the License.
<!-- Authentication and authorization -->
<Entitlement name="base"/>
<Entitlement name="advanced" description="Advanced entitlement"/>
+ <Entitlement name="REALM_LIST"/>
+ <Entitlement name="REALM_CREATE"/>
+ <Entitlement name="REALM_UPDATE"/>
+ <Entitlement name="REALM_DELETE"/>
<Entitlement name="SCHEMA_LIST"/>
<Entitlement name="SCHEMA_CREATE"/>
<Entitlement name="SCHEMA_READ"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
index 1f0ef11..2c69f4b 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
@@ -37,7 +37,7 @@ public interface ConnIdBundleManager {
ConnectorInfo getConnectorInfo(final String location, final String bundleName, final String bundleVersion,
final String connectorName);
- Map<String, List<ConnectorInfo>> getConnectorInfos();
+ Map<URI, ConnectorInfoManager> getConnInfoManagers();
void resetConnManagers();
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RealmDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RealmDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RealmDataBinder.java
new file mode 100644
index 0000000..1697cd9
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/RealmDataBinder.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.provisioning.api.data;
+
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+
+public interface RealmDataBinder {
+
+ Realm create(String parentPath, RealmTO realmTO);
+
+ void update(Realm realm, RealmTO realmTO);
+
+ RealmTO getRealmTO(Realm realm);
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java
index 6d42ac8..babfb5e 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java
@@ -18,8 +18,6 @@
*/
package org.apache.syncope.core.provisioning.api.data;
-import java.util.Collection;
-import java.util.List;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
@@ -32,8 +30,6 @@ public interface ResourceDataBinder {
ResourceTO getResourceTO(ExternalResource resource);
- List<ResourceTO> getResourceTOs(Collection<? extends ExternalResource> resources);
-
ExternalResource update(ExternalResource resource, ResourceTO resourceTO);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SchemaDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SchemaDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SchemaDataBinder.java
index 52fd20b..49e1138 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SchemaDataBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SchemaDataBinder.java
@@ -36,7 +36,7 @@ public interface SchemaDataBinder {
<T extends DerSchema> DerSchemaTO getDerSchemaTO(T derSchema);
- <T extends PlainSchema> PlainSchemaTO getSchemaTO(T schema, AttributableUtil attributableUtil);
+ <T extends PlainSchema> PlainSchemaTO getPlainSchemaTO(T schema, AttributableUtil attributableUtil);
<T extends VirSchema> VirSchemaTO getVirSchemaTO(T virSchema);
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnIdBundleManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnIdBundleManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnIdBundleManagerImpl.java
index 461794e..c7ea22a 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnIdBundleManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnIdBundleManagerImpl.java
@@ -256,12 +256,8 @@ public class ConnIdBundleManagerImpl implements ConnIdBundleManager {
}
@Override
- public Map<String, List<ConnectorInfo>> getConnectorInfos() {
- final Map<String, List<ConnectorInfo>> infos = new LinkedHashMap<>();
- for (Map.Entry<URI, ConnectorInfoManager> entry : connInfoManagers.entrySet()) {
- infos.put(entry.getKey().toString(), entry.getValue().getConnectorInfos());
- }
- return infos;
+ public Map<URI, ConnectorInfoManager> getConnInfoManagers() {
+ return connInfoManagers;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
new file mode 100644
index 0000000..a5f12aa
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
@@ -0,0 +1,88 @@
+/*
+ * 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.provisioning.java.data;
+
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.provisioning.api.data.RealmDataBinder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RealmDataBinderImpl implements RealmDataBinder {
+
+ @Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
+ private PolicyDAO policyDAO;
+
+ @Autowired
+ private EntityFactory entityFactory;
+
+ @Override
+ public Realm create(final String parentPath, final RealmTO realmTO) {
+ Realm realm = entityFactory.newEntity(Realm.class);
+
+ realm.setName(realmTO.getName());
+ realm.setParent(realmDAO.find(parentPath));
+
+ if (realmTO.getPasswordPolicy() != null) {
+ realm.setPasswordPolicy((PasswordPolicy) policyDAO.find(realmTO.getPasswordPolicy()));
+ }
+ if (realmTO.getAccountPolicy() != null) {
+ realm.setAccountPolicy((AccountPolicy) policyDAO.find(realmTO.getAccountPolicy()));
+ }
+
+ return realm;
+ }
+
+ @Override
+ public void update(final Realm realm, final RealmTO realmTO) {
+ realm.setName(realmTO.getName());
+ realm.setParent(realmTO.getParent() == 0 ? null : realmDAO.find(realmTO.getParent()));
+
+ if (realmTO.getPasswordPolicy() != null) {
+ realm.setPasswordPolicy((PasswordPolicy) policyDAO.find(realmTO.getPasswordPolicy()));
+ }
+ if (realmTO.getAccountPolicy() != null) {
+ realm.setAccountPolicy((AccountPolicy) policyDAO.find(realmTO.getAccountPolicy()));
+ }
+ }
+
+ @Override
+ public RealmTO getRealmTO(final Realm realm) {
+ RealmTO realmTO = new RealmTO();
+
+ realmTO.setKey(realm.getKey());
+ realmTO.setName(realm.getName());
+ realmTO.setParent(realm.getParent() == null ? 0 : realm.getParent().getKey());
+ realmTO.setFullPath(realm.getFullPath());
+ realmTO.setAccountPolicy(realm.getAccountPolicy() == null ? null : realm.getAccountPolicy().getKey());
+ realmTO.setPasswordPolicy(realm.getPasswordPolicy() == null ? null : realm.getPasswordPolicy().getKey());
+
+ return realmTO;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
index 8823a19..05a0648 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
@@ -19,10 +19,8 @@
package org.apache.syncope.core.provisioning.java.data;
import org.apache.syncope.core.provisioning.api.data.ResourceDataBinder;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.syncope.common.lib.SyncopeClientCompositeException;
@@ -237,16 +235,6 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
}
@Override
- public List<ResourceTO> getResourceTOs(final Collection<? extends ExternalResource> resources) {
- List<ResourceTO> resourceTOs = new ArrayList<>();
- for (ExternalResource resource : resources) {
- resourceTOs.add(getResourceTO(resource));
- }
-
- return resourceTOs;
- }
-
- @Override
public ResourceTO getResourceTO(final ExternalResource resource) {
if (resource == null) {
return null;
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
index c0adde2..7167922 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
@@ -90,7 +90,7 @@ public class SchemaDataBinderImpl implements SchemaDataBinder {
}
@Override
- public <T extends PlainSchema> PlainSchemaTO getSchemaTO(
+ public <T extends PlainSchema> PlainSchemaTO getPlainSchemaTO(
final T schema, final AttributableUtil attributableUtil) {
PlainSchemaTO schemaTO = new PlainSchemaTO();
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
index dac783b..cdfb6fe 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
@@ -36,7 +36,7 @@ import org.apache.syncope.common.lib.types.AuditElements.Result;
import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.misc.CollectionUtils2;
+import org.apache.syncope.common.lib.CollectionUtils2;
import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.ConfDAO;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderTest.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderTest.java b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderTest.java
index 40764ab..a8305a6 100644
--- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderTest.java
+++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderTest.java
@@ -21,15 +21,9 @@ package org.apache.syncope.core.provisioning.java.data;
import org.apache.syncope.core.provisioning.java.AbstractTest;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.apache.syncope.common.lib.to.MappingItemTO;
import org.apache.syncope.common.lib.to.MappingTO;
@@ -60,36 +54,6 @@ public class ResourceDataBinderTest extends AbstractTest {
private PlainSchemaDAO plainSchemaDAO;
@Test
- public void databinding() throws IOException {
- ExternalResource resource = resourceDAO.find("ws-target-resource-2");
- assertNotNull(resource);
-
- ResourceTO resourceTO = resourceDataBinder.getResourceTO(resource);
- assertNotNull(resourceTO);
-
- ExternalResource fromto = resourceDataBinder.update(resource, resourceTO);
- assertNotNull(fromto);
- assertEquals(resource, fromto);
-
- ObjectMapper mapper = new ObjectMapper();
-
- StringWriter writer = new StringWriter();
- mapper.writeValue(writer, resourceTO);
-
- assertEquals(resourceTO, mapper.readValue(writer.toString(), ResourceTO.class));
-
- List<ResourceTO> resourceTOs = resourceDataBinder.getResourceTOs(resourceDAO.findAll());
- assertNotNull(resourceTOs);
- assertFalse(resourceTOs.isEmpty());
-
- writer = new StringWriter();
- mapper.writeValue(writer, resourceTOs);
-
- ResourceTO[] actual = mapper.readValue(writer.toString(), ResourceTO[].class);
- assertEquals(resourceTOs, Arrays.asList(actual));
- }
-
- @Test
public void issue42() {
UPlainSchema userId = plainSchemaDAO.find("userId", UPlainSchema.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
index 3b4369c..f2a41d5 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
@@ -46,6 +46,7 @@ import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
import org.apache.syncope.core.persistence.api.dao.DuplicateException;
+import org.apache.syncope.core.persistence.api.dao.MalformedPathException;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.workflow.api.WorkflowException;
import org.identityconnectors.framework.common.exceptions.ConfigurationException;
@@ -89,11 +90,11 @@ public class RestServiceExceptionMapper implements ExceptionMapper<Exception>, R
builder = Response.status(Response.Status.UNAUTHORIZED).
header(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM_UNAUTHORIZED);
} else if (ex instanceof UnauthorizedGroupException) {
- builder = builder(Response.Status.UNAUTHORIZED, ClientExceptionType.UnauthorizedGroup, getExMessage(ex));
+ builder = builder(ClientExceptionType.UnauthorizedGroup, getExMessage(ex));
} else if (ex instanceof EntityExistsException || ex instanceof DuplicateException) {
- builder = builder(Response.Status.CONFLICT, ClientExceptionType.EntityExists, getExMessage(ex));
+ builder = builder(ClientExceptionType.EntityExists, getExMessage(ex));
} else if (ex instanceof DataIntegrityViolationException) {
- builder = builder(Response.Status.CONFLICT, ClientExceptionType.DataIntegrityViolation, getExMessage(ex));
+ builder = builder(ClientExceptionType.DataIntegrityViolation, getExMessage(ex));
} else {
builder = processNotFoundExceptions(ex);
if (builder == null) {
@@ -161,7 +162,7 @@ public class RestServiceExceptionMapper implements ExceptionMapper<Exception>, R
ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
- List<ErrorTO> errors = new ArrayList<ErrorTO>();
+ List<ErrorTO> errors = new ArrayList<>();
for (SyncopeClientException sce : ex.getExceptions()) {
builder.header(RESTHeaders.ERROR_CODE, sce.getType().getHeaderValue());
@@ -182,7 +183,7 @@ public class RestServiceExceptionMapper implements ExceptionMapper<Exception>, R
private ResponseBuilder processNotFoundExceptions(final Exception ex) {
if (ex instanceof javax.ws.rs.NotFoundException || ex instanceof NotFoundException) {
- return builder(Response.Status.NOT_FOUND, ClientExceptionType.NotFound, getExMessage(ex));
+ return builder(ClientExceptionType.NotFound, getExMessage(ex));
}
return null;
@@ -245,30 +246,32 @@ public class RestServiceExceptionMapper implements ExceptionMapper<Exception>, R
return JAXRSUtils.fromResponse(((BadRequestException) ex).getResponse());
}
} else if (ex instanceof WorkflowException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.Workflow, getExMessage(ex));
+ return builder(ClientExceptionType.Workflow, getExMessage(ex));
} else if (ex instanceof PersistenceException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.GenericPersistence, getExMessage(ex));
+ return builder(ClientExceptionType.GenericPersistence, getExMessage(ex));
} else if (ibatisPersistenceException != null && ibatisPersistenceException.isAssignableFrom(ex.getClass())) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.Workflow,
+ return builder(ClientExceptionType.Workflow,
getMessage(ex, "Currently unavailable. Please try later."));
} else if (ex instanceof JpaSystemException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.DataIntegrityViolation, getExMessage(ex));
+ return builder(ClientExceptionType.DataIntegrityViolation, getExMessage(ex));
} else if (ex instanceof ConfigurationException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.InvalidConnIdConf, getExMessage(ex));
+ return builder(ClientExceptionType.InvalidConnIdConf, getExMessage(ex));
} else if (ex instanceof ParsingValidationException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.InvalidValues, getExMessage(ex));
+ return builder(ClientExceptionType.InvalidValues, getExMessage(ex));
+ } else if (ex instanceof MalformedPathException) {
+ return builder(ClientExceptionType.InvalidPath, getExMessage(ex));
}
return null;
}
- private ResponseBuilder builder(final Response.Status status, final ClientExceptionType hType, final String msg) {
- ResponseBuilder builder = Response.status(status).
+ private ResponseBuilder builder(final ClientExceptionType hType, final String msg) {
+ ResponseBuilder builder = Response.status(hType.getResponseStatus()).
header(RESTHeaders.ERROR_CODE, hType.getHeaderValue()).
header(RESTHeaders.ERROR_INFO, hType.getInfoHeaderValue(msg));
ErrorTO error = new ErrorTO();
- error.setStatus(status.getStatusCode());
+ error.setStatus(hType.getResponseStatus().getStatusCode());
error.setType(hType);
error.getElements().add(msg);
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
new file mode 100644
index 0000000..79f506c
--- /dev/null
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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 java.net.URI;
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.service.RealmService;
+import org.apache.syncope.core.logic.RealmLogic;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class RealmServiceImpl extends AbstractServiceImpl implements RealmService {
+
+ @Autowired
+ private RealmLogic logic;
+
+ @Override
+ public List<RealmTO> list() {
+ return list(StringUtils.EMPTY);
+ }
+
+ @Override
+ public List<RealmTO> list(final String fullPath) {
+ return logic.list(StringUtils.prependIfMissing(fullPath, "/"));
+ }
+
+ @Override
+ public Response create(final String parentPath, final RealmTO realmTO) {
+ RealmTO created = logic.create(StringUtils.prependIfMissing(parentPath, "/"), realmTO);
+ URI location = uriInfo.getAbsolutePathBuilder().path(created.getName()).build();
+ return Response.created(location).
+ header(RESTHeaders.RESOURCE_ID, created.getFullPath()).
+ build();
+ }
+
+ @Override
+ public void update(final String fullPath, final RealmTO realmTO) {
+ realmTO.setFullPath(StringUtils.prependIfMissing(fullPath, "/"));
+ logic.update(realmTO);
+ }
+
+ @Override
+ public void delete(final String fullPath) {
+ logic.delete(StringUtils.prependIfMissing(fullPath, "/"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
index fc4af36..ed264d5 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
@@ -58,6 +58,7 @@ import org.apache.syncope.common.rest.api.service.PolicyService;
import org.apache.syncope.common.rest.api.service.ReportService;
import org.apache.syncope.common.rest.api.service.ResourceService;
import org.apache.syncope.common.rest.api.service.GroupService;
+import org.apache.syncope.common.rest.api.service.RealmService;
import org.apache.syncope.common.rest.api.service.SchemaService;
import org.apache.syncope.common.rest.api.service.SecurityQuestionService;
import org.apache.syncope.common.rest.api.service.SyncopeService;
@@ -146,6 +147,8 @@ public abstract class AbstractITCase {
protected static SyncopeService syncopeService;
+ protected static RealmService realmService;
+
protected static UserService userService;
protected static UserSelfService userSelfService;
@@ -214,6 +217,7 @@ public abstract class AbstractITCase {
adminClient = clientFactory.create(ADMIN_UNAME, ADMIN_PWD);
syncopeService = adminClient.getService(SyncopeService.class);
+ realmService = adminClient.getService(RealmService.class);
userService = adminClient.getService(UserService.class);
userSelfService = adminClient.getService(UserSelfService.class);
userWorkflowService = adminClient.getService(UserWorkflowService.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
index edbb5e1..ce2cbd5 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
@@ -540,7 +540,7 @@ public class GroupITCase extends AbstractITCase {
@Test
public void provision() {
- GroupTO groupTO = buildGroupTO("assign");
+ GroupTO groupTO = buildGroupTO("assign" + getUUIDString());
groupTO.getResources().clear();
GroupTO actual = createGroup(groupTO);
@@ -566,7 +566,7 @@ public class GroupITCase extends AbstractITCase {
@Test
public void deprovisionUnlinked() {
- GroupTO groupTO = buildGroupTO("assign");
+ GroupTO groupTO = buildGroupTO("assign" + getUUIDString());
groupTO.getResources().clear();
GroupTO actual = createGroup(groupTO);
@@ -826,7 +826,7 @@ public class GroupITCase extends AbstractITCase {
assertNotNull(newLDAP);
// 2. create a group and give the resource created above
- groupTO = buildGroupTO("lastGroup");
+ groupTO = buildGroupTO("lastGroup" + getUUIDString());
groupTO.getGPlainAttrTemplates().add("icon");
groupTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
groupTO.getGPlainAttrTemplates().add("show");
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
index d5c9570..955a216 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
@@ -78,8 +78,7 @@ public class NotificationITCase extends AbstractITCase {
notificationTO.setRecipients(SyncopeClient.getUserSearchConditionBuilder().inGroups(7L).query());
Response response = notificationService.create(notificationTO);
- NotificationTO actual = getObject(response.getLocation(), NotificationService.class,
- NotificationTO.class);
+ NotificationTO actual = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
assertNotNull(actual);
assertNotNull(actual.getKey());
http://git-wip-us.apache.org/repos/asf/syncope/blob/423e4cca/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java
new file mode 100644
index 0000000..bfc2448
--- /dev/null
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java
@@ -0,0 +1,186 @@
+/*
+ * 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.fit.core.reference;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.AccountPolicyTO;
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.common.lib.types.AccountPolicySpec;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.rest.api.service.RealmService;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.JVM)
+public class RealmITCase extends AbstractITCase {
+
+ private RealmTO getRealm(final String fullPath) {
+ return CollectionUtils.find(realmService.list(fullPath), new Predicate<RealmTO>() {
+
+ @Override
+ public boolean evaluate(final RealmTO object) {
+ return fullPath.equals(object.getFullPath());
+ }
+ });
+ }
+
+ @Test
+ public void list() {
+ List<RealmTO> realms = realmService.list();
+ assertNotNull(realms);
+ assertFalse(realms.isEmpty());
+ for (RealmTO realm : realms) {
+ assertNotNull(realm);
+ }
+
+ try {
+ realmService.list("a name");
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(ClientExceptionType.InvalidPath, e.getType());
+ }
+ }
+
+ @Test
+ public void createUpdate() {
+ final RealmTO realm = new RealmTO();
+ realm.setName("last");
+
+ // 1. create
+ Response response = realmService.create("/even/two", realm);
+ RealmTO[] actuals = getObject(response.getLocation(), RealmService.class, RealmTO[].class);
+ assertNotNull(actuals);
+ assertTrue(actuals.length > 0);
+ RealmTO actual = actuals[0];
+ assertNotNull(actual.getKey());
+ assertEquals("last", actual.getName());
+ assertEquals("/even/two/last", actual.getFullPath());
+ assertEquals(actual.getParent(), getRealm("/even/two").getKey());
+ assertNull(realm.getAccountPolicy());
+ assertNull(realm.getPasswordPolicy());
+
+ // 2. update setting policies
+ actual.setAccountPolicy(6L);
+ actual.setPasswordPolicy(4L);
+ realmService.update(actual.getFullPath(), actual);
+
+ actual = getRealm(actual.getFullPath());
+ assertNotNull(actual.getAccountPolicy());
+ assertNotNull(actual.getPasswordPolicy());
+
+ // 3. update changing parent
+ actual.setParent(getRealm("/odd").getKey());
+ realmService.update(actual.getFullPath(), actual);
+
+ actual = getRealm("/odd/last");
+ assertNotNull(actual);
+ assertEquals("/odd/last", actual.getFullPath());
+
+ assertEquals(1, CollectionUtils.countMatches(realmService.list(), new Predicate<RealmTO>() {
+
+ @Override
+ public boolean evaluate(final RealmTO object) {
+ return realm.getName().equals(object.getName());
+ }
+ }));
+
+ // 4. create under invalid path
+ try {
+ realmService.create("a name", realm);
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(ClientExceptionType.InvalidPath, e.getType());
+ }
+
+ // 5. attempt to create duplicate
+ try {
+ realmService.create("/odd", realm);
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(ClientExceptionType.DataIntegrityViolation, e.getType());
+ }
+ }
+
+ @Test
+ public void deletingAccountPolicy() {
+ // 1. create account policy
+ AccountPolicyTO policy = new AccountPolicyTO(false);
+ policy.setDescription("deletingAccountPolicy");
+
+ final AccountPolicySpec accountPolicySpec = new AccountPolicySpec();
+ accountPolicySpec.setMinLength(3);
+ accountPolicySpec.setMaxLength(8);
+ policy.setSpecification(accountPolicySpec);
+
+ policy = createPolicy(policy);
+ assertNotNull(policy);
+
+ // 2. create realm with policy assigned
+ RealmTO realm = new RealmTO();
+ realm.setName("withppolicy");
+ realm.setAccountPolicy(policy.getKey());
+
+ Response response = realmService.create("/", realm);
+ RealmTO[] actuals = getObject(response.getLocation(), RealmService.class, RealmTO[].class);
+ assertNotNull(actuals);
+ assertTrue(actuals.length > 0);
+ RealmTO actual = actuals[0];
+ assertEquals(policy.getKey(), actual.getAccountPolicy(), 0);
+
+ // 3. remove policy
+ policyService.delete(policy.getKey());
+
+ // 4. verify
+ actual = getRealm(actual.getFullPath());
+ assertNull(actual.getAccountPolicy());
+ }
+
+ @Test
+ public void delete() {
+ RealmTO realm = new RealmTO();
+ realm.setName("deletable");
+
+ Response response = realmService.create("/even/two", realm);
+ RealmTO[] actuals = getObject(response.getLocation(), RealmService.class, RealmTO[].class);
+ assertNotNull(actuals);
+ assertTrue(actuals.length > 0);
+ RealmTO actual = actuals[0];
+
+ realmService.delete(actual.getFullPath());
+
+ try {
+ realmService.list(actual.getFullPath());
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(ClientExceptionType.NotFound, e.getType());
+ }
+ }
+}
[27/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
[SYNCOPE-119] Renaming Role to Group
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4095f1e8
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4095f1e8
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4095f1e8
Branch: refs/heads/master
Commit: 4095f1e84bc22e0f0253e1ccf0c4daeddd2c1b35
Parents: f76826f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Apr 6 18:13:31 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Apr 6 18:13:31 2015 +0200
----------------------------------------------------------------------
.../client/console/SyncopeApplication.java | 12 +-
.../client/console/commons/AttrLayoutType.java | 12 +-
.../client/console/commons/Constants.java | 10 +-
.../console/commons/GroupTreeBuilder.java | 128 +++
.../client/console/commons/RoleTreeBuilder.java | 116 ---
.../client/console/commons/RoleUtils.java | 36 -
.../console/commons/status/StatusBean.java | 4 +-
.../console/commons/status/StatusUtils.java | 4 +-
.../client/console/pages/AbstractBasePage.java | 4 +-
.../pages/BulkActionResultModalPage.java | 2 +-
.../client/console/pages/Configuration.java | 4 +-
.../client/console/pages/GroupModalPage.java | 164 ++++
.../console/pages/GroupSelectModalPage.java | 105 +++
.../console/pages/GroupTemplateModalPage.java | 50 ++
.../syncope/client/console/pages/Groups.java | 186 ++++
.../console/pages/NotificationModalPage.java | 38 +-
.../client/console/pages/PolicyModalPage.java | 47 +-
.../console/pages/ProvisioningModalPage.java | 11 +-
.../client/console/pages/PushTaskModalPage.java | 28 +-
.../console/pages/ReportletConfModalPage.java | 18 +-
.../client/console/pages/ResourceModalPage.java | 8 +-
.../syncope/client/console/pages/Resources.java | 6 +-
.../console/pages/ResultStatusModalPage.java | 11 +-
.../client/console/pages/RoleModalPage.java | 162 ----
.../console/pages/RoleSelectModalPage.java | 105 ---
.../console/pages/RoleTemplateModalPage.java | 50 --
.../syncope/client/console/pages/Roles.java | 186 ----
.../syncope/client/console/pages/Schema.java | 16 +-
.../client/console/pages/StatusModalPage.java | 35 +-
.../client/console/pages/UserModalPage.java | 2 +-
.../console/panels/AbstractSearchPanel.java | 30 +-
.../console/panels/AttrTemplatesPanel.java | 46 +-
.../client/console/panels/DerAttrsPanel.java | 28 +-
.../console/panels/GroupDetailsPanel.java | 435 +++++++++
.../client/console/panels/GroupPanel.java | 187 ++++
.../client/console/panels/GroupSearchPanel.java | 101 +++
.../console/panels/GroupSearchResultPanel.java | 172 ++++
.../console/panels/GroupSecurityPanel.java | 198 +++++
.../console/panels/GroupSummaryPanel.java | 153 ++++
.../client/console/panels/GroupTabPanel.java | 195 ++++
.../client/console/panels/MembershipsPanel.java | 49 +-
.../client/console/panels/PlainAttrsPanel.java | 32 +-
.../client/console/panels/PolicyBeanPanel.java | 24 +-
.../console/panels/ResourceMappingPanel.java | 30 +-
.../client/console/panels/ResourcesPanel.java | 19 +-
.../client/console/panels/RoleDetailsPanel.java | 435 ---------
.../client/console/panels/RolePanel.java | 187 ----
.../client/console/panels/RoleSearchPanel.java | 101 ---
.../console/panels/RoleSearchResultPanel.java | 172 ----
.../console/panels/RoleSecurityPanel.java | 198 -----
.../client/console/panels/RoleSummaryPanel.java | 153 ----
.../client/console/panels/RoleTabPanel.java | 195 ----
.../client/console/panels/SearchView.java | 8 +-
.../panels/SelectOnlyUserSearchResultPanel.java | 2 +-
.../client/console/panels/StatusPanel.java | 21 +-
.../client/console/panels/SyncTasksPanel.java | 9 +-
.../client/console/panels/UserSearchPanel.java | 20 +-
.../client/console/panels/VirAttrsPanel.java | 31 +-
.../client/console/rest/GroupRestClient.java | 184 ++++
.../client/console/rest/ResourceRestClient.java | 2 +-
.../client/console/rest/RoleRestClient.java | 184 ----
.../wicket/markup/html/form/ActionLink.java | 4 +-
.../markup/html/form/ActionLinksPanel.java | 20 +-
.../markup/html/form/BinaryFieldPanel.java | 2 +-
.../tree/DefaultMutableTreeNodeExpansion.java | 20 +-
.../wicket/markup/html/tree/TreeGroupPanel.java | 121 +++
.../markup/html/tree/TreeGroupProvider.java | 43 +
.../wicket/markup/html/tree/TreeRolePanel.java | 121 ---
.../markup/html/tree/TreeRoleProvider.java | 43 -
.../resources/META-INF/resources/css/style.css | 8 +-
.../resources/img/actions/groups-icon.png | Bin 0 -> 391 bytes
.../resources/img/actions/roles-icon.png | Bin 391 -> 0 bytes
.../META-INF/resources/img/menu/groups.png | Bin 0 -> 5020 bytes
.../resources/img/menu/notsel/groups.png | Bin 0 -> 5175 bytes
.../resources/img/menu/notsel/roles.png | Bin 5175 -> 0 bytes
.../META-INF/resources/img/menu/roles.png | Bin 5020 -> 0 bytes
.../src/main/resources/authorizations.xml | 12 +-
.../src/main/resources/consoleContext.xml | 2 +-
.../console/SyncopeApplication.properties | 2 +-
.../console/SyncopeApplication_it.properties | 2 +-
.../console/SyncopeApplication_pt_BR.properties | 2 +-
.../syncope/client/console/pages/BasePage.html | 4 +-
.../client/console/pages/Configuration.html | 12 +-
.../console/pages/Configuration.properties | 4 +-
.../console/pages/Configuration_it.properties | 4 +-
.../pages/Configuration_pt_BR.properties | 4 +-
.../client/console/pages/GroupModalPage.html | 52 ++
.../console/pages/GroupModalPage.properties | 48 +
.../console/pages/GroupModalPage_it.properties | 50 ++
.../pages/GroupModalPage_pt_BR.properties | 48 +
.../console/pages/GroupSelectModalPage.html | 24 +
.../syncope/client/console/pages/Groups.html | 80 ++
.../client/console/pages/Groups.properties | 26 +
.../client/console/pages/Groups_it.properties | 26 +
.../console/pages/Groups_pt_BR.properties | 26 +
.../pages/MembershipModalPage.properties | 2 +-
.../pages/MembershipModalPage_it.properties | 2 +-
.../pages/MembershipModalPage_pt_BR.properties | 2 +-
.../console/pages/NotificationModalPage.html | 10 +-
.../pages/NotificationModalPage.properties | 6 +-
.../pages/NotificationModalPage_it.properties | 6 +-
.../NotificationModalPage_pt_BR.properties | 8 +-
.../client/console/pages/PolicyModalPage.html | 8 +-
.../console/pages/PolicyModalPage.properties | 6 +-
.../console/pages/PolicyModalPage_it.properties | 6 +-
.../pages/PolicyModalPage_pt_BR.properties | 6 +-
.../client/console/pages/PushTaskModalPage.html | 8 +-
.../console/pages/PushTaskModalPage.properties | 2 +-
.../pages/PushTaskModalPage_it.properties | 2 +-
.../pages/PushTaskModalPage_pt_BR.properties | 2 +-
.../client/console/pages/ResourceModalPage.html | 6 +-
.../console/pages/ResourceModalPage.properties | 6 +-
.../pages/ResourceModalPage_it.properties | 6 +-
.../pages/ResourceModalPage_pt_BR.properties | 6 +-
.../client/console/pages/RoleModalPage.html | 52 --
.../console/pages/RoleModalPage.properties | 48 -
.../console/pages/RoleModalPage_it.properties | 50 --
.../pages/RoleModalPage_pt_BR.properties | 48 -
.../console/pages/RoleSelectModalPage.html | 22 -
.../syncope/client/console/pages/Roles.html | 80 --
.../client/console/pages/Roles.properties | 26 -
.../client/console/pages/Roles_it.properties | 26 -
.../client/console/pages/Roles_pt_BR.properties | 26 -
.../syncope/client/console/pages/Schema.html | 6 +-
.../client/console/pages/Schema.properties | 2 +-
.../client/console/pages/Schema_it.properties | 2 +-
.../console/pages/Schema_pt_BR.properties | 2 +-
.../console/pages/UserModalPage.properties | 4 +-
.../console/pages/UserModalPage_it.properties | 4 +-
.../pages/UserModalPage_pt_BR.properties | 4 +-
.../client/console/pages/WelcomePage.html | 2 +-
.../console/panels/AttrTemplatesPanel.html | 6 +-
.../console/panels/GroupDetailsPanel.html | 107 +++
.../console/panels/GroupDetailsPanel.properties | 22 +
.../panels/GroupDetailsPanel_it.properties | 22 +
.../panels/GroupDetailsPanel_pt_BR.properties | 22 +
.../client/console/panels/GroupPanel.html | 88 ++
.../client/console/panels/GroupPanel.properties | 51 ++
.../console/panels/GroupPanel_it.properties | 53 ++
.../console/panels/GroupPanel_pt_BR.properties | 40 +
.../console/panels/GroupSecurityPanel.html | 66 ++
.../panels/GroupSecurityPanel.properties | 20 +
.../panels/GroupSecurityPanel_it.properties | 20 +
.../panels/GroupSecurityPanel_pt_BR.properties | 20 +
.../console/panels/GroupSummaryPanel.html | 39 +
.../client/console/panels/GroupTabPanel.html | 64 ++
.../console/panels/GroupTabPanel.properties | 27 +
.../console/panels/GroupTabPanel_it.properties | 27 +
.../panels/GroupTabPanel_pt_BR.properties | 27 +
.../client/console/panels/MembershipsPanel.html | 6 +-
.../console/panels/MembershipsPanel.properties | 8 +-
.../panels/MembershipsPanel_it.properties | 8 +-
.../panels/MembershipsPanel_pt_BR.properties | 8 +-
.../client/console/panels/RoleDetailsPanel.html | 107 ---
.../console/panels/RoleDetailsPanel.properties | 22 -
.../panels/RoleDetailsPanel_it.properties | 22 -
.../panels/RoleDetailsPanel_pt_BR.properties | 22 -
.../client/console/panels/RolePanel.html | 88 --
.../client/console/panels/RolePanel.properties | 51 --
.../console/panels/RolePanel_it.properties | 53 --
.../console/panels/RolePanel_pt_BR.properties | 40 -
.../console/panels/RoleSecurityPanel.html | 66 --
.../console/panels/RoleSecurityPanel.properties | 20 -
.../panels/RoleSecurityPanel_it.properties | 20 -
.../panels/RoleSecurityPanel_pt_BR.properties | 20 -
.../client/console/panels/RoleSummaryPanel.html | 39 -
.../client/console/panels/RoleTabPanel.html | 64 --
.../console/panels/RoleTabPanel.properties | 27 -
.../console/panels/RoleTabPanel_it.properties | 27 -
.../panels/RoleTabPanel_pt_BR.properties | 27 -
.../markup/html/form/ActionLinksPanel.html | 12 +-
.../wicket/markup/html/tree/TreeGroupPanel.html | 25 +
.../wicket/markup/html/tree/TreeRolePanel.html | 23 -
.../syncope/client/lib/SyncopeClient.java | 10 +-
.../syncope/common/lib/AbstractBaseBean.java | 4 +-
.../common/lib/AttributableOperations.java | 62 +-
.../lib/SyncopeClientCompositeException.java | 10 +-
.../common/lib/SyncopeClientException.java | 12 +-
.../syncope/common/lib/SyncopeConstants.java | 8 +-
.../lib/annotation/FormAttributeField.java | 2 +-
.../apache/syncope/common/lib/mod/AttrMod.java | 11 +-
.../apache/syncope/common/lib/mod/GroupMod.java | 300 +++++++
.../syncope/common/lib/mod/MembershipMod.java | 12 +-
.../syncope/common/lib/mod/ReferenceMod.java | 5 +-
.../common/lib/mod/ResourceAssociationMod.java | 4 +-
.../apache/syncope/common/lib/mod/RoleMod.java | 300 -------
.../syncope/common/lib/mod/StatusMod.java | 2 +-
.../lib/report/AbstractReportletConf.java | 3 +-
.../report/AbstractSubjectReportletConf.java | 84 ++
.../common/lib/report/GroupReportletConf.java | 66 ++
.../common/lib/report/RoleReportletConf.java | 109 ---
.../common/lib/report/StaticReportletConf.java | 10 +-
.../common/lib/report/UserReportletConf.java | 45 +-
.../AbstractFiqlSearchConditionBuilder.java | 112 +++
.../search/GroupFiqlSearchConditionBuilder.java | 90 ++
.../common/lib/search/GroupProperty.java | 29 +
.../search/RoleFiqlSearchConditionBuilder.java | 90 --
.../syncope/common/lib/search/RoleProperty.java | 29 -
.../common/lib/search/SearchableFields.java | 12 +-
.../syncope/common/lib/search/SpecialAttr.java | 2 +-
.../SyncopeFiqlSearchConditionBuilder.java | 110 ---
.../common/lib/search/SyncopeProperty.java | 4 +-
.../search/UserFiqlSearchConditionBuilder.java | 24 +-
.../syncope/common/lib/search/UserProperty.java | 4 +-
.../syncope/common/lib/to/AbstractExecTO.java | 34 +-
.../syncope/common/lib/to/AbstractPolicyTO.java | 14 +-
.../lib/to/AbstractProvisioningTaskTO.java | 12 +-
.../common/lib/to/AbstractStartEndBean.java | 57 ++
.../syncope/common/lib/to/AbstractTaskTO.java | 32 +-
.../syncope/common/lib/to/BulkActionResult.java | 2 +
.../syncope/common/lib/to/ConnBundleTO.java | 2 +-
.../common/lib/to/ConnIdObjectClassTO.java | 6 +-
.../syncope/common/lib/to/EventCategoryTO.java | 7 +-
.../apache/syncope/common/lib/to/GroupTO.java | 258 ++++++
.../apache/syncope/common/lib/to/MappingTO.java | 2 +-
.../syncope/common/lib/to/MembershipTO.java | 20 +-
.../syncope/common/lib/to/NotificationTO.java | 12 +-
.../common/lib/to/NotificationTaskTO.java | 2 +-
.../syncope/common/lib/to/PasswordPolicyTO.java | 2 +-
.../syncope/common/lib/to/PushTaskTO.java | 10 +-
.../syncope/common/lib/to/ReportExecTO.java | 2 +-
.../apache/syncope/common/lib/to/ReportTO.java | 33 +-
.../syncope/common/lib/to/ResourceTO.java | 15 +-
.../apache/syncope/common/lib/to/RoleTO.java | 258 ------
.../syncope/common/lib/to/SchedTaskTO.java | 3 +
.../syncope/common/lib/to/SyncTaskTO.java | 12 +-
.../apache/syncope/common/lib/to/SyncopeTO.java | 20 +-
.../apache/syncope/common/lib/to/UserTO.java | 2 +-
.../syncope/common/lib/to/WorkflowFormTO.java | 2 +-
.../common/lib/types/AbstractPolicySpec.java | 83 ++
.../common/lib/types/AccountPolicySpec.java | 69 +-
.../common/lib/types/AttrSchemaType.java | 2 +-
.../common/lib/types/AttributableType.java | 2 +-
.../syncope/common/lib/types/AuditElements.java | 3 -
.../common/lib/types/AuditLoggerName.java | 35 +-
.../common/lib/types/CipherAlgorithm.java | 4 +-
.../common/lib/types/ClientExceptionType.java | 8 +-
.../common/lib/types/EntityViolationType.java | 8 +-
.../common/lib/types/IntMappingType.java | 52 +-
.../common/lib/types/PasswordPolicySpec.java | 69 +-
.../types/ResourceAssociationActionType.java | 6 +-
.../types/ResourceDeassociationActionType.java | 6 +-
.../syncope/common/lib/types/SubjectType.java | 4 +-
.../common/lib/types/SyncPolicySpec.java | 24 +-
common/pom.xml | 4 +
.../common/rest/api/service/GroupService.java | 312 +++++++
.../common/rest/api/service/JAXRSService.java | 16 +-
.../rest/api/service/ResourceService.java | 10 +-
.../common/rest/api/service/RoleService.java | 312 -------
.../rest/api/service/WorkflowService.java | 6 +-
.../syncope/core/logic/ConfigurationLogic.java | 6 +-
.../apache/syncope/core/logic/GroupLogic.java | 405 +++++++++
.../syncope/core/logic/ResourceLogic.java | 6 +-
.../apache/syncope/core/logic/RoleLogic.java | 405 ---------
.../apache/syncope/core/logic/SyncopeLogic.java | 12 +-
.../apache/syncope/core/logic/UserLogic.java | 45 +-
.../syncope/core/logic/WorkflowLogic.java | 16 +-
.../core/logic/report/GroupReportlet.java | 328 +++++++
.../core/logic/report/RoleReportlet.java | 327 -------
.../core/logic/report/UserReportlet.java | 28 +-
.../resources/report/groupReportlet2csv.xsl | 118 +++
.../main/resources/report/groupReportlet2fo.xsl | 228 +++++
.../resources/report/groupReportlet2html.xsl | 196 ++++
.../src/main/resources/report/report2csv.xsl | 4 +-
.../src/main/resources/report/report2fo.xsl | 4 +-
.../src/main/resources/report/report2html.xsl | 4 +-
.../main/resources/report/roleReportlet2csv.xsl | 118 ---
.../main/resources/report/roleReportlet2fo.xsl | 228 -----
.../resources/report/roleReportlet2html.xsl | 196 ----
.../main/resources/report/userReportlet2csv.xsl | 6 +-
.../main/resources/report/userReportlet2fo.xsl | 16 +-
.../resources/report/userReportlet2html.xsl | 16 +-
.../syncope/core/logic/NotificationTest.java | 52 +-
.../apache/syncope/core/misc/AuditManager.java | 18 +-
.../syncope/core/misc/ConnObjectUtil.java | 146 ++-
.../apache/syncope/core/misc/MappingUtil.java | 94 +-
.../core/misc/jexl/EmptyClassLoader.java | 2 +-
.../apache/syncope/core/misc/jexl/JexlUtil.java | 20 +-
.../core/misc/policy/AccountPolicyEnforcer.java | 4 +-
.../misc/policy/PasswordPolicyEnforcer.java | 4 +-
.../core/misc/policy/PolicyEnforcer.java | 5 +-
.../core/misc/search/SearchCondConverter.java | 4 +-
.../core/misc/search/SearchCondVisitor.java | 8 +-
.../core/misc/security/AuthContextUtil.java | 10 +-
.../syncope/core/misc/security/Encryptor.java | 68 +-
.../core/misc/security/PasswordGenerator.java | 16 +-
.../core/misc/security/SecureRandomUtil.java | 2 +-
.../security/SyncopeAuthenticationProvider.java | 23 +-
.../security/SyncopeUserDetailsService.java | 41 +-
.../security/UnauthorizedGroupException.java | 42 +
.../security/UnauthorizedRoleException.java | 42 -
.../serialization/AttributeDeserializer.java | 3 +-
.../misc/serialization/AttributeSerializer.java | 7 +-
.../GuardedStringDeserializer.java | 3 +-
.../serialization/GuardedStringSerializer.java | 3 +-
.../serialization/SyncTokenDeserializer.java | 3 +-
.../misc/serialization/SyncTokenSerializer.java | 3 +-
.../serialization/UnwrappedObjectMapper.java | 10 +-
.../misc/spring/ApplicationContextProvider.java | 8 +-
.../syncope/core/misc/spring/BeanUtils.java | 20 +-
.../misc/src/main/resources/security.properties | 3 +-
.../misc/search/SearchCondConverterTest.java | 12 +-
.../persistence/api/GroupEntitlementUtil.java | 88 ++
.../persistence/api/RoleEntitlementUtil.java | 88 --
.../validation/InvalidEntityException.java | 2 +-
.../InvalidPlainAttrValueException.java | 2 +-
.../api/attrvalue/validation/Validator.java | 3 +-
.../persistence/api/dao/ConnInstanceDAO.java | 3 +-
.../core/persistence/api/dao/DerAttrDAO.java | 3 +-
.../core/persistence/api/dao/DerSchemaDAO.java | 3 +-
.../persistence/api/dao/EntitlementDAO.java | 7 +-
.../api/dao/ExternalResourceDAO.java | 3 +-
.../core/persistence/api/dao/GroupDAO.java | 91 ++
.../core/persistence/api/dao/LoggerDAO.java | 3 +-
.../core/persistence/api/dao/MembershipDAO.java | 7 +-
.../persistence/api/dao/NotificationDAO.java | 3 +-
.../persistence/api/dao/PlainAttrValueDAO.java | 3 +-
.../persistence/api/dao/PlainSchemaDAO.java | 3 +-
.../core/persistence/api/dao/ReportDAO.java | 3 +-
.../core/persistence/api/dao/ReportExecDAO.java | 3 +-
.../core/persistence/api/dao/RoleDAO.java | 92 --
.../api/dao/SecurityQuestionDAO.java | 3 +-
.../persistence/api/dao/SubjectSearchDAO.java | 47 +-
.../core/persistence/api/dao/TaskDAO.java | 3 +-
.../core/persistence/api/dao/TaskExecDAO.java | 5 +-
.../core/persistence/api/dao/UserDAO.java | 9 +-
.../core/persistence/api/dao/VirAttrDAO.java | 3 +-
.../core/persistence/api/dao/VirSchemaDAO.java | 3 +-
.../api/dao/search/MembershipCond.java | 16 +-
.../persistence/api/dao/search/SubjectCond.java | 1 +
.../persistence/api/entity/AttrTemplate.java | 6 +-
.../api/entity/ExternalResource.java | 6 +-
.../persistence/api/entity/Notification.java | 4 +-
.../core/persistence/api/entity/PlainAttr.java | 3 +-
.../persistence/api/entity/PlainAttrValue.java | 3 +-
.../persistence/api/entity/group/GDerAttr.java | 34 +
.../api/entity/group/GDerAttrTemplate.java | 25 +
.../api/entity/group/GDerSchema.java | 25 +
.../persistence/api/entity/group/GMapping.java | 25 +
.../api/entity/group/GMappingItem.java | 29 +
.../api/entity/group/GPlainAttr.java | 42 +
.../api/entity/group/GPlainAttrTemplate.java | 25 +
.../api/entity/group/GPlainAttrUniqueValue.java | 31 +
.../api/entity/group/GPlainAttrValue.java | 28 +
.../api/entity/group/GPlainSchema.java | 25 +
.../persistence/api/entity/group/GVirAttr.java | 34 +
.../api/entity/group/GVirAttrTemplate.java | 25 +
.../api/entity/group/GVirSchema.java | 25 +
.../persistence/api/entity/group/Group.java | 168 ++++
.../api/entity/membership/Membership.java | 6 +-
.../persistence/api/entity/role/RDerAttr.java | 34 -
.../api/entity/role/RDerAttrTemplate.java | 25 -
.../persistence/api/entity/role/RDerSchema.java | 25 -
.../persistence/api/entity/role/RMapping.java | 25 -
.../api/entity/role/RMappingItem.java | 29 -
.../persistence/api/entity/role/RPlainAttr.java | 42 -
.../api/entity/role/RPlainAttrTemplate.java | 25 -
.../api/entity/role/RPlainAttrUniqueValue.java | 31 -
.../api/entity/role/RPlainAttrValue.java | 28 -
.../api/entity/role/RPlainSchema.java | 25 -
.../persistence/api/entity/role/RVirAttr.java | 34 -
.../api/entity/role/RVirAttrTemplate.java | 25 -
.../persistence/api/entity/role/RVirSchema.java | 25 -
.../core/persistence/api/entity/role/Role.java | 168 ----
.../persistence/api/entity/task/PushTask.java | 4 +-
.../persistence/api/entity/task/SyncTask.java | 6 +-
.../core/persistence/api/entity/user/User.java | 8 +-
.../jpa/content/XMLContentExporter.java | 2 +-
.../persistence/jpa/dao/AbstractSubjectDAO.java | 6 +-
.../persistence/jpa/dao/JPAAttrTemplateDAO.java | 24 +-
.../core/persistence/jpa/dao/JPADerAttrDAO.java | 8 +-
.../persistence/jpa/dao/JPADerSchemaDAO.java | 8 +-
.../persistence/jpa/dao/JPAEntitlementDAO.java | 24 +-
.../jpa/dao/JPAExternalResourceDAO.java | 24 +-
.../core/persistence/jpa/dao/JPAGroupDAO.java | 579 ++++++++++++
.../persistence/jpa/dao/JPAMembershipDAO.java | 11 +-
.../persistence/jpa/dao/JPAPlainAttrDAO.java | 8 +-
.../jpa/dao/JPAPlainAttrValueDAO.java | 16 +-
.../persistence/jpa/dao/JPAPlainSchemaDAO.java | 18 +-
.../core/persistence/jpa/dao/JPARoleDAO.java | 584 ------------
.../jpa/dao/JPASubjectSearchDAO.java | 74 +-
.../core/persistence/jpa/dao/JPAUserDAO.java | 38 +-
.../core/persistence/jpa/dao/JPAVirAttrDAO.java | 8 +-
.../persistence/jpa/dao/JPAVirSchemaDAO.java | 8 +-
.../core/persistence/jpa/dao/SearchSupport.java | 8 +-
.../persistence/jpa/entity/AbstractMapping.java | 2 +-
.../jpa/entity/AbstractMappingItem.java | 10 +-
.../jpa/entity/JPAAttributableUtil.java | 152 ++--
.../jpa/entity/JPAEntityFactory.java | 112 +--
.../jpa/entity/JPAExternalResource.java | 18 +-
.../persistence/jpa/entity/JPANotification.java | 10 +-
.../jpa/entity/JPAttributableUtilFactory.java | 8 +-
.../jpa/entity/group/JPAGDerAttr.java | 82 ++
.../jpa/entity/group/JPAGDerAttrTemplate.java | 66 ++
.../jpa/entity/group/JPAGDerSchema.java | 34 +
.../jpa/entity/group/JPAGMapping.java | 103 +++
.../jpa/entity/group/JPAGMappingItem.java | 58 ++
.../jpa/entity/group/JPAGPlainAttr.java | 140 +++
.../jpa/entity/group/JPAGPlainAttrTemplate.java | 75 ++
.../entity/group/JPAGPlainAttrUniqueValue.java | 78 ++
.../jpa/entity/group/JPAGPlainAttrValue.java | 64 ++
.../jpa/entity/group/JPAGPlainSchema.java | 36 +
.../jpa/entity/group/JPAGVirAttr.java | 82 ++
.../jpa/entity/group/JPAGVirAttrTemplate.java | 66 ++
.../jpa/entity/group/JPAGVirSchema.java | 36 +
.../persistence/jpa/entity/group/JPAGroup.java | 593 +++++++++++++
.../jpa/entity/membership/JPAMDerAttr.java | 2 +-
.../entity/membership/JPAMDerAttrTemplate.java | 14 +-
.../jpa/entity/membership/JPAMPlainAttr.java | 2 +-
.../membership/JPAMPlainAttrTemplate.java | 14 +-
.../jpa/entity/membership/JPAMVirAttr.java | 2 +-
.../entity/membership/JPAMVirAttrTemplate.java | 14 +-
.../jpa/entity/membership/JPAMembership.java | 30 +-
.../jpa/entity/role/JPARDerAttr.java | 82 --
.../jpa/entity/role/JPARDerAttrTemplate.java | 66 --
.../jpa/entity/role/JPARDerSchema.java | 34 -
.../jpa/entity/role/JPARMapping.java | 103 ---
.../jpa/entity/role/JPARMappingItem.java | 58 --
.../jpa/entity/role/JPARPlainAttr.java | 140 ---
.../jpa/entity/role/JPARPlainAttrTemplate.java | 75 --
.../entity/role/JPARPlainAttrUniqueValue.java | 78 --
.../jpa/entity/role/JPARPlainAttrValue.java | 64 --
.../jpa/entity/role/JPARPlainSchema.java | 36 -
.../jpa/entity/role/JPARVirAttr.java | 82 --
.../jpa/entity/role/JPARVirAttrTemplate.java | 66 --
.../jpa/entity/role/JPARVirSchema.java | 36 -
.../persistence/jpa/entity/role/JPARole.java | 593 -------------
.../jpa/entity/task/JPAPushTask.java | 10 +-
.../jpa/entity/task/JPASyncTask.java | 14 +-
.../persistence/jpa/entity/user/JPAUser.java | 28 +-
.../entity/ExternalResourceValidator.java | 6 +-
.../jpa/validation/entity/GroupCheck.java | 41 +
.../jpa/validation/entity/GroupValidator.java | 44 +
.../entity/PlainAttrValueValidator.java | 6 +-
.../jpa/validation/entity/RoleCheck.java | 41 -
.../jpa/validation/entity/RoleValidator.java | 44 -
.../validation/entity/SchemaNameValidator.java | 22 +-
.../jpa/validation/entity/UserValidator.java | 14 +-
.../resources/META-INF/spring-orm-oracle.xml | 40 +-
.../resources/META-INF/spring-orm-sqlserver.xml | 40 +-
.../src/main/resources/META-INF/spring-orm.xml | 40 +-
.../src/main/resources/content.xml | 14 +-
.../src/main/resources/indexes.xml | 10 +-
.../src/main/resources/views.xml | 60 +-
.../jpa/entity/AttributableSearchTest.java | 115 ++-
.../persistence/jpa/entity/DerAttrTest.java | 52 +-
.../persistence/jpa/entity/DerSchemaTest.java | 8 +-
.../core/persistence/jpa/entity/GroupTest.java | 141 +++
.../persistence/jpa/entity/MembershipTest.java | 10 +-
.../jpa/entity/NotificationTest.java | 4 +-
.../persistence/jpa/entity/PlainSchemaTest.java | 18 +-
.../core/persistence/jpa/entity/PolicyTest.java | 4 +-
.../persistence/jpa/entity/ResourceTest.java | 8 +-
.../core/persistence/jpa/entity/RoleTest.java | 142 ---
.../core/persistence/jpa/entity/UserTest.java | 16 +-
.../persistence/jpa/entity/VirAttrTest.java | 20 +-
.../persistence/jpa/entity/VirSchemaTest.java | 8 +-
.../persistence/jpa/relationship/AttrTest.java | 32 +-
.../relationship/AttributableSearchTest.java | 18 +-
.../jpa/relationship/EntitlementTest.java | 14 +-
.../persistence/jpa/relationship/GroupTest.java | 145 +++
.../jpa/relationship/MembershipTest.java | 16 +-
.../jpa/relationship/ResourceTest.java | 14 +-
.../persistence/jpa/relationship/RoleTest.java | 145 ---
.../persistence/jpa/relationship/UserTest.java | 6 +-
.../src/test/resources/content.xml | 294 +++---
core/pom.xml | 4 +
.../api/AttributableTransformer.java | 2 +-
.../core/provisioning/api/Connector.java | 8 +-
.../api/GroupProvisioningManager.java | 37 +
.../api/RoleProvisioningManager.java | 37 -
.../core/provisioning/api/WorkflowResult.java | 5 +-
.../provisioning/api/cache/VirAttrCache.java | 12 +-
.../api/cache/VirAttrCacheValue.java | 8 +-
.../provisioning/api/data/GroupDataBinder.java | 36 +
.../provisioning/api/data/RoleDataBinder.java | 36 -
.../core/provisioning/api/job/TaskJob.java | 2 +-
.../api/notification/NotificationManager.java | 5 +-
.../api/propagation/PropagationManager.java | 50 +-
.../api/sync/GroupPushResultHandler.java | 23 +
.../api/sync/GroupSyncResultHandler.java | 26 +
.../api/sync/ProvisioningProfile.java | 2 +-
.../api/sync/ProvisioningResult.java | 2 +-
.../core/provisioning/api/sync/PushActions.java | 36 +-
.../api/sync/RolePushResultHandler.java | 23 -
.../api/sync/RoleSyncResultHandler.java | 26 -
.../core/provisioning/api/sync/SyncActions.java | 48 +-
.../java/DefaultGroupProvisioningManager.java | 222 +++++
.../java/DefaultRoleProvisioningManager.java | 223 -----
.../java/DefaultUserProvisioningManager.java | 2 +-
.../core/provisioning/java/VirAttrHandler.java | 24 +-
.../java/cache/MemoryVirAttrCache.java | 14 +-
.../data/AbstractAttributableDataBinder.java | 66 +-
.../java/data/GroupDataBinderImpl.java | 411 +++++++++
.../java/data/NotificationDataBinderImpl.java | 4 +-
.../java/data/PolicyDataBinderImpl.java | 14 +-
.../java/data/ResourceDataBinderImpl.java | 20 +-
.../java/data/RoleDataBinderImpl.java | 411 ---------
.../java/data/TaskDataBinderImpl.java | 14 +-
.../java/data/UserDataBinderImpl.java | 52 +-
.../notification/NotificationManagerImpl.java | 46 +-
.../AbstractPropagationTaskExecutor.java | 28 +-
.../LDAPMembershipPropagationActions.java | 40 +-
.../propagation/PropagationManagerImpl.java | 183 ++--
.../java/sync/AbstractProvisioningJob.java | 40 +-
.../java/sync/AbstractPushResultHandler.java | 2 +-
.../java/sync/AbstractSyncResultHandler.java | 9 +-
.../java/sync/AbstractSyncopeResultHandler.java | 18 +-
.../java/sync/GroupPushResultHandlerImpl.java | 162 ++++
.../java/sync/GroupSyncResultHandlerImpl.java | 168 ++++
.../java/sync/LDAPMembershipSyncActions.java | 75 +-
.../provisioning/java/sync/PushJobImpl.java | 47 +-
.../java/sync/RolePushResultHandlerImpl.java | 162 ----
.../java/sync/RoleSyncResultHandlerImpl.java | 169 ----
.../provisioning/java/sync/SyncJobImpl.java | 52 +-
.../provisioning/java/sync/SyncUtilities.java | 49 +-
.../main/resources/mailTemplates/optin.html.vm | 4 +-
.../main/resources/mailTemplates/optin.txt.vm | 4 +-
.../src/main/resources/provisioning.properties | 2 +-
.../src/main/resources/provisioningContext.xml | 2 +-
.../rest/cxf/RestServiceExceptionMapper.java | 6 +-
.../core/rest/cxf/service/GroupServiceImpl.java | 227 +++++
.../rest/cxf/service/ResourceServiceImpl.java | 6 +-
.../core/rest/cxf/service/RoleServiceImpl.java | 227 -----
.../rest/cxf/service/WorkflowServiceImpl.java | 6 +-
.../activiti/ActivitiUserWorkflowAdapter.java | 10 +-
.../workflow/activiti/SyncopeGroupManager.java | 10 +-
.../activiti/SyncopeGroupQueryImpl.java | 31 +-
.../workflow/activiti/SyncopeUserManager.java | 10 +-
.../workflow/activiti/SyncopeUserQueryImpl.java | 22 +-
.../src/main/resources/workflow.properties | 2 +-
.../core/workflow/api/GroupWorkflowAdapter.java | 61 ++
.../core/workflow/api/RoleWorkflowAdapter.java | 71 --
.../core/workflow/api/UserWorkflowAdapter.java | 43 +-
.../core/workflow/api/WorkflowAdapter.java | 23 +-
.../java/AbstractGroupWorkflowAdapter.java | 66 ++
.../java/AbstractRoleWorkflowAdapter.java | 66 --
.../java/DefaultGroupWorkflowAdapter.java | 129 +++
.../java/DefaultRoleWorkflowAdapter.java | 129 ---
.../src/main/resources/workflow.properties | 2 +-
.../src/main/resources/workflowContext.xml | 2 +-
deb/core/pom.xml | 2 +-
deb/core/src/deb/control/conffiles | 2 +-
deb/core/src/deb/control/control | 2 +-
.../client/console/panels/CamelRoutePanel.java | 8 +-
.../console/rest/CamelRouteRestClient.java | 2 +-
.../core/logic/init/CamelRouteLoader.java | 6 +-
.../camel/CamelGroupProvisioningManager.java | 175 ++++
.../camel/CamelRoleProvisioningManager.java | 174 ----
.../processor/GroupCreateInSyncProcessor.java | 72 ++
.../camel/processor/GroupCreateProcessor.java | 76 ++
.../camel/processor/GroupDeleteProcessor.java | 105 +++
.../processor/GroupDeprovisionProcessor.java | 78 ++
.../camel/processor/GroupUpdateProcessor.java | 71 ++
.../processor/RoleCreateInSyncProcessor.java | 72 --
.../camel/processor/RoleCreateProcessor.java | 77 --
.../camel/processor/RoleDeleteProcessor.java | 105 ---
.../processor/RoleDeprovisionProcessor.java | 78 --
.../camel/processor/RoleUpdateProcessor.java | 71 --
.../camel/processor/UserUpdateProcessor.java | 2 +-
.../src/main/resources/groupRoutes.xml | 140 +++
.../src/main/resources/provisioning.properties | 2 +-
.../main/resources/provisioningCamelContext.xml | 6 +-
.../src/main/resources/roleRoutes.xml | 140 ---
.../fit/buildtools/ApacheDSRootDseServlet.java | 6 +-
.../fit/console/reference/AccessITCase.java | 7 +-
.../console/reference/ConfigurationITCase.java | 26 +-
.../fit/console/reference/ConnectorITCase.java | 2 +-
.../fit/console/reference/GroupITCase.java | 211 +++++
.../fit/console/reference/RoleITCase.java | 211 -----
.../fit/console/reference/SchemaITCase.java | 2 +-
.../fit/core/reference/TestSyncActions.java | 3 +
.../fit/core/reference/TestSyncRule.java | 5 +-
.../fit/core/reference/package-info.java | 19 +
.../main/resources/all/provisioning.properties | 2 +-
.../src/main/resources/all/workflow.properties | 2 +-
.../src/main/resources/connid.properties | 3 +-
.../src/main/resources/provisioning.properties | 2 +-
.../src/main/resources/userWorkflow.bpmn20.xml | 8 +-
.../src/main/resources/workflow.properties | 2 +-
.../fit/core/reference/AbstractITCase.java | 29 +-
.../fit/core/reference/ActivitiDetector.java | 4 +-
.../core/reference/AuthenticationITCase.java | 100 +--
.../fit/core/reference/CamelDetector.java | 4 +-
.../fit/core/reference/CamelRouteITCase.java | 12 +-
.../fit/core/reference/ConfigurationITCase.java | 27 +-
.../fit/core/reference/DerSchemaITCase.java | 16 +-
.../syncope/fit/core/reference/GroupITCase.java | 887 ++++++++++++++++++
.../fit/core/reference/LoggerITCase.java | 4 +-
.../fit/core/reference/NotificationITCase.java | 7 +-
.../core/reference/NotificationTaskITCase.java | 6 +-
.../fit/core/reference/PlainSchemaITCase.java | 28 +-
.../fit/core/reference/PolicyITCase.java | 8 +-
.../fit/core/reference/PushTaskITCase.java | 58 +-
.../fit/core/reference/ResourceITCase.java | 20 +-
.../syncope/fit/core/reference/RoleITCase.java | 889 -------------------
.../fit/core/reference/SearchITCase.java | 42 +-
.../fit/core/reference/SyncTaskITCase.java | 60 +-
.../syncope/fit/core/reference/UserITCase.java | 116 +--
.../fit/core/reference/UserSelfITCase.java | 4 +-
.../fit/core/reference/UserWorkflowITCase.java | 26 +-
.../fit/core/reference/VirAttrITCase.java | 86 +-
.../fit/core/reference/VirSchemaITCase.java | 6 +-
.../fit/core/reference/WorkflowITCase.java | 14 +-
fit/core-reference/src/test/resources/test.csv | 20 +-
.../apache/syncope/installer/files/OrmXml.java | 381 --------
.../installer/utilities/FileSystemUtils.java | 3 +-
pom.xml | 51 ++
.../resources/org/apache/syncope/checkstyle.xml | 29 +-
src/main/resources/org/apache/syncope/pmd.xml | 55 +-
src/site/xdoc/architecture.xml | 2 +-
src/site/xdoc/features.xml | 10 +-
src/site/xdoc/index.xml | 2 +-
src/site/xdoc/security.xml | 2 +-
614 files changed, 15911 insertions(+), 16394 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/SyncopeApplication.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeApplication.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeApplication.java
index ac44d43..a1e781d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeApplication.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeApplication.java
@@ -28,7 +28,7 @@ import org.apache.syncope.client.console.pages.Login;
import org.apache.syncope.client.console.pages.Logout;
import org.apache.syncope.client.console.pages.Reports;
import org.apache.syncope.client.console.pages.Resources;
-import org.apache.syncope.client.console.pages.Roles;
+import org.apache.syncope.client.console.pages.Groups;
import org.apache.syncope.client.console.pages.Schema;
import org.apache.syncope.client.console.pages.Tasks;
import org.apache.syncope.client.console.pages.Todo;
@@ -177,13 +177,13 @@ public class SyncopeApplication
? IMG_NOTSEL
: StringUtils.EMPTY) + "users" + Constants.PNG_EXT)));
- BookmarkablePageLink<Page> rolesLink = new BookmarkablePageLink<>("roles", Roles.class);
+ BookmarkablePageLink<Page> groupsLink = new BookmarkablePageLink<>("groups", Groups.class);
MetaDataRoleAuthorizationStrategy.authorize(
- rolesLink, WebPage.ENABLE, xmlRolesReader.getEntitlement("Roles", "list"));
- page.add(rolesLink);
- rolesLink.add(new Image("rolesIcon", new ContextRelativeResource(IMG_PREFIX + (notsel
+ groupsLink, WebPage.ENABLE, xmlRolesReader.getEntitlement("Groups", "list"));
+ page.add(groupsLink);
+ groupsLink.add(new Image("groupsIcon", new ContextRelativeResource(IMG_PREFIX + (notsel
? IMG_NOTSEL
- : StringUtils.EMPTY) + "roles" + Constants.PNG_EXT)));
+ : StringUtils.EMPTY) + "groups" + Constants.PNG_EXT)));
BookmarkablePageLink<Page> resourcesLink = new BookmarkablePageLink<>("resources", Resources.class);
MetaDataRoleAuthorizationStrategy.authorize(
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/commons/AttrLayoutType.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/AttrLayoutType.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/AttrLayoutType.java
index 87cc062..26764b4 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/AttrLayoutType.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/AttrLayoutType.java
@@ -26,8 +26,8 @@ public enum AttrLayoutType {
ADMIN_USER("admin.user.layout", Mode.ADMIN, AttributableType.USER),
SELF_USER("self.user.layout", Mode.SELF, AttributableType.USER),
- ADMIN_ROLE("admin.role.layout", Mode.ADMIN, AttributableType.ROLE),
- SELF_ROLE("self.role.layout", Mode.SELF, AttributableType.ROLE),
+ ADMIN_GROUP("admin.group.layout", Mode.ADMIN, AttributableType.GROUP),
+ SELF_GROUP("self.group.layout", Mode.SELF, AttributableType.GROUP),
ADMIN_MEMBERSHIP("admin.membership.layout", Mode.ADMIN, AttributableType.MEMBERSHIP),
SELF_MEMBERSHIP("self.membership.layout", Mode.SELF, AttributableType.MEMBERSHIP);
@@ -76,8 +76,8 @@ public enum AttrLayoutType {
result = ADMIN_MEMBERSHIP;
break;
- case ROLE:
- result = ADMIN_ROLE;
+ case GROUP:
+ result = ADMIN_GROUP;
break;
default:
@@ -92,8 +92,8 @@ public enum AttrLayoutType {
result = SELF_MEMBERSHIP;
break;
- case ROLE:
- result = SELF_ROLE;
+ case GROUP:
+ result = SELF_GROUP;
break;
default:
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java
index 8f06874..0b8391a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java
@@ -50,19 +50,19 @@ public final class Constants {
public static final String PREF_CONF_SCHEMA_PAGINATOR_ROWS = "conf.schema.paginator.rows";
- public static final String PREF_USER_SCHEMA_PAGINATOR_ROWS = "user.schema.paginator.rows";
+ public static final String PREF_USER_PLAIN_SCHEMA_PAGINATOR_ROWS = "user.schema.paginator.rows";
public static final String PREF_USER_DER_SCHEMA_PAGINATOR_ROWS = "user.derived.schema.paginator.rows";
public static final String PREF_USER_VIR_SCHEMA_PAGINATOR_ROWS = "user.virtual.schema.paginator.rows";
- public static final String PREF_ROLE_SCHEMA_PAGINATOR_ROWS = "role.schema.paginator.rows";
+ public static final String PREF_GROUP_PLAIN_SCHEMA_PAGINATOR_ROWS = "group.schema.paginator.rows";
- public static final String PREF_ROLE_DER_SCHEMA_PAGINATOR_ROWS = "role.derived.schema.paginator.rows";
+ public static final String PREF_GROUP_DER_SCHEMA_PAGINATOR_ROWS = "group.derived.schema.paginator.rows";
- public static final String PREF_ROLE_VIR_SCHEMA_PAGINATOR_ROWS = "role.virtual.schema.paginator.rows";
+ public static final String PREF_GROUP_VIR_SCHEMA_PAGINATOR_ROWS = "group.virtual.schema.paginator.rows";
- public static final String PREF_MEMBERSHIP_SCHEMA_PAGINATOR_ROWS = "membership.schema.paginator.rows";
+ public static final String PREF_MEMBERSHIP_PLAIN_SCHEMA_PAGINATOR_ROWS = "membership.schema.paginator.rows";
public static final String PREF_MEMBERSHIP_DER_SCHEMA_PAGINATOR_ROWS = "membership.derived.aschema.paginator.rows";
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/commons/GroupTreeBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/GroupTreeBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/GroupTreeBuilder.java
new file mode 100644
index 0000000..bc7d21b
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/GroupTreeBuilder.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.commons;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeModel;
+import org.apache.syncope.client.console.rest.GroupRestClient;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class GroupTreeBuilder {
+
+ @Autowired
+ private GroupRestClient restClient;
+
+ private final GroupTOComparator comparator = new GroupTOComparator();
+
+ private List<GroupTO> allGroups;
+
+ private List<GroupTO> getChildGroups(final long parentGroupId, final List<GroupTO> groups) {
+ List<GroupTO> result = new ArrayList<>();
+ for (GroupTO group : groups) {
+ if (group.getParent() == parentGroupId) {
+ result.add(group);
+ }
+ }
+
+ Collections.sort(result, comparator);
+ return result;
+ }
+
+ private void populateSubtree(final DefaultMutableTreeNode subRoot, final List<GroupTO> groups) {
+ GroupTO group = (GroupTO) subRoot.getUserObject();
+
+ DefaultMutableTreeNode child;
+ for (GroupTO subGroupTO : getChildGroups(group.getKey(), groups)) {
+ child = new DefaultMutableTreeNode(subGroupTO);
+ subRoot.add(child);
+ populateSubtree(child, groups);
+ }
+ }
+
+ public List<GroupTO> getAllGroups() {
+ return this.allGroups;
+ }
+
+ public TreeModel build() {
+ this.allGroups = this.restClient.list();
+ return build(this.allGroups);
+ }
+
+ public TreeModel build(final List<GroupTO> groups) {
+ DefaultMutableTreeNode fakeroot = new DefaultMutableTreeNode(new FakeRootGroupTO());
+
+ populateSubtree(fakeroot, groups);
+
+ return new DefaultTreeModel(fakeroot);
+ }
+
+ public GroupTO findGroup(final long groupKey) {
+ GroupTO found = null;
+ if (getAllGroups() != null) {
+ for (GroupTO groupTO : getAllGroups()) {
+ if (groupTO.getKey() == groupKey) {
+ found = groupTO;
+ }
+ }
+ }
+ return found;
+ }
+
+ private static class GroupTOComparator implements Comparator<GroupTO>, Serializable {
+
+ private static final long serialVersionUID = 7085057398406518811L;
+
+ @Override
+ public int compare(final GroupTO r1, final GroupTO r2) {
+ if (r1.getKey() < r2.getKey()) {
+ return -1;
+ }
+ if (r1.getKey() == r2.getKey()) {
+ return 0;
+ }
+
+ return 1;
+ }
+ }
+
+ private static class FakeRootGroupTO extends GroupTO {
+
+ private static final long serialVersionUID = 4839183625773925488L;
+
+ public FakeRootGroupTO() {
+ super();
+
+ setKey(0);
+ setName("");
+ setParent(-1);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "";
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/commons/RoleTreeBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/RoleTreeBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/RoleTreeBuilder.java
deleted file mode 100644
index c6ab6e4..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/RoleTreeBuilder.java
+++ /dev/null
@@ -1,116 +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.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeModel;
-import org.apache.syncope.client.console.rest.RoleRestClient;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class RoleTreeBuilder {
-
- @Autowired
- private RoleRestClient restClient;
-
- private final RoleTOComparator comparator = new RoleTOComparator();
-
- private List<RoleTO> allRoles;
-
- private List<RoleTO> getChildRoles(final long parentRoleId, final List<RoleTO> roles) {
- List<RoleTO> result = new ArrayList<RoleTO>();
- for (RoleTO role : roles) {
- if (role.getParent() == parentRoleId) {
- result.add(role);
- }
- }
-
- Collections.sort(result, comparator);
- return result;
- }
-
- private void populateSubtree(final DefaultMutableTreeNode subRoot, final List<RoleTO> roles) {
- RoleTO role = (RoleTO) subRoot.getUserObject();
-
- DefaultMutableTreeNode child;
- for (RoleTO subRoleTO : getChildRoles(role.getKey(), roles)) {
- child = new DefaultMutableTreeNode(subRoleTO);
- subRoot.add(child);
- populateSubtree(child, roles);
- }
- }
-
- public List<RoleTO> getAllRoles() {
- return this.allRoles;
- }
-
- public TreeModel build() {
- this.allRoles = this.restClient.list();
- return build(this.allRoles);
- }
-
- public TreeModel build(final List<RoleTO> roles) {
- DefaultMutableTreeNode fakeroot = new DefaultMutableTreeNode(new FakeRootRoleTO());
-
- populateSubtree(fakeroot, roles);
-
- return new DefaultTreeModel(fakeroot);
- }
-
- private static class RoleTOComparator implements Comparator<RoleTO>, Serializable {
-
- private static final long serialVersionUID = 7085057398406518811L;
-
- @Override
- public int compare(final RoleTO r1, final RoleTO r2) {
- if (r1.getKey() < r2.getKey()) {
- return -1;
- }
- if (r1.getKey() == r2.getKey()) {
- return 0;
- }
-
- return 1;
- }
- }
-
- private static class FakeRootRoleTO extends RoleTO {
-
- private static final long serialVersionUID = 4839183625773925488L;
-
- public FakeRootRoleTO() {
- super();
-
- setKey(0);
- setName("");
- setParent(-1);
- }
-
- @Override
- public String getDisplayName() {
- return "";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/commons/RoleUtils.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/RoleUtils.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/RoleUtils.java
deleted file mode 100644
index 27e062b..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/RoleUtils.java
+++ /dev/null
@@ -1,36 +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 org.apache.syncope.common.lib.to.RoleTO;
-
-public class RoleUtils {
-
- public static RoleTO findRole(final RoleTreeBuilder roleTreeBuilder, final long roleKey) {
- RoleTO found = null;
- if (roleTreeBuilder.getAllRoles() != null) {
- for (RoleTO roleTO : roleTreeBuilder.getAllRoles()) {
- if (roleTO.getKey()== roleKey) {
- found = roleTO;
- }
- }
- }
- return found;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusBean.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusBean.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusBean.java
index 96ddd14..47d0086 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusBean.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusBean.java
@@ -24,7 +24,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.syncope.common.lib.to.AbstractAttributableTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
public class StatusBean implements Serializable {
@@ -46,7 +46,7 @@ public class StatusBean implements Serializable {
public StatusBean(final AbstractAttributableTO attributable, String resourceName) {
this.attributableKey = attributable.getKey();
this.attributableName = attributable instanceof UserTO
- ? ((UserTO) attributable).getUsername() : ((RoleTO) attributable).getName();
+ ? ((UserTO) attributable).getUsername() : ((GroupTO) attributable).getName();
this.resourceName = resourceName;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusUtils.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusUtils.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusUtils.java
index 3c0e56e..391d202 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusUtils.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusUtils.java
@@ -102,7 +102,7 @@ public class StatusUtils implements Serializable {
final AbstractAttributableTO attributable,
final String resourceName,
final ConnObjectTO objectTO,
- final boolean isRole) {
+ final boolean isGroup) {
final StatusBean statusBean = new StatusBean(attributable, resourceName);
@@ -110,7 +110,7 @@ public class StatusUtils implements Serializable {
final Boolean enabled = isEnabled(objectTO);
final Status status = enabled == null
- ? (isRole ? Status.ACTIVE : Status.UNDEFINED)
+ ? (isGroup ? Status.ACTIVE : Status.UNDEFINED)
: enabled
? Status.ACTIVE
: Status.SUSPENDED;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractBasePage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractBasePage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractBasePage.java
index 4a32700..830f369 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractBasePage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractBasePage.java
@@ -25,7 +25,7 @@ import org.apache.syncope.client.console.panels.NotificationPanel;
import org.apache.syncope.client.console.rest.ConfigurationRestClient;
import org.apache.syncope.client.console.rest.ReportRestClient;
import org.apache.syncope.client.console.rest.ResourceRestClient;
-import org.apache.syncope.client.console.rest.RoleRestClient;
+import org.apache.syncope.client.console.rest.GroupRestClient;
import org.apache.syncope.client.console.rest.SchemaRestClient;
import org.apache.syncope.client.console.rest.TaskRestClient;
import org.apache.syncope.client.console.rest.UserRestClient;
@@ -71,7 +71,7 @@ public class AbstractBasePage extends WebPage {
protected UserSelfRestClient userSelfRestClient;
@SpringBean
- protected RoleRestClient roleRestClient;
+ protected GroupRestClient groupRestClient;
@SpringBean
protected TaskRestClient taskRestClient;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionResultModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionResultModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionResultModalPage.java
index 4ada6ba..b9b8968 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionResultModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionResultModalPage.java
@@ -35,7 +35,7 @@ import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
/**
- * Show user or role status after performing a successful operation.
+ * Show user or group status after performing a successful operation.
*/
public class BulkActionResultModalPage<T, S> extends BaseModalPage {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/Configuration.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Configuration.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Configuration.java
index c6774f2..9f8c734 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Configuration.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Configuration.java
@@ -156,8 +156,8 @@ public class Configuration extends BasePage {
// Layouts
add(new LayoutsPanel("adminUserLayoutPanel", AttrLayoutType.ADMIN_USER, feedbackPanel));
add(new LayoutsPanel("selfUserLayoutPanel", AttrLayoutType.SELF_USER, feedbackPanel));
- add(new LayoutsPanel("adminRoleLayoutPanel", AttrLayoutType.ADMIN_ROLE, feedbackPanel));
- add(new LayoutsPanel("selfRoleLayoutPanel", AttrLayoutType.SELF_ROLE, feedbackPanel));
+ add(new LayoutsPanel("adminGroupLayoutPanel", AttrLayoutType.ADMIN_GROUP, feedbackPanel));
+ add(new LayoutsPanel("selfGroupLayoutPanel", AttrLayoutType.SELF_GROUP, feedbackPanel));
add(new LayoutsPanel("adminMembershipLayoutPanel", AttrLayoutType.ADMIN_MEMBERSHIP, feedbackPanel));
add(new LayoutsPanel("selfMembershipLayoutPanel", AttrLayoutType.SELF_MEMBERSHIP, feedbackPanel));
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupModalPage.java
new file mode 100644
index 0000000..8b4daa9
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupModalPage.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.SerializationUtils;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.commons.Mode;
+import org.apache.syncope.client.console.panels.GroupPanel;
+import org.apache.syncope.common.lib.AttributableOperations;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.ResourceModel;
+
+/**
+ * Modal window with Group form.
+ */
+public class GroupModalPage extends BaseModalPage {
+
+ private static final long serialVersionUID = -1732493223434085205L;
+
+ protected final PageReference pageRef;
+
+ protected final ModalWindow window;
+
+ protected final Mode mode;
+
+ protected final boolean createFlag;
+
+ protected final GroupPanel groupPanel;
+
+ protected GroupTO originalGroupTO;
+
+ public GroupModalPage(final PageReference pageRef, final ModalWindow window, final GroupTO groupTO) {
+ this(pageRef, window, groupTO, Mode.ADMIN);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public GroupModalPage(
+ final PageReference pageRef, final ModalWindow window, final GroupTO groupTO, final Mode mode) {
+
+ super();
+
+ this.pageRef = pageRef;
+ this.window = window;
+ this.mode = mode;
+
+ this.createFlag = groupTO.getKey() == 0;
+ if (!createFlag) {
+ originalGroupTO = SerializationUtils.clone(groupTO);
+ }
+
+ final Form<GroupTO> form = new Form<GroupTO>("groupForm");
+ form.setMultiPart(true);
+
+ add(new Label("displayName", groupTO.getKey() == 0 ? "" : groupTO.getDisplayName()));
+
+ form.setModel(new CompoundPropertyModel<GroupTO>(groupTO));
+
+ this.groupPanel = new GroupPanel.Builder("groupPanel").
+ form(form).groupTO(groupTO).groupModalPageMode(mode).pageRef(getPageReference()).build();
+ form.add(groupPanel);
+
+ final AjaxButton submit = new IndicatingAjaxButton(SUBMIT, new ResourceModel(SUBMIT)) {
+
+ private static final long serialVersionUID = -958724007591692537L;
+
+ @Override
+ protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ try {
+ submitAction(target, form);
+
+ if (pageRef.getPage() instanceof BasePage) {
+ ((BasePage) pageRef.getPage()).setModalResult(true);
+ }
+
+ closeAction(target, form);
+ } catch (Exception e) {
+ error(getString(Constants.ERROR) + ": " + e.getMessage());
+ feedbackPanel.refresh(target);
+ }
+ }
+
+ @Override
+ protected void onError(final AjaxRequestTarget target, final Form<?> form) {
+ feedbackPanel.refresh(target);
+ }
+ };
+ form.add(submit);
+ form.setDefaultButton(submit);
+
+ final AjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) {
+
+ private static final long serialVersionUID = -958724007591692537L;
+
+ @Override
+ protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ closeAction(target, form);
+ }
+ };
+ cancel.setDefaultFormProcessing(false);
+ form.add(cancel);
+
+ MetaDataRoleAuthorizationStrategy.authorize(submit, ENABLE, xmlRolesReader.getEntitlement("Groups",
+ createFlag
+ ? "create"
+ : "update"));
+
+ add(form);
+ }
+
+ protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
+ final GroupTO groupTO = (GroupTO) form.getDefaultModelObject();
+ final List<String> entitlementList = new ArrayList<String>(groupPanel.getSelectedEntitlements());
+ groupTO.getEntitlements().clear();
+ groupTO.getEntitlements().addAll(entitlementList);
+
+ GroupTO result;
+ if (createFlag) {
+ result = groupRestClient.create(groupTO);
+ } else {
+ GroupMod groupMod = AttributableOperations.diff(groupTO, originalGroupTO);
+
+ // update group just if it is changed
+ if (groupMod.isEmpty()) {
+ result = groupTO;
+ } else {
+ result = groupRestClient.update(originalGroupTO.getETagValue(), groupMod);
+ }
+ }
+
+ setResponsePage(new ResultStatusModalPage.Builder(window, result).build());
+ }
+
+ protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
+ window.close(target);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupSelectModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupSelectModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupSelectModalPage.java
new file mode 100644
index 0000000..97b7abf
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupSelectModalPage.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.pages;
+
+import java.lang.reflect.Constructor;
+import javax.swing.tree.DefaultMutableTreeNode;
+import org.apache.syncope.client.console.commons.GroupTreeBuilder;
+import org.apache.syncope.client.console.wicket.markup.html.tree.DefaultMutableTreeNodeExpansion;
+import org.apache.syncope.client.console.wicket.markup.html.tree.DefaultMutableTreeNodeExpansionModel;
+import org.apache.syncope.client.console.wicket.markup.html.tree.TreeGroupProvider;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.wicket.Component;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.extensions.markup.html.repeater.tree.DefaultNestedTree;
+import org.apache.wicket.extensions.markup.html.repeater.tree.ITreeProvider;
+import org.apache.wicket.extensions.markup.html.repeater.tree.NestedTree;
+import org.apache.wicket.extensions.markup.html.repeater.tree.content.Folder;
+import org.apache.wicket.extensions.markup.html.repeater.tree.theme.WindowsTheme;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+public class GroupSelectModalPage extends BaseModalPage {
+
+ private static final long serialVersionUID = 2106489458494696439L;
+
+ @SpringBean
+ private GroupTreeBuilder groupTreeBuilder;
+
+ private final NestedTree<DefaultMutableTreeNode> tree;
+
+ public GroupSelectModalPage(final PageReference pageRef, final ModalWindow window, final Class<?> payloadClass) {
+ super();
+
+ final ITreeProvider<DefaultMutableTreeNode> treeProvider = new TreeGroupProvider(groupTreeBuilder, true);
+ final DefaultMutableTreeNodeExpansionModel treeModel = new DefaultMutableTreeNodeExpansionModel();
+
+ tree = new DefaultNestedTree<DefaultMutableTreeNode>("treeTable", treeProvider, treeModel) {
+
+ private static final long serialVersionUID = 7137658050662575546L;
+
+ @Override
+ protected Component newContentComponent(final String id, final IModel<DefaultMutableTreeNode> node) {
+ final DefaultMutableTreeNode treeNode = node.getObject();
+ final GroupTO groupTO = (GroupTO) treeNode.getUserObject();
+
+ return new Folder<DefaultMutableTreeNode>(id, GroupSelectModalPage.this.tree, node) {
+
+ private static final long serialVersionUID = 9046323319920426493L;
+
+ @Override
+ protected boolean isClickable() {
+ return true;
+ }
+
+ @Override
+ protected IModel<?> newLabelModel(final IModel<DefaultMutableTreeNode> model) {
+ return new Model<>(groupTO.getDisplayName());
+ }
+
+ @Override
+ protected void onClick(final AjaxRequestTarget target) {
+ super.onClick(target);
+
+ try {
+ Constructor<?> constructor = payloadClass.getConstructor(Long.class);
+ Object payload = constructor.newInstance(groupTO.getKey());
+
+ send(pageRef.getPage(), Broadcast.BREADTH, payload);
+ } catch (Exception e) {
+ LOG.error("Could not send group select event", e);
+ }
+
+ window.close(target);
+ }
+ };
+ }
+ };
+ tree.add(new WindowsTheme());
+ tree.setOutputMarkupId(true);
+
+ DefaultMutableTreeNodeExpansion.get().expandAll();
+
+ this.add(tree);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupTemplateModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupTemplateModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupTemplateModalPage.java
new file mode 100644
index 0000000..293e402
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/GroupTemplateModalPage.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.pages;
+
+import org.apache.syncope.client.console.commons.Mode;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.SyncTaskTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.form.Form;
+
+public class GroupTemplateModalPage extends GroupModalPage {
+
+ private static final long serialVersionUID = -3849135555203409845L;
+
+ private final SyncTaskTO syncTaskTO;
+
+ public GroupTemplateModalPage(final PageReference callerPageRef, final ModalWindow window,
+ final SyncTaskTO syncTaskTO) {
+
+ super(callerPageRef, window, syncTaskTO.getGroupTemplate() == null
+ ? new GroupTO()
+ : syncTaskTO.getGroupTemplate(), Mode.TEMPLATE);
+
+ this.syncTaskTO = syncTaskTO;
+ }
+
+ @Override
+ protected void submitAction(final AjaxRequestTarget target, final Form form) {
+ syncTaskTO.setGroupTemplate((GroupTO) form.getModelObject());
+ taskRestClient.updateSyncTask(syncTaskTO);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/Groups.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Groups.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Groups.java
new file mode 100644
index 0000000..2e92940
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Groups.java
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.pages;
+
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.panels.AbstractSearchResultPanel;
+import org.apache.syncope.client.console.panels.GroupSearchPanel;
+import org.apache.syncope.client.console.panels.GroupSearchResultPanel;
+import org.apache.syncope.client.console.panels.GroupSummaryPanel;
+import org.apache.syncope.client.console.rest.GroupRestClient;
+import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxButton;
+import org.apache.syncope.client.console.wicket.markup.html.tree.TreeGroupPanel;
+import org.apache.wicket.Session;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+/**
+ * Groups WebPage.
+ */
+public class Groups extends BasePage {
+
+ private static final long serialVersionUID = -2147758241610831969L;
+
+ private static final int WIN_HEIGHT = 500;
+
+ private static final int WIN_WIDTH = 800;
+
+ @SpringBean
+ private GroupRestClient restClient;
+
+ private final ModalWindow editGroupWin;
+
+ private final WebMarkupContainer groupTabsContainer;
+
+ public Groups(final PageParameters parameters) {
+ super(parameters);
+
+ groupTabsContainer = new WebMarkupContainer("groupTabsContainer");
+ groupTabsContainer.setOutputMarkupId(true);
+ add(groupTabsContainer);
+
+ editGroupWin = new ModalWindow("editGroupWin");
+ editGroupWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+ editGroupWin.setInitialHeight(WIN_HEIGHT);
+ editGroupWin.setInitialWidth(WIN_WIDTH);
+ editGroupWin.setCookieName("edit-group-modal");
+ add(editGroupWin);
+
+ final TreeGroupPanel treePanel = new TreeGroupPanel("treePanel");
+ treePanel.setOutputMarkupId(true);
+ groupTabsContainer.add(treePanel);
+
+ final GroupSummaryPanel summaryPanel = new GroupSummaryPanel.Builder("summaryPanel")
+ .window(editGroupWin).callerPageRef(Groups.this.getPageReference()).build();
+ groupTabsContainer.add(summaryPanel);
+
+ editGroupWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
+
+ private static final long serialVersionUID = 8804221891699487139L;
+
+ @Override
+ public void onClose(final AjaxRequestTarget target) {
+ final GroupSummaryPanel summaryPanel = (GroupSummaryPanel) groupTabsContainer.get("summaryPanel");
+
+ final TreeNodeClickUpdate data = new TreeNodeClickUpdate(target,
+ summaryPanel == null || summaryPanel.getSelectedNode() == null
+ ? 0
+ : summaryPanel.getSelectedNode().getKey());
+
+ send(getPage(), Broadcast.BREADTH, data);
+
+ if (modalResult) {
+ getSession().info(getString(Constants.OPERATION_SUCCEEDED));
+ feedbackPanel.refresh(target);
+ modalResult = false;
+ }
+
+ }
+ });
+
+ final AbstractSearchResultPanel searchResult =
+ new GroupSearchResultPanel("searchResult", true, null, getPageReference(), restClient);
+ add(searchResult);
+
+ final Form searchForm = new Form("searchForm");
+ add(searchForm);
+
+ final GroupSearchPanel searchPanel = new GroupSearchPanel.Builder("searchPanel").build();
+ searchForm.add(searchPanel);
+
+ searchForm.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), getPageReference()) {
+
+ private static final long serialVersionUID = -958724007591692537L;
+
+ @Override
+ protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
+ final String fiql = searchPanel.buildFIQL();
+ LOG.debug("Node condition {}", fiql);
+
+ doSearch(target, fiql, searchResult);
+
+ Session.get().getFeedbackMessages().clear();
+ searchPanel.getSearchFeedback().refresh(target);
+ }
+
+ @Override
+ protected void onError(final AjaxRequestTarget target, final Form<?> form) {
+ searchPanel.getSearchFeedback().refresh(target);
+ }
+ });
+ }
+
+ private void doSearch(final AjaxRequestTarget target, final String fiql,
+ final AbstractSearchResultPanel resultsetPanel) {
+
+ if (fiql == null) {
+ error(getString(Constants.SEARCH_ERROR));
+ return;
+ }
+
+ resultsetPanel.search(fiql, target);
+ }
+
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ super.onEvent(event);
+
+ if (event.getPayload() instanceof TreeNodeClickUpdate) {
+ final TreeNodeClickUpdate update = (TreeNodeClickUpdate) event.getPayload();
+
+ final GroupSummaryPanel summaryPanel = new GroupSummaryPanel.Builder("summaryPanel")
+ .window(editGroupWin).callerPageRef(Groups.this.getPageReference())
+ .selectedNodeId(update.getSelectedNodeId()).build();
+
+ groupTabsContainer.addOrReplace(summaryPanel);
+ update.getTarget().add(groupTabsContainer);
+ }
+ }
+
+ public static class TreeNodeClickUpdate {
+
+ private final AjaxRequestTarget target;
+
+ private Long selectedNodeId;
+
+ public TreeNodeClickUpdate(final AjaxRequestTarget target, final Long selectedNodeId) {
+ this.target = target;
+ this.selectedNodeId = selectedNodeId;
+ }
+
+ public AjaxRequestTarget getTarget() {
+ return target;
+ }
+
+ public Long getSelectedNodeId() {
+ return selectedNodeId;
+ }
+
+ public void setSelectedNodeId(final Long selectedNodeId) {
+ this.selectedNodeId = selectedNodeId;
+ }
+ }
+}
[30/57] syncope git commit: Merge branch 'master' into SYNCOPE-119
Posted by il...@apache.org.
Merge branch 'master' into SYNCOPE-119
Conflicts:
pom.xml
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/c5d8c896
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/c5d8c896
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/c5d8c896
Branch: refs/heads/master
Commit: c5d8c89693aa05dadd775524d763b777a61c58fc
Parents: 101b107 f99ea4c
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 7 13:25:14 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 7 13:25:14 2015 +0200
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/c5d8c896/pom.xml
----------------------------------------------------------------------
diff --cc pom.xml
index f5fe484,9b10760..2c1e1b6
--- a/pom.xml
+++ b/pom.xml
@@@ -356,8 -356,7 +356,8 @@@ under the License
<commons-io.version>2.4</commons-io.version>
<commons-codec.version>1.10</commons-codec.version>
<commons-jexl.version>2.1.1</commons-jexl.version>
- <commons-lang.version>3.3.2</commons-lang.version>
+ <commons-lang.version>3.4</commons-lang.version>
+ <commons-collection.version>4.0</commons-collection.version>
<commons.logging.version>1.1.3</commons.logging.version>
<h2.version>1.4.186</h2.version>
[25/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDetailsPanel.java
new file mode 100644
index 0000000..4af9d25
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupDetailsPanel.java
@@ -0,0 +1,435 @@
+/*
+ * 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 org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.commons.JexlHelpUtil;
+import org.apache.syncope.client.console.pages.GroupSelectModalPage;
+import org.apache.syncope.client.console.pages.UserOwnerSelectModalPage;
+import org.apache.syncope.client.console.panels.AttrTemplatesPanel.GroupAttrTemplatesChange;
+import org.apache.syncope.client.console.panels.AttrTemplatesPanel.Type;
+import org.apache.syncope.client.console.rest.GroupRestClient;
+import org.apache.syncope.client.console.rest.UserRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.wicket.Page;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.panel.Fragment;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GroupDetailsPanel extends Panel {
+
+ private static final long serialVersionUID = 855618618337931784L;
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(GroupDetailsPanel.class);
+
+ @SpringBean
+ private UserRestClient userRestClient;
+
+ @SpringBean
+ private GroupRestClient groupRestClient;
+
+ private final Fragment parentFragment;
+
+ private final WebMarkupContainer ownerContainer;
+
+ private final OwnerModel userOwnerModel;
+
+ private final OwnerModel groupOwnerModel;
+
+ private ParentModel parentModel;
+
+ public GroupDetailsPanel(final String id, final GroupTO groupTO, final boolean templateMode) {
+ super(id);
+
+ ownerContainer = new WebMarkupContainer("ownerContainer");
+ ownerContainer.setOutputMarkupId(true);
+ this.add(ownerContainer);
+
+ final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin");
+ userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+ userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal");
+ this.add(userOwnerSelectWin);
+ final ModalWindow groupOwnerSelectWin = new ModalWindow("groupOwnerSelectWin");
+ groupOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+ groupOwnerSelectWin.setCookieName("create-groupOwnerSelect-modal");
+ this.add(groupOwnerSelectWin);
+ final ModalWindow parentSelectWin = new ModalWindow("parentSelectWin");
+ parentSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+ parentSelectWin.setCookieName("create-parentSelect-modal");
+ this.add(parentSelectWin);
+
+ if (templateMode) {
+ parentFragment = new Fragment("parent", "parentFragment", this);
+
+ parentModel = new ParentModel(groupTO);
+ @SuppressWarnings("unchecked")
+ final AjaxTextFieldPanel parent = new AjaxTextFieldPanel("parent", "parent", parentModel);
+ parent.setReadOnly(true);
+ parent.setOutputMarkupId(true);
+ parentFragment.add(parent);
+ final AjaxLink<Void> parentSelect = new IndicatingAjaxLink<Void>("parentSelect") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ parentSelectWin.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new GroupSelectModalPage(getPage().getPageReference(), parentSelectWin,
+ ParentSelectPayload.class);
+ }
+ });
+ parentSelectWin.show(target);
+ }
+ };
+ parentFragment.add(parentSelect);
+ final IndicatingAjaxLink<Void> parentReset = new IndicatingAjaxLink<Void>("parentReset") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ parentModel.setObject(null);
+ target.add(parent);
+ }
+ };
+ parentFragment.add(parentReset);
+ } else {
+ parentFragment = new Fragment("parent", "emptyFragment", this);
+ }
+ parentFragment.setOutputMarkupId(true);
+ this.add(parentFragment);
+
+ final AjaxTextFieldPanel name =
+ new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(groupTO, "key"));
+
+ final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
+
+ final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
+ this.add(questionMarkJexlHelp);
+ questionMarkJexlHelp.add(jexlHelp);
+
+ if (!templateMode) {
+ name.addRequiredLabel();
+ questionMarkJexlHelp.setVisible(false);
+ }
+ this.add(name);
+
+ userOwnerModel = new OwnerModel(groupTO, AttributableType.USER);
+ @SuppressWarnings("unchecked")
+ final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel);
+ userOwner.setReadOnly(true);
+ userOwner.setOutputMarkupId(true);
+ ownerContainer.add(userOwner);
+ final AjaxLink<Void> userOwnerSelect = new IndicatingAjaxLink<Void>("userOwnerSelect") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ userOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin);
+ }
+ });
+ userOwnerSelectWin.show(target);
+ }
+ };
+ ownerContainer.add(userOwnerSelect);
+ final IndicatingAjaxLink<Void> userOwnerReset = new IndicatingAjaxLink<Void>("userOwnerReset") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ userOwnerModel.setObject(null);
+ target.add(userOwner);
+ }
+ };
+ ownerContainer.add(userOwnerReset);
+
+ groupOwnerModel = new OwnerModel(groupTO, AttributableType.GROUP);
+ @SuppressWarnings("unchecked")
+ final AjaxTextFieldPanel groupOwner = new AjaxTextFieldPanel("groupOwner", "groupOwner", groupOwnerModel);
+ groupOwner.setReadOnly(true);
+ groupOwner.setOutputMarkupId(true);
+ ownerContainer.add(groupOwner);
+ final AjaxLink<Void> groupOwnerSelect = new IndicatingAjaxLink<Void>("groupOwnerSelect") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ parentSelectWin.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new GroupSelectModalPage(getPage().getPageReference(), parentSelectWin,
+ GroupOwnerSelectPayload.class);
+ }
+ });
+ parentSelectWin.show(target);
+ }
+ };
+ ownerContainer.add(groupOwnerSelect);
+ final IndicatingAjaxLink<Void> groupOwnerReset = new IndicatingAjaxLink<Void>("groupOwnerReset") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ groupOwnerModel.setObject(null);
+ target.add(groupOwner);
+ }
+ };
+ ownerContainer.add(groupOwnerReset);
+
+ final AjaxCheckBoxPanel inhOwner = new AjaxCheckBoxPanel("inheritOwner", "inheritOwner",
+ new PropertyModel<Boolean>(groupTO, "inheritOwner"));
+ this.add(inhOwner);
+
+ final AjaxCheckBoxPanel inhTemplates = new AjaxCheckBoxPanel("inheritTemplates", "inheritTemplates",
+ new PropertyModel<Boolean>(groupTO, "inheritTemplates"));
+ inhTemplates.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ send(getPage(), Broadcast.BREADTH, new GroupAttrTemplatesChange(Type.gPlainAttrTemplates, target));
+ send(getPage(), Broadcast.BREADTH, new GroupAttrTemplatesChange(Type.gDerAttrTemplates, target));
+ send(getPage(), Broadcast.BREADTH, new GroupAttrTemplatesChange(Type.gVirAttrTemplates, target));
+ }
+ });
+ this.add(inhTemplates);
+ }
+
+ /**
+ * This is waiting for events from opened modal windows: first to get the selected user / group, then to update the
+ * respective text panel.
+ *
+ * {@inheritDoc }
+ */
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ super.onEvent(event);
+
+ if (event.getPayload() instanceof ParentSelectPayload) {
+ parentModel.setObject(((ParentSelectPayload) event.getPayload()).getGroupId());
+ }
+ if (event.getPayload() instanceof UserOwnerSelectPayload) {
+ userOwnerModel.setObject(((UserOwnerSelectPayload) event.getPayload()).getUserId());
+ }
+ if (event.getPayload() instanceof GroupOwnerSelectPayload) {
+ groupOwnerModel.setObject(((GroupOwnerSelectPayload) event.getPayload()).getGroupId());
+ }
+
+ if (event.getPayload() instanceof AjaxRequestTarget) {
+ ((AjaxRequestTarget) event.getPayload()).add(parentFragment);
+ ((AjaxRequestTarget) event.getPayload()).add(ownerContainer);
+ }
+ }
+
+ private class OwnerModel implements IModel {
+
+ private static final long serialVersionUID = -3865621970810102714L;
+
+ private final GroupTO groupTO;
+
+ private final AttributableType type;
+
+ public OwnerModel(final GroupTO groupTO, final AttributableType type) {
+ this.groupTO = groupTO;
+ this.type = type;
+ }
+
+ @Override
+ public Object getObject() {
+ String object = null;
+
+ switch (type) {
+ case USER:
+ if (groupTO.getUserOwner() != null) {
+ UserTO user = null;
+ try {
+ user = userRestClient.read(groupTO.getUserOwner());
+ } catch (Exception e) {
+ LOG.warn("Could not find user with id {}, ignoring", groupTO.getUserOwner(), e);
+ }
+ if (user == null) {
+ groupTO.setUserOwner(null);
+ } else {
+ object = user.getKey() + " " + user.getUsername();
+ }
+ }
+ break;
+
+ case GROUP:
+ GroupTO group = null;
+ if (groupTO.getGroupOwner() != null) {
+ try {
+ group = groupRestClient.read(groupTO.getGroupOwner());
+ } catch (Exception e) {
+ LOG.warn("Could not find group with id {}, ignoring", groupTO.getGroupOwner(), e);
+ }
+ if (group == null) {
+ groupTO.setGroupOwner(null);
+ } else {
+ object = group.getDisplayName();
+ }
+ }
+ break;
+
+ case MEMBERSHIP:
+ default:
+ }
+
+ return object;
+ }
+
+ @Override
+ public void setObject(final Object object) {
+ switch (type) {
+ case USER:
+ groupTO.setUserOwner((Long) object);
+ break;
+
+ case GROUP:
+ groupTO.setGroupOwner((Long) object);
+ break;
+
+ case MEMBERSHIP:
+ default:
+ }
+ }
+
+ @Override
+ public void detach() {
+ // ignore
+ }
+ }
+
+ private class ParentModel implements IModel {
+
+ private static final long serialVersionUID = 1006546156848990721L;
+
+ private final GroupTO groupTO;
+
+ public ParentModel(final GroupTO groupTO) {
+ this.groupTO = groupTO;
+ }
+
+ @Override
+ public Object getObject() {
+ Object object = null;
+ if (groupTO.getParent() != 0) {
+ GroupTO parent = null;
+ try {
+ parent = groupRestClient.read(groupTO.getParent());
+ } catch (Exception e) {
+ LOG.warn("Could not find group with id {}, ignoring", groupTO.getParent(), e);
+ }
+ if (parent == null) {
+ groupTO.setParent(0);
+ } else {
+ object = parent.getDisplayName();
+ }
+ }
+ return object;
+ }
+
+ @Override
+ public void setObject(final Object object) {
+ groupTO.setParent((object instanceof Long) ? ((Long) object) : 0);
+ }
+
+ @Override
+ public void detach() {
+ // ignore
+ }
+ }
+
+ public static class UserOwnerSelectPayload {
+
+ private final Long userId;
+
+ public UserOwnerSelectPayload(final Long userId) {
+ this.userId = userId;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+ }
+
+ public static class GroupOwnerSelectPayload {
+
+ private final Long groupId;
+
+ public GroupOwnerSelectPayload(final Long groupId) {
+ this.groupId = groupId;
+ }
+
+ public Long getGroupId() {
+ return groupId;
+ }
+ }
+
+ public static class ParentSelectPayload {
+
+ private final Long groupId;
+
+ public ParentSelectPayload(final Long groupId) {
+ this.groupId = groupId;
+ }
+
+ public Long getGroupId() {
+ return groupId;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java
new file mode 100644
index 0000000..7cbf47e
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.panels;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.client.console.commons.Mode;
+import org.apache.syncope.client.console.commons.XMLRolesReader;
+import org.apache.syncope.client.console.commons.status.StatusBean;
+import org.apache.syncope.client.console.rest.AuthRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.util.ListModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+public class GroupPanel extends Panel {
+
+ private static final long serialVersionUID = 4216376097320768369L;
+
+ @SpringBean
+ private AuthRestClient authRestClient;
+
+ @SpringBean
+ private XMLRolesReader xmlRolesReader;
+
+ private final AjaxPalettePanel<String> entitlements;
+
+ public static class Builder implements Serializable {
+
+ private static final long serialVersionUID = 8150440254654306070L;
+
+ private String id;
+
+ private Form form;
+
+ private GroupTO groupTO;
+
+ private Mode mode;
+
+ private PageReference pageReference;
+
+ public Builder(final String id) {
+ this.id = id;
+ }
+
+ public Builder form(final Form form) {
+ this.form = form;
+ return this;
+ }
+
+ public Builder groupTO(final GroupTO groupTO) {
+ this.groupTO = groupTO;
+ return this;
+ }
+
+ public Builder groupModalPageMode(final Mode mode) {
+ this.mode = mode;
+ return this;
+ }
+
+ public Builder pageRef(final PageReference pageReference) {
+ this.pageReference = pageReference;
+ return this;
+ }
+
+ public GroupPanel build() {
+ return new GroupPanel(this);
+ }
+ }
+
+ private GroupPanel(final Builder builder) {
+ super(builder.id);
+
+ this.add(new GroupDetailsPanel("details", builder.groupTO, builder.mode == Mode.TEMPLATE));
+
+ if (builder.pageReference == null || builder.groupTO.getKey() == 0) {
+ this.add(new Label("statuspanel", ""));
+ } else {
+ StatusPanel statusPanel = new StatusPanel(
+ "statuspanel", builder.groupTO, new ArrayList<StatusBean>(), builder.pageReference);
+ statusPanel.setOutputMarkupId(true);
+ MetaDataRoleAuthorizationStrategy.authorize(
+ statusPanel, RENDER, xmlRolesReader.getEntitlement("Resources", "getConnectorObject"));
+ this.add(statusPanel);
+ }
+
+ this.add(new AnnotatedBeanPanel("systeminformation", builder.groupTO));
+
+ //--------------------------------
+ // Attribute templates panel
+ //--------------------------------
+ AttrTemplatesPanel attrTemplates = new AttrTemplatesPanel("templates", builder.groupTO);
+ this.add(attrTemplates);
+
+ //--------------------------------
+ // Attributes panel
+ //--------------------------------
+ this.add(new PlainAttrsPanel(
+ "plainAttrs", builder.groupTO, builder.form, builder.mode, attrTemplates));
+
+ final AjaxCheckBoxPanel inhAttributes = new AjaxCheckBoxPanel("inheritPlainAttrs", "inheritPlainAttrs",
+ new PropertyModel<Boolean>(builder.groupTO, "inheritPlainAttrs"));
+ inhAttributes.setOutputMarkupId(true);
+ this.add(inhAttributes);
+ //--------------------------------
+
+ //--------------------------------
+ // Derived attributes panel
+ //--------------------------------
+ this.add(new DerAttrsPanel("derAttrs", builder.groupTO, attrTemplates));
+
+ final AjaxCheckBoxPanel inhDerivedAttributes = new AjaxCheckBoxPanel("inheritDerAttrs",
+ "inheritDerAttrs", new PropertyModel<Boolean>(builder.groupTO, "inheritDerAttrs"));
+ inhDerivedAttributes.setOutputMarkupId(true);
+ this.add(inhDerivedAttributes);
+ //--------------------------------
+
+ //--------------------------------
+ // Virtual attributes panel
+ //--------------------------------
+ this.add(new VirAttrsPanel(
+ "virAttrs", builder.groupTO, builder.mode == Mode.TEMPLATE, attrTemplates));
+
+ final AjaxCheckBoxPanel inhVirtualAttributes = new AjaxCheckBoxPanel("inheritVirAttrs",
+ "inheritVirAttrs", new PropertyModel<Boolean>(builder.groupTO, "inheritVirAttrs"));
+ inhVirtualAttributes.setOutputMarkupId(true);
+ this.add(inhVirtualAttributes);
+ //--------------------------------
+
+ //--------------------------------
+ // Resources panel
+ //--------------------------------
+ this.add(new ResourcesPanel.Builder("resources").attributableTO(builder.groupTO).build().
+ setOutputMarkupId(true));
+ //--------------------------------
+
+ //--------------------------------
+ // Entitlements
+ //--------------------------------
+ ListModel<String> selectedEntitlements = new ListModel<String>(builder.groupTO.getEntitlements());
+
+ List<String> allEntitlements = authRestClient.getAllEntitlements();
+ if (allEntitlements != null && !allEntitlements.isEmpty()) {
+ Collections.sort(allEntitlements);
+ }
+ ListModel<String> availableEntitlements = new ListModel<String>(allEntitlements);
+
+ entitlements = new AjaxPalettePanel<String>("entitlements", selectedEntitlements, availableEntitlements);
+ this.add(entitlements);
+
+ //--------------------------------
+ // Security panel
+ //--------------------------------
+ this.add(new GroupSecurityPanel("security", builder.groupTO).setOutputMarkupId(true));
+ //--------------------------------
+ }
+
+ public Collection<String> getSelectedEntitlements() {
+ return this.entitlements.getModelCollection();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchPanel.java
new file mode 100644
index 0000000..d13ab94
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchPanel.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.panels;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.wicket.model.LoadableDetachableModel;
+
+public class GroupSearchPanel extends AbstractSearchPanel {
+
+ private static final long serialVersionUID = 5757183539269316263L;
+
+ public static class Builder implements Serializable {
+
+ private static final long serialVersionUID = 6308997285778809579L;
+
+ private String id;
+
+ private String fiql = null;
+
+ private boolean required = true;
+
+ public Builder(final String id) {
+ this.id = id;
+ }
+
+ public Builder fiql(final String fiql) {
+ this.fiql = fiql;
+ return this;
+ }
+
+ public Builder required(final boolean required) {
+ this.required = required;
+ return this;
+ }
+
+ public GroupSearchPanel build() {
+ return new GroupSearchPanel(this);
+ }
+ }
+
+ private GroupSearchPanel(final Builder builder) {
+ super(builder.id, AttributableType.GROUP, builder.fiql, builder.required);
+ }
+
+ @Override
+ protected void populate() {
+ super.populate();
+
+ this.types = new LoadableDetachableModel<List<SearchClause.Type>>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected List<SearchClause.Type> load() {
+ final List<SearchClause.Type> result = new ArrayList<SearchClause.Type>();
+ result.add(SearchClause.Type.ATTRIBUTE);
+ result.add(SearchClause.Type.ENTITLEMENT);
+ result.add(SearchClause.Type.RESOURCE);
+ return result;
+ }
+ };
+
+ this.groupNames = new LoadableDetachableModel<List<String>>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected List<String> load() {
+ return Collections.<String>emptyList();
+ }
+ };
+ }
+
+ @Override
+ protected AbstractFiqlSearchConditionBuilder getSearchConditionBuilder() {
+ return SyncopeClient.getGroupSearchConditionBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java
new file mode 100644
index 0000000..a7dac82
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java
@@ -0,0 +1,172 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.pages.ResultStatusModalPage;
+import org.apache.syncope.client.console.pages.GroupModalPage;
+import org.apache.syncope.client.console.pages.StatusModalPage;
+import org.apache.syncope.client.console.rest.AbstractSubjectRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink.ActionType;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.wicket.Page;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
+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.repeater.Item;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.ResourceModel;
+
+public class GroupSearchResultPanel extends AbstractSearchResultPanel {
+
+ private static final long serialVersionUID = -1180593361914008764L;
+
+ private final static String PAGEID = "Groups";
+
+ public <T extends AbstractAttributableTO> GroupSearchResultPanel(final String id, final boolean filtered,
+ final String fiql, final PageReference callerRef, final AbstractSubjectRestClient restClient) {
+
+ super(id, filtered, fiql, callerRef, restClient);
+ initResultTable();
+ }
+
+ @Override
+ protected List<IColumn<AbstractAttributableTO, String>> getColumns() {
+ final List<IColumn<AbstractAttributableTO, String>> columns = new ArrayList<>();
+
+ for (String item : new String[] { "key", "name", "entitlements" }) {
+ columns.add(new PropertyColumn<AbstractAttributableTO, String>(new ResourceModel(item, item), item, item));
+ }
+
+ columns.add(new AbstractColumn<AbstractAttributableTO, String>(new ResourceModel("actions", "")) {
+
+ private static final long serialVersionUID = -3503023501954863131L;
+
+ @Override
+ public String getCssClass() {
+ return "action";
+ }
+
+ @Override
+ public void populateItem(final Item<ICellPopulator<AbstractAttributableTO>> cellItem,
+ final String componentId, final IModel<AbstractAttributableTO> model) {
+
+ final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, page.getPageReference());
+
+ panel.add(new ActionLink() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ statusmodal.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new StatusModalPage<GroupTO>(
+ page.getPageReference(), statusmodal, (GroupTO) model.getObject());
+ }
+ });
+
+ statusmodal.show(target);
+ }
+ }, ActionLink.ActionType.MANAGE_RESOURCES, PAGEID);
+
+ panel.add(new ActionLink() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ editmodal.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new GroupModalPage(
+ page.getPageReference(), editmodal, (GroupTO) model.getObject());
+ }
+ });
+
+ editmodal.show(target);
+ }
+ }, ActionLink.ActionType.EDIT, PAGEID);
+
+ panel.add(new ActionLink() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ try {
+ final GroupTO groupTO = (GroupTO) restClient.
+ delete(model.getObject().getETagValue(), model.getObject().getKey());
+
+ page.setModalResult(true);
+
+ editmodal.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new ResultStatusModalPage.Builder(editmodal, groupTO).build();
+ }
+ });
+
+ editmodal.show(target);
+ } catch (SyncopeClientException scce) {
+ error(getString(Constants.OPERATION_ERROR) + ": " + scce.getMessage());
+ feedbackPanel.refresh(target);
+ }
+ }
+ }, ActionLink.ActionType.DELETE, PAGEID);
+
+ cellItem.add(panel);
+ }
+ });
+
+ return columns;
+ }
+
+ @Override
+ protected Collection<ActionType> getBulkActions() {
+ return Collections.<ActionLink.ActionType>singletonList(ActionLink.ActionType.DELETE);
+ }
+
+ @Override
+ protected String getPageId() {
+ return PAGEID;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSecurityPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSecurityPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSecurityPanel.java
new file mode 100644
index 0000000..4e0e1f9
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSecurityPanel.java
@@ -0,0 +1,198 @@
+/*
+ * 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.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.rest.PolicyRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AbstractPolicyTO;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.ChoiceRenderer;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GroupSecurityPanel extends Panel {
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(GroupSecurityPanel.class);
+
+ private static final long serialVersionUID = -7982691107029848579L;
+
+ @SpringBean
+ private PolicyRestClient policyRestClient;
+
+ private IModel<Map<Long, String>> passwordPolicies = null;
+
+ private IModel<Map<Long, String>> accountPolicies = null;
+
+ public <T extends AbstractAttributableTO> GroupSecurityPanel(final String id, final T entityTO) {
+ super(id);
+
+ setOutputMarkupId(true);
+
+ passwordPolicies = new LoadableDetachableModel<Map<Long, String>>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected Map<Long, String> load() {
+ Map<Long, String> res = new HashMap<>();
+ for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD, false)) {
+ res.put(policyTO.getKey(), policyTO.getDescription());
+ }
+ return res;
+ }
+ };
+
+ accountPolicies = new LoadableDetachableModel<Map<Long, String>>() {
+
+ private static final long serialVersionUID = -2012833443695917883L;
+
+ @Override
+ protected Map<Long, String> load() {
+ Map<Long, String> res = new HashMap<>();
+ for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT, false)) {
+ res.put(policyTO.getKey(), policyTO.getDescription());
+ }
+ return res;
+ }
+ };
+
+ final WebMarkupContainer securityContainer = new WebMarkupContainer("security");
+
+ securityContainer.setOutputMarkupId(true);
+ add(securityContainer);
+
+ // -------------------------------
+ // Password policy specification
+ // -------------------------------
+ final AjaxDropDownChoicePanel<Long> passwordPolicy = new AjaxDropDownChoicePanel<Long>("passwordPolicy",
+ "passwordPolicy", new PropertyModel<Long>(entityTO, "passwordPolicy"));
+
+ passwordPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.PASSWORD));
+
+ passwordPolicy.setChoices(new ArrayList<Long>(passwordPolicies.getObject().keySet()));
+
+ ((DropDownChoice<?>) passwordPolicy.getField()).setNullValid(true);
+
+ securityContainer.add(passwordPolicy);
+
+ final AjaxCheckBoxPanel inhPasswordPolicy = new AjaxCheckBoxPanel("inheritPasswordPolicy",
+ "inheritPasswordPolicy", new PropertyModel<Boolean>(entityTO, "inheritPasswordPolicy"));
+
+ passwordPolicy.setReadOnly(inhPasswordPolicy.getModelObject());
+
+ inhPasswordPolicy.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ passwordPolicy.setReadOnly(inhPasswordPolicy.getModelObject());
+ target.add(passwordPolicy);
+ }
+ });
+
+ securityContainer.add(inhPasswordPolicy);
+ // -------------------------------
+
+ // -------------------------------
+ // Account policy specification
+ // -------------------------------
+ final AjaxDropDownChoicePanel<Long> accountPolicy = new AjaxDropDownChoicePanel<Long>("accountPolicy",
+ "accountPolicy", new PropertyModel<Long>(entityTO, "accountPolicy"));
+
+ accountPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.ACCOUNT));
+
+ accountPolicy.setChoices(new ArrayList<Long>(accountPolicies.getObject().keySet()));
+
+ ((DropDownChoice<?>) accountPolicy.getField()).setNullValid(true);
+
+ securityContainer.add(accountPolicy);
+
+ final AjaxCheckBoxPanel inhAccountPolicy = new AjaxCheckBoxPanel("inheritAccountPolicy",
+ "inheritAccountPolicy", new PropertyModel<Boolean>(entityTO, "inheritAccountPolicy"));
+ accountPolicy.setReadOnly(inhAccountPolicy.getModelObject());
+
+ inhAccountPolicy.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ accountPolicy.setReadOnly(inhAccountPolicy.getModelObject());
+ target.add(accountPolicy);
+ }
+ });
+
+ securityContainer.add(inhAccountPolicy);
+ // -------------------------------
+ }
+
+ private class PolicyRenderer extends ChoiceRenderer<Long> {
+
+ private static final long serialVersionUID = 8060500161321947000L;
+
+ private PolicyType type;
+
+ public PolicyRenderer(final PolicyType type) {
+ super();
+ this.type = type;
+ }
+
+ @Override
+ public Object getDisplayValue(final Long object) {
+ Object displayValue;
+ switch (type) {
+ case ACCOUNT:
+ displayValue = accountPolicies.getObject().get(object);
+ break;
+ case PASSWORD:
+ displayValue = passwordPolicies.getObject().get(object);
+ break;
+ default:
+ displayValue = "";
+ }
+ return displayValue;
+ }
+
+ @Override
+ public String getIdValue(Long object, int index) {
+ return String.valueOf(object != null
+ ? object
+ : 0L);
+ }
+ };
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSummaryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSummaryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSummaryPanel.java
new file mode 100644
index 0000000..f9a56e6
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSummaryPanel.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.panels;
+
+import java.io.Serializable;
+import org.apache.syncope.client.console.commons.XMLRolesReader;
+import org.apache.syncope.client.console.pages.GroupModalPage;
+import org.apache.syncope.client.console.rest.GroupRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.wicket.Page;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.panel.Fragment;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GroupSummaryPanel extends Panel {
+
+ private static final long serialVersionUID = 643769814985593156L;
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(GroupSummaryPanel.class);
+
+ @SpringBean
+ private XMLRolesReader xmlRolesReader;
+
+ @SpringBean
+ private GroupRestClient restClient;
+
+ private GroupTO selectedNode;
+
+ public static class Builder implements Serializable {
+
+ private static final long serialVersionUID = 4164563358509351832L;
+
+ private String id;
+
+ private ModalWindow window;
+
+ private PageReference callerPageRef;
+
+ private Long selectedNodeId = null;
+
+ public Builder(final String id) {
+ this.id = id;
+ }
+
+ public GroupSummaryPanel.Builder window(final ModalWindow window) {
+ this.window = window;
+ return this;
+ }
+
+ public GroupSummaryPanel.Builder callerPageRef(final PageReference callerPageRef) {
+ this.callerPageRef = callerPageRef;
+ return this;
+ }
+
+ public GroupSummaryPanel.Builder selectedNodeId(final Long selectedNodeId) {
+ this.selectedNodeId = selectedNodeId;
+ return this;
+ }
+
+ public GroupSummaryPanel build() {
+ return new GroupSummaryPanel(this);
+ }
+ }
+
+ private GroupSummaryPanel(final Builder builder) {
+ super(builder.id);
+
+ if (builder.selectedNodeId == null || builder.selectedNodeId == 0) {
+ selectedNode = null;
+ } else {
+ try {
+ selectedNode = restClient.read(builder.selectedNodeId);
+ } catch (SyncopeClientException e) {
+ LOG.error("Could not read {}", builder.selectedNodeId, e);
+ selectedNode = null;
+ builder.selectedNodeId = null;
+ }
+ }
+
+ Fragment fragment = new Fragment("groupSummaryPanel",
+ builder.selectedNodeId == null
+ ? "fakerootFrag"
+ : (builder.selectedNodeId == 0 ? "rootPanel" : "groupViewPanel"),
+ this);
+
+ if (builder.selectedNodeId != null) {
+ if (builder.selectedNodeId == 0) {
+ @SuppressWarnings("rawtypes")
+ final ActionLinksPanel links = new ActionLinksPanel("actionLinks", new Model(), builder.callerPageRef);
+ links.setOutputMarkupId(true);
+ fragment.add(links);
+
+ links.addWithRoles(new ActionLink() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ builder.window.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new GroupModalPage(builder.callerPageRef, builder.window, new GroupTO());
+ }
+ });
+
+ builder.window.show(target);
+ }
+ }, ActionLink.ActionType.CREATE, xmlRolesReader.getEntitlement("Groups", "create"));
+ } else {
+ GroupTabPanel groupTabPanel =
+ new GroupTabPanel("nodeViewPanel", selectedNode, builder.window, builder.callerPageRef);
+ groupTabPanel.setOutputMarkupId(true);
+ fragment.add(groupTabPanel);
+ }
+ }
+ add(fragment);
+ }
+
+ public GroupTO getSelectedNode() {
+ return selectedNode;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupTabPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupTabPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupTabPanel.java
new file mode 100644
index 0000000..9615554
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupTabPanel.java
@@ -0,0 +1,195 @@
+/*
+ * 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 org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.commons.Mode;
+import org.apache.syncope.client.console.commons.XMLRolesReader;
+import org.apache.syncope.client.console.pages.ResultStatusModalPage;
+import org.apache.syncope.client.console.pages.GroupModalPage;
+import org.apache.syncope.client.console.pages.Groups;
+import org.apache.syncope.client.console.pages.StatusModalPage;
+import org.apache.syncope.client.console.rest.GroupRestClient;
+import org.apache.syncope.client.console.rest.UserRestClient;
+import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxButton;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.wicket.Page;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+public class GroupTabPanel extends Panel {
+
+ private static final long serialVersionUID = 859236186975983959L;
+
+ @SpringBean
+ private XMLRolesReader xmlRolesReader;
+
+ @SpringBean
+ private GroupRestClient groupRestClient;
+
+ @SpringBean
+ private UserRestClient userRestClient;
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public GroupTabPanel(final String id, final GroupTO selectedNode, final ModalWindow window,
+ final PageReference pageRef) {
+
+ super(id);
+
+ this.add(new Label("displayName", selectedNode.getDisplayName()));
+
+ final ActionLinksPanel links = new ActionLinksPanel("actionLinks", new Model(), pageRef);
+ links.setOutputMarkupId(true);
+ this.add(links);
+ links.addWithRoles(new ActionLink() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ window.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ GroupTO groupTO = new GroupTO();
+ groupTO.setParent(selectedNode.getKey());
+ return new GroupModalPage(pageRef, window, groupTO);
+ }
+ });
+
+ window.show(target);
+ }
+ }, ActionLink.ActionType.CREATE, xmlRolesReader.getEntitlement("Groups", "create"));
+ links.addWithRoles(new ActionLink() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ window.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new StatusModalPage<GroupTO>(pageRef, window, groupRestClient.read(selectedNode.getKey()));
+ }
+ });
+
+ window.show(target);
+ }
+ }, ActionLink.ActionType.MANAGE_RESOURCES, xmlRolesReader.getEntitlement("Groups", "update"));
+ links.addWithRoles(new ActionLink() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ window.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ GroupTO groupTO = groupRestClient.read(selectedNode.getKey());
+ return new GroupModalPage(pageRef, window, groupTO);
+ }
+ });
+
+ window.show(target);
+ }
+ }, ActionLink.ActionType.EDIT, xmlRolesReader.getEntitlement("Groups", "update"));
+ links.addWithRoles(new ActionLink() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ try {
+ final GroupTO groupTO = groupRestClient.delete(selectedNode.getETagValue(), selectedNode.getKey());
+
+ ((Groups) pageRef.getPage()).setModalResult(true);
+
+ window.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new ResultStatusModalPage.Builder(window, groupTO).build();
+ }
+ });
+
+ window.show(target);
+ } catch (SyncopeClientException e) {
+ error(getString(Constants.OPERATION_ERROR) + ": " + e.getMessage());
+ ((Groups) pageRef.getPage()).getFeedbackPanel().refresh(target);
+ }
+ }
+ }, ActionLink.ActionType.DELETE, xmlRolesReader.getEntitlement("Groups", "delete"));
+
+ final Form form = new Form("groupForm");
+ form.setModel(new CompoundPropertyModel(selectedNode));
+ form.setOutputMarkupId(true);
+
+ final GroupPanel groupPanel = new GroupPanel.Builder("groupPanel").
+ form(form).groupTO(selectedNode).groupModalPageMode(Mode.ADMIN).build();
+ groupPanel.setEnabled(false);
+ form.add(groupPanel);
+
+ final WebMarkupContainer userListContainer = new WebMarkupContainer("userListContainer");
+
+ userListContainer.setOutputMarkupId(true);
+ userListContainer.setEnabled(true);
+ userListContainer.add(new UserSearchResultPanel("userList", true, null, pageRef, userRestClient));
+ userListContainer.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), pageRef) {
+
+ private static final long serialVersionUID = -958724007591692537L;
+
+ @Override
+ protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
+ userListContainer.replace(new UserSearchResultPanel("userList",
+ true,
+ SyncopeClient.getUserSearchConditionBuilder().inGroups(selectedNode.getKey()).query(),
+ pageRef,
+ userRestClient));
+
+ target.add(userListContainer);
+ }
+ });
+
+ form.add(userListContainer);
+ add(form);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/MembershipsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/MembershipsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/MembershipsPanel.java
index fb00dcf..9136462 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/MembershipsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/MembershipsPanel.java
@@ -24,8 +24,7 @@ import java.util.List;
import java.util.Set;
import javax.swing.tree.DefaultMutableTreeNode;
import org.apache.syncope.client.console.commons.Mode;
-import org.apache.syncope.client.console.commons.RoleTreeBuilder;
-import org.apache.syncope.client.console.commons.RoleUtils;
+import org.apache.syncope.client.console.commons.GroupTreeBuilder;
import org.apache.syncope.client.console.commons.status.StatusUtils;
import org.apache.syncope.client.console.pages.MembershipModalPage;
import org.apache.syncope.client.console.pages.UserModalPage;
@@ -33,9 +32,9 @@ import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicating
import org.apache.syncope.client.console.wicket.ajax.markup.html.IndicatingOnConfirmAjaxLink;
import org.apache.syncope.client.console.wicket.markup.html.tree.DefaultMutableTreeNodeExpansion;
import org.apache.syncope.client.console.wicket.markup.html.tree.DefaultMutableTreeNodeExpansionModel;
-import org.apache.syncope.client.console.wicket.markup.html.tree.TreeRoleProvider;
+import org.apache.syncope.client.console.wicket.markup.html.tree.TreeGroupProvider;
import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.wicket.Component;
import org.apache.wicket.Page;
@@ -63,7 +62,7 @@ public class MembershipsPanel extends Panel {
private static final long serialVersionUID = -2559791301973107191L;
@SpringBean
- private RoleTreeBuilder roleTreeBuilder;
+ private GroupTreeBuilder groupTreeBuilder;
private final ListView<MembershipTO> membView;
@@ -89,7 +88,7 @@ public class MembershipsPanel extends Panel {
membWin.setCookieName("create-membership-modal");
add(membWin);
- final ITreeProvider<DefaultMutableTreeNode> treeProvider = new TreeRoleProvider(roleTreeBuilder, true);
+ final ITreeProvider<DefaultMutableTreeNode> treeProvider = new TreeGroupProvider(groupTreeBuilder, true);
final DefaultMutableTreeNodeExpansionModel treeModel = new DefaultMutableTreeNodeExpansionModel();
tree = new DefaultNestedTree<DefaultMutableTreeNode>("treeTable", treeProvider, treeModel) {
@@ -99,7 +98,7 @@ public class MembershipsPanel extends Panel {
@Override
protected Component newContentComponent(final String id, final IModel<DefaultMutableTreeNode> node) {
final DefaultMutableTreeNode treeNode = node.getObject();
- final RoleTO roleTO = (RoleTO) treeNode.getUserObject();
+ final GroupTO groupTO = (GroupTO) treeNode.getUserObject();
return new Folder<DefaultMutableTreeNode>(id, MembershipsPanel.this.tree, node) {
@@ -112,12 +111,12 @@ public class MembershipsPanel extends Panel {
@Override
protected IModel<?> newLabelModel(final IModel<DefaultMutableTreeNode> model) {
- return new Model<String>(roleTO.getDisplayName());
+ return new Model<String>(groupTO.getDisplayName());
}
@Override
protected void onClick(final AjaxRequestTarget target) {
- if (roleTO.getKey() > 0) {
+ if (groupTO.getKey() > 0) {
membWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = 7661763358801821185L;
@@ -127,13 +126,13 @@ public class MembershipsPanel extends Panel {
PageReference pageRef = getPage().getPageReference();
for (MembershipTO membTO : membView.getList()) {
- if (membTO.getRoleId() == roleTO.getKey()) {
+ if (membTO.getGroupId() == groupTO.getKey()) {
return new MembershipModalPage(pageRef, membWin, membTO, mode);
}
}
MembershipTO membTO = new MembershipTO();
- membTO.setRoleId(roleTO.getKey());
- membTO.setRoleName(roleTO.getName());
+ membTO.setGroupId(groupTO.getKey());
+ membTO.setGroupName(groupTO.getName());
return new MembershipModalPage(pageRef, membWin, membTO, mode);
}
@@ -160,8 +159,8 @@ public class MembershipsPanel extends Panel {
protected void populateItem(final ListItem<MembershipTO> item) {
final MembershipTO membershipTO = (MembershipTO) item.getDefaultModelObject();
- item.add(new Label("roleId", new Model<Long>(membershipTO.getRoleId())));
- item.add(new Label("roleName", new Model<String>(membershipTO.getRoleName())));
+ item.add(new Label("groupId", new Model<Long>(membershipTO.getGroupId())));
+ item.add(new Label("groupName", new Model<String>(membershipTO.getGroupName())));
AjaxLink editLink = new ClearIndicatingAjaxLink("editLink", pageRef) {
@@ -195,15 +194,15 @@ public class MembershipsPanel extends Panel {
((UserModalPage) getPage()).getUserTO().getMemberships().remove(membershipTO);
target.add(membershipsContainer);
- RoleTO roleTO = RoleUtils.findRole(roleTreeBuilder, membershipTO.getRoleId());
- Set<String> resourcesToRemove = roleTO == null
- ? Collections.<String>emptySet() : roleTO.getResources();
+ GroupTO groupTO = groupTreeBuilder.findGroup(membershipTO.getGroupId());
+ Set<String> resourcesToRemove = groupTO == null
+ ? Collections.<String>emptySet() : groupTO.getResources();
if (!resourcesToRemove.isEmpty()) {
- Set<String> resourcesAssignedViaMembership = new HashSet<String>();
+ Set<String> resourcesAssignedViaMembership = new HashSet<>();
for (MembershipTO membTO : userTO.getMemberships()) {
- roleTO = RoleUtils.findRole(roleTreeBuilder, membTO.getRoleId());
- if (roleTO != null) {
- resourcesAssignedViaMembership.addAll(roleTO.getResources());
+ groupTO = groupTreeBuilder.findGroup(membTO.getGroupId());
+ if (groupTO != null) {
+ resourcesAssignedViaMembership.addAll(groupTO.getResources());
}
}
resourcesToRemove.removeAll(resourcesAssignedViaMembership);
@@ -236,11 +235,11 @@ public class MembershipsPanel extends Panel {
Set<Long> diff = new HashSet<Long>(updatedUserTO.getMembershipMap().keySet());
diff.removeAll(userTO.getMembershipMap().keySet());
- Set<String> resourcesToAdd = new HashSet<String>();
+ Set<String> resourcesToAdd = new HashSet<>();
for (Long diffMembId : diff) {
- long roleId = updatedUserTO.getMembershipMap().get(diffMembId).getRoleId();
- RoleTO roleTO = RoleUtils.findRole(roleTreeBuilder, roleId);
- resourcesToAdd.addAll(roleTO.getResources());
+ long groupId = updatedUserTO.getMembershipMap().get(diffMembId).getGroupId();
+ GroupTO groupTO = groupTreeBuilder.findGroup(groupId);
+ resourcesToAdd.addAll(groupTO.getResources());
StatusUtils.update(
userTO, statusPanel, target, resourcesToAdd, Collections.<String>emptySet());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainAttrsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainAttrsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainAttrsPanel.java
index 8e42318..1cf25ef 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainAttrsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainAttrsPanel.java
@@ -34,9 +34,9 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.commons.AttrLayoutType;
import org.apache.syncope.client.console.commons.JexlHelpUtil;
import org.apache.syncope.client.console.commons.Mode;
-import org.apache.syncope.client.console.panels.AttrTemplatesPanel.RoleAttrTemplatesChange;
+import org.apache.syncope.client.console.panels.AttrTemplatesPanel.GroupAttrTemplatesChange;
import org.apache.syncope.client.console.rest.ConfigurationRestClient;
-import org.apache.syncope.client.console.rest.RoleRestClient;
+import org.apache.syncope.client.console.rest.GroupRestClient;
import org.apache.syncope.client.console.rest.SchemaRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
@@ -54,7 +54,7 @@ import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.ConfTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.AttributableType;
@@ -81,7 +81,7 @@ public class PlainAttrsPanel extends Panel {
private ConfigurationRestClient confRestClient;
@SpringBean
- private RoleRestClient roleRestClient;
+ private GroupRestClient groupRestClient;
private final AbstractAttributableTO entityTO;
@@ -147,18 +147,18 @@ public class PlainAttrsPanel extends Panel {
AttrTO attrLayout = null;
List<PlainSchemaTO> schemaTOs;
- if (entityTO instanceof RoleTO) {
- final RoleTO roleTO = (RoleTO) entityTO;
+ if (entityTO instanceof GroupTO) {
+ final GroupTO groupTO = (GroupTO) entityTO;
- attrLayout = confRestClient.readAttrLayout(AttrLayoutType.valueOf(mode, AttributableType.ROLE));
- schemaTOs = schemaRestClient.getSchemas(AttributableType.ROLE);
+ attrLayout = confRestClient.readAttrLayout(AttrLayoutType.valueOf(mode, AttributableType.GROUP));
+ schemaTOs = schemaRestClient.getSchemas(AttributableType.GROUP);
Set<String> allowed;
if (attrTemplates == null) {
- allowed = new HashSet<>(roleTO.getRPlainAttrTemplates());
+ allowed = new HashSet<>(groupTO.getGPlainAttrTemplates());
} else {
- allowed = new HashSet<>(attrTemplates.getSelected(AttrTemplatesPanel.Type.rPlainAttrTemplates));
- if (roleTO.isInheritTemplates() && roleTO.getParent() != 0) {
- allowed.addAll(roleRestClient.read(roleTO.getParent()).getRPlainAttrTemplates());
+ allowed = new HashSet<>(attrTemplates.getSelected(AttrTemplatesPanel.Type.gPlainAttrTemplates));
+ if (groupTO.isInheritTemplates() && groupTO.getParent() != 0) {
+ allowed.addAll(groupRestClient.read(groupTO.getParent()).getGPlainAttrTemplates());
}
}
schemaRestClient.filter(schemaTOs, allowed, true);
@@ -169,7 +169,7 @@ public class PlainAttrsPanel extends Panel {
attrLayout = confRestClient.readAttrLayout(AttrLayoutType.valueOf(mode, AttributableType.MEMBERSHIP));
schemaTOs = schemaRestClient.getSchemas(AttributableType.MEMBERSHIP);
Set<String> allowed = new HashSet<>(
- roleRestClient.read(((MembershipTO) entityTO).getRoleId()).getMPlainAttrTemplates());
+ groupRestClient.read(((MembershipTO) entityTO).getGroupId()).getMPlainAttrTemplates());
schemaRestClient.filter(schemaTOs, allowed, true);
} else {
schemas = new TreeMap<>();
@@ -383,9 +383,9 @@ public class PlainAttrsPanel extends Panel {
@Override
public void onEvent(final IEvent<?> event) {
- if ((event.getPayload() instanceof RoleAttrTemplatesChange)) {
- final RoleAttrTemplatesChange update = (RoleAttrTemplatesChange) event.getPayload();
- if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.rPlainAttrTemplates) {
+ if ((event.getPayload() instanceof GroupAttrTemplatesChange)) {
+ final GroupAttrTemplatesChange update = (GroupAttrTemplatesChange) event.getPayload();
+ if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.gPlainAttrTemplates) {
setSchemas();
setAttrs();
update.getTarget().add(this);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/PolicyBeanPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/PolicyBeanPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/PolicyBeanPanel.java
index 67d6684..a55be9f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/PolicyBeanPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/PolicyBeanPanel.java
@@ -21,6 +21,7 @@ package org.apache.syncope.client.console.panels;
import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -58,6 +59,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.util.ClassUtils;
+import org.springframework.util.ReflectionUtils;
+import org.springframework.util.ReflectionUtils.FieldCallback;
+import org.springframework.util.ReflectionUtils.FieldFilter;
public class PolicyBeanPanel extends Panel {
@@ -84,13 +88,13 @@ public class PolicyBeanPanel extends Panel {
}
};
- final IModel<List<String>> roleSchemas = new LoadableDetachableModel<List<String>>() {
+ final IModel<List<String>> groupSchemas = new LoadableDetachableModel<List<String>>() {
private static final long serialVersionUID = 5275935387613157437L;
@Override
protected List<String> load() {
- return schemaRestClient.getPlainSchemaNames(AttributableType.ROLE);
+ return schemaRestClient.getPlainSchemaNames(AttributableType.GROUP);
}
};
@@ -108,9 +112,10 @@ public class PolicyBeanPanel extends Panel {
super(id);
final List<FieldWrapper> items = new ArrayList<>();
+ ReflectionUtils.doWithFields(policy.getClass(), new FieldCallback() {
- for (Field field : policy.getClass().getDeclaredFields()) {
- if (!"serialVersionUID".equals(field.getName())) {
+ @Override
+ public void doWith(final Field field) throws IllegalArgumentException, IllegalAccessException {
FieldWrapper fieldWrapper = new FieldWrapper();
fieldWrapper.setName(field.getName());
fieldWrapper.setType(field.getType());
@@ -123,7 +128,14 @@ public class PolicyBeanPanel extends Panel {
items.add(fieldWrapper);
}
- }
+ },
+ new FieldFilter() {
+
+ @Override
+ public boolean matches(final Field field) {
+ return !Modifier.isStatic(field.getModifiers()) && !"serialVersionUID".equals(field.getName());
+ }
+ });
final ListView<FieldWrapper> policies = new AltListView<FieldWrapper>("policies", items) {
@@ -185,7 +197,7 @@ public class PolicyBeanPanel extends Panel {
if (field.getSchemaList() != null) {
final List<String> values = new ArrayList<>();
if (field.getName().charAt(0) == 'r') {
- values.addAll(roleSchemas.getObject());
+ values.addAll(groupSchemas.getObject());
if (field.getSchemaList().extended()) {
values.add("name");
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
index ecd7e0c..3940421 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
@@ -120,7 +120,7 @@ public class ResourceMappingPanel extends Panel {
private final ResourceTO resourceTO;
/**
- * User / role.
+ * User / group.
*/
private final AttributableType attrType;
@@ -145,11 +145,11 @@ public class ResourceMappingPanel extends Panel {
}
result = this.resourceTO.getUmapping();
}
- if (AttributableType.ROLE == this.attrType) {
- if (this.resourceTO.getRmapping() == null) {
- this.resourceTO.setRmapping(new MappingTO());
+ if (AttributableType.GROUP == this.attrType) {
+ if (this.resourceTO.getGmapping() == null) {
+ this.resourceTO.setGmapping(new MappingTO());
}
- result = this.resourceTO.getRmapping();
+ result = this.resourceTO.getGmapping();
}
return result;
@@ -160,7 +160,7 @@ public class ResourceMappingPanel extends Panel {
*
* @param id panel id
* @param resourceTO external resource
- * @param attrType USER / ROLE
+ * @param attrType USER / GROUP
*/
public ResourceMappingPanel(final String id, final ResourceTO resourceTO, final AttributableType attrType) {
super(id);
@@ -324,8 +324,8 @@ public class ResourceMappingPanel extends Panel {
new AjaxDropDownChoicePanel<AttributableType>("entities",
new ResourceModel("entities", "entities").getObject(), new Model<AttributableType>(
entity));
- entitiesPanel.setChoices(attrType == AttributableType.ROLE
- ? Collections.<AttributableType>singletonList(AttributableType.ROLE)
+ entitiesPanel.setChoices(attrType == AttributableType.GROUP
+ ? Collections.<AttributableType>singletonList(AttributableType.GROUP)
: Arrays.asList(AttributableType.values()));
entitiesPanel.setStyleSheet(DEF_FIELD_STYLE);
entitiesPanel.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
@@ -512,7 +512,7 @@ public class ResourceMappingPanel extends Panel {
boolean enabled = objectClasses.isEmpty()
|| (AttributableType.USER == attrType && objectClasses.contains(ConnIdObjectClassTO.ACCOUNT))
- || (AttributableType.ROLE == attrType && objectClasses.contains(ConnIdObjectClassTO.GROUP));
+ || (AttributableType.GROUP == attrType && objectClasses.contains(ConnIdObjectClassTO.GROUP));
this.mappingContainer.setEnabled(enabled);
this.mappingContainer.setVisible(enabled);
this.accountLinkContainer.setEnabled(enabled);
@@ -563,19 +563,19 @@ public class ResourceMappingPanel extends Panel {
switch (type) {
// user attribute names
case UserPlainSchema:
- case RolePlainSchema:
+ case GroupPlainSchema:
case MembershipPlainSchema:
toBeUpdated.setChoices(schemaRestClient.getPlainSchemaNames(type.getAttributableType()));
break;
case UserDerivedSchema:
- case RoleDerivedSchema:
+ case GroupDerivedSchema:
case MembershipDerivedSchema:
toBeUpdated.setChoices(schemaRestClient.getDerSchemaNames(type.getAttributableType()));
break;
case UserVirtualSchema:
- case RoleVirtualSchema:
+ case GroupVirtualSchema:
case MembershipVirtualSchema:
toBeUpdated.setChoices(schemaRestClient.getVirSchemaNames(type.getAttributableType()));
break;
@@ -583,8 +583,8 @@ public class ResourceMappingPanel extends Panel {
case UserId:
case Password:
case Username:
- case RoleId:
- case RoleName:
+ case GroupId:
+ case GroupName:
default:
toBeUpdated.setRequired(false);
toBeUpdated.setEnabled(false);
@@ -606,7 +606,7 @@ public class ResourceMappingPanel extends Panel {
if (type != null && type.getAttributableType() != null) {
switch (type) {
case UserVirtualSchema:
- case RoleVirtualSchema:
+ case GroupVirtualSchema:
case MembershipVirtualSchema:
// Virtual accountId is not permitted
case Password:
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourcesPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourcesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourcesPanel.java
index 67e2281..6dd1d06 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourcesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourcesPanel.java
@@ -25,8 +25,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.RoleTreeBuilder;
-import org.apache.syncope.client.console.commons.RoleUtils;
+import org.apache.syncope.client.console.commons.GroupTreeBuilder;
import org.apache.syncope.client.console.commons.SelectChoiceRenderer;
import org.apache.syncope.client.console.commons.status.StatusUtils;
import org.apache.syncope.client.console.rest.ResourceRestClient;
@@ -35,7 +34,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.NonI18nPalette;
import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
@@ -56,7 +55,7 @@ public class ResourcesPanel extends Panel {
private ResourceRestClient resourceRestClient;
@SpringBean
- private RoleTreeBuilder roleTreeBuilder;
+ private GroupTreeBuilder groupTreeBuilder;
private final AbstractSubjectTO subjectTO;
@@ -109,7 +108,7 @@ public class ResourcesPanel extends Panel {
resourcesPalette = new AjaxRecordingPalettePanel<>("resourcesPalette",
new PropertyModel<List<String>>(subjectTO, "resources"),
new ListModel<>(allResources), builder.statusPanel);
- } else if (subjectTO instanceof RoleTO) {
+ } else if (subjectTO instanceof GroupTO) {
resourcesPalette = new AjaxPalettePanel<>("resourcesPalette",
new PropertyModel<List<String>>(subjectTO, "resources"), new ListModel<>(allResources));
}
@@ -149,14 +148,14 @@ public class ResourcesPanel extends Panel {
if (subjectTO instanceof UserTO) {
UserTO userTO = (UserTO) subjectTO;
- Set<String> resourcesToRemove = new HashSet<String>(previousResources);
+ Set<String> resourcesToRemove = new HashSet<>(previousResources);
resourcesToRemove.removeAll(userTO.getResources());
if (!resourcesToRemove.isEmpty()) {
- Set<String> resourcesAssignedViaMembership = new HashSet<String>();
+ Set<String> resourcesAssignedViaMembership = new HashSet<>();
for (MembershipTO membTO : userTO.getMemberships()) {
- RoleTO roleTO = RoleUtils.findRole(roleTreeBuilder, membTO.getRoleId());
- if (roleTO != null) {
- resourcesAssignedViaMembership.addAll(roleTO.getResources());
+ GroupTO groupTO = groupTreeBuilder.findGroup(membTO.getGroupId());
+ if (groupTO != null) {
+ resourcesAssignedViaMembership.addAll(groupTO.getResources());
}
}
resourcesToRemove.removeAll(resourcesAssignedViaMembership);
[52/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
index ea1d197..76595d3 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
@@ -36,6 +36,7 @@ import javax.ws.rs.core.Response;
import org.apache.cxf.jaxrs.model.wadl.Description;
import org.apache.cxf.jaxrs.model.wadl.Descriptions;
import org.apache.cxf.jaxrs.model.wadl.DocTarget;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.mod.ResourceAssociationMod;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
@@ -95,25 +96,31 @@ public interface UserService extends JAXRSService {
/**
* Returns a paged list of existing users.
*
+ * @param realms realms under which users are defined
* @return paged list of all existing users
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<UserTO> list();
+ PagedResult<UserTO> list(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms);
/**
* Returns a paged list of existing users.
*
+ * @param realms realms under which users are defined
* @param orderBy list of ordering clauses, separated by comma
* @return paged list of all existing users
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<UserTO> list(@QueryParam(PARAM_ORDERBY) String orderBy);
+ PagedResult<UserTO> list(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
+ @QueryParam(PARAM_ORDERBY) String orderBy);
/**
* Returns a paged list of existing users matching page/size conditions.
*
+ * @param realms realms under which users are defined
* @param page result page number
* @param size number of entries per page
* @return paged list of existing users matching page/size conditions
@@ -121,12 +128,14 @@ public interface UserService extends JAXRSService {
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
PagedResult<UserTO> list(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
@NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
@NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
/**
* Returns a paged list of existing users matching page/size conditions.
*
+ * @param realms realms under which users are defined
* @param page result page number
* @param size number of entries per page
* @param orderBy list of ordering clauses, separated by comma
@@ -135,6 +144,7 @@ public interface UserService extends JAXRSService {
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
PagedResult<UserTO> list(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
@NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
@NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
@QueryParam(PARAM_ORDERBY) String orderBy);
@@ -142,17 +152,21 @@ public interface UserService extends JAXRSService {
/**
* Returns a paged list of users matching the provided FIQL search condition.
*
+ * @param realms realms under which users are defined
* @param fiql FIQL search expression
* @return paged list of users matching the provided FIQL search condition
*/
@GET
@Path("search")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<UserTO> search(@NotNull @QueryParam(PARAM_FIQL) String fiql);
+ PagedResult<UserTO> search(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
+ @NotNull @QueryParam(PARAM_FIQL) String fiql);
/**
* Returns a paged list of users matching the provided FIQL search condition.
*
+ * @param realms realms under which users are defined
* @param fiql FIQL search expression
* @param orderBy list of ordering clauses, separated by comma
* @return paged list of users matching the provided FIQL search condition
@@ -160,11 +174,15 @@ public interface UserService extends JAXRSService {
@GET
@Path("search")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<UserTO> search(@NotNull @QueryParam(PARAM_FIQL) String fiql, @QueryParam(PARAM_ORDERBY) String orderBy);
+ PagedResult<UserTO> search(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
+ @NotNull @QueryParam(PARAM_FIQL) String fiql,
+ @QueryParam(PARAM_ORDERBY) String orderBy);
/**
* Returns a paged list of users matching the provided FIQL search condition.
*
+ * @param realms realms under which users are defined
* @param fiql FIQL search expression
* @param page result page number
* @param size number of entries per page
@@ -173,13 +191,16 @@ public interface UserService extends JAXRSService {
@GET
@Path("search")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<UserTO> search(@QueryParam(PARAM_FIQL) String fiql,
+ PagedResult<UserTO> search(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
+ @QueryParam(PARAM_FIQL) String fiql,
@NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
@NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
/**
* Returns a paged list of users matching the provided FIQL search condition.
*
+ * @param realms realms under which users are defined
* @param fiql FIQL search expression
* @param page result page number
* @param size number of entries per page
@@ -189,7 +210,9 @@ public interface UserService extends JAXRSService {
@GET
@Path("search")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- PagedResult<UserTO> search(@QueryParam(PARAM_FIQL) String fiql,
+ PagedResult<UserTO> search(
+ @DefaultValue(SyncopeConstants.ROOT_REALM) @QueryParam("realm") List<String> realms,
+ @QueryParam(PARAM_FIQL) String fiql,
@NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
@NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
@QueryParam(PARAM_ORDERBY) String orderBy);
@@ -210,7 +233,8 @@ public interface UserService extends JAXRSService {
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- Response create(@NotNull UserTO userTO,
+ Response create(
+ @NotNull UserTO userTO,
@DefaultValue("true") @QueryParam("storePassword") boolean storePassword);
/**
@@ -284,7 +308,8 @@ public interface UserService extends JAXRSService {
@Path("{userKey}/bulkDeassociation/{type}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- Response bulkDeassociation(@NotNull @PathParam("userKey") Long userKey,
+ Response bulkDeassociation(
+ @NotNull @PathParam("userKey") Long userKey,
@NotNull @PathParam("type") ResourceDeassociationActionType type,
@NotNull List<ResourceName> resourceNames);
@@ -303,7 +328,8 @@ public interface UserService extends JAXRSService {
@Path("{userKey}/bulkAssociation/{type}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- Response bulkAssociation(@NotNull @PathParam("userKey") Long userKey,
+ Response bulkAssociation(
+ @NotNull @PathParam("userKey") Long userKey,
@NotNull @PathParam("type") ResourceAssociationActionType type,
@NotNull ResourceAssociationMod associationMod);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractSubjectLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractSubjectLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractSubjectLogic.java
index a1a94b4..7bd099b 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractSubjectLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractSubjectLogic.java
@@ -18,26 +18,53 @@
*/
package org.apache.syncope.core.logic;
+import java.util.Collection;
import java.util.List;
+import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.mod.AbstractSubjectMod;
import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.core.misc.RealmUtils;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
public abstract class AbstractSubjectLogic<T extends AbstractSubjectTO, V extends AbstractSubjectMod>
extends AbstractResourceAssociator<T> {
+ protected Set<String> getEffectiveRealms(
+ final Set<String> allowedRealms, final Collection<String> requestedRealms) {
+
+ Set<String> effective = RealmUtils.normalize(requestedRealms);
+ CollectionUtils.filter(effective, new Predicate<String>() {
+
+ @Override
+ public boolean evaluate(final String requestedRealm) {
+ return CollectionUtils.exists(allowedRealms, new Predicate<String>() {
+
+ @Override
+ public boolean evaluate(final String allowedRealm) {
+ return requestedRealm.startsWith(allowedRealm);
+ }
+ });
+ }
+ });
+
+ return effective;
+ }
+
public abstract T read(Long key);
- public abstract int count();
+ public abstract int count(List<String> realms);
public abstract T update(V attributableMod);
public abstract T delete(Long key);
- public abstract List<T> list(int page, int size, List<OrderByClause> orderBy);
+ public abstract List<T> list(int page, int size, List<OrderByClause> orderBy, List<String> realms);
- public abstract List<T> search(SearchCond searchCondition, int page, int size, List<OrderByClause> orderBy);
+ public abstract List<T> search(
+ SearchCond searchCondition, int page, int size, List<OrderByClause> orderBy, List<String> realms);
- public abstract int searchCount(SearchCond searchCondition);
+ public abstract int searchCount(SearchCond searchCondition, List<String> realms);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
index 4068d63..23c60cc 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
@@ -30,8 +30,6 @@ import org.apache.commons.collections4.Transformer;
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.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnBundleTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
@@ -204,28 +202,25 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
@PreAuthorize("hasRole('CONNECTOR_READ')")
@Transactional(readOnly = true)
public List<String> getSchemaNames(final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
- final ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getKey());
+ ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getKey());
if (connInstance == null) {
throw new NotFoundException("Connector '" + connInstanceTO.getKey() + "'");
}
// consider the possibility to receive overridden properties only
- final Set<ConnConfProperty> conf = binder.mergeConnConfProperties(connInstanceTO.getConfiguration(),
- connInstance.getConfiguration());
+ Set<ConnConfProperty> conf =
+ binder.mergeConnConfProperties(connInstanceTO.getConfiguration(), connInstance.getConfiguration());
// We cannot use Spring bean because this method could be used during resource definition or modification:
// bean couldn't exist or couldn't be updated.
// This is the reason why we should take a "not mature" connector facade proxy to ask for schema names.
- final List<String> result = new ArrayList<>(connFactory.createConnector(connInstance, conf).
- getSchemaNames(includeSpecial));
-
- return result;
+ return new ArrayList<>(connFactory.createConnector(connInstance, conf).getSchemaNames(includeSpecial));
}
@PreAuthorize("hasRole('CONNECTOR_READ')")
@Transactional(readOnly = true)
public List<String> getSupportedObjectClasses(final ConnInstanceTO connInstanceTO) {
- final ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getKey());
+ ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getKey());
if (connInstance == null) {
throw new NotFoundException("Connector '" + connInstanceTO.getKey() + "'");
}
@@ -251,7 +246,7 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
@Transactional(readOnly = true)
public List<ConnConfProperty> getConfigurationProperties(final Long connInstanceId) {
- final ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
+ ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
if (connInstance == null) {
throw new NotFoundException("Connector '" + connInstanceId + "'");
}
@@ -294,27 +289,6 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
connFactory.load();
}
- @PreAuthorize("hasRole('CONNECTOR_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE")
- public BulkActionResult bulk(final BulkAction bulkAction) {
- BulkActionResult res = new BulkActionResult();
-
- if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
- for (String id : bulkAction.getTargets()) {
- try {
- res.add(delete(Long.valueOf(id)).getKey(), BulkActionResult.Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing delete for connector {}", id, e);
- res.add(id, BulkActionResult.Status.FAILURE);
- }
- }
- }
-
- return res;
- }
-
- /**
- * {@inheritDoc}
- */
@Override
protected ConnInstanceTO resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java
deleted file mode 100644
index a5dc6a0..0000000
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java
+++ /dev/null
@@ -1,60 +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.ArrayList;
-import java.util.List;
-import java.util.Set;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
-import org.apache.syncope.common.lib.wrap.EntitlementTO;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class EntitlementLogic extends AbstractTransactionalLogic<EntitlementTO> {
-
- @Autowired
- private EntitlementDAO entitlementDAO;
-
- public List<String> getAll() {
- return CollectionUtils.collect(entitlementDAO.findAll(), new Transformer<Entitlement, String>() {
-
- @Override
- public String transform(final Entitlement entitlement) {
- return entitlement.getKey();
- }
- }, new ArrayList<String>());
- }
-
- public Set<String> getOwn() {
- return AuthContextUtil.getOwnedEntitlementNames();
- }
-
- @Override
- protected EntitlementTO resolveReference(final Method method, final Object... args)
- throws UnresolvedReferenceException {
-
- throw new UnresolvedReferenceException();
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
index 6e4604b..bbbca1b 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
@@ -27,34 +27,31 @@ import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Predicate;
import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.mod.GroupMod;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.common.lib.CollectionUtils2;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.common.lib.types.Entitlement;
+import org.apache.syncope.core.misc.RealmUtils;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
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.provisioning.api.AttributableTransformer;
import org.apache.syncope.core.provisioning.api.GroupProvisioningManager;
import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
+import org.apache.syncope.core.misc.security.AuthContextUtils;
+import org.apache.syncope.core.misc.security.UnauthorizedException;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
@@ -95,127 +92,69 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
@Autowired
protected GroupProvisioningManager provisioningManager;
- @PreAuthorize("hasAnyRole('GROUP_READ', T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT)")
+ @PreAuthorize("hasRole('GROUP_READ')")
@Transactional(readOnly = true)
@Override
public GroupTO read(final Long groupKey) {
- Group group;
- // bypass group entitlements check
- if (anonymousUser.equals(AuthContextUtil.getAuthenticatedUsername())) {
- group = groupDAO.find(groupKey);
- } else {
- group = groupDAO.authFetch(groupKey);
- }
-
- if (group == null) {
- throw new NotFoundException("Group " + groupKey);
- }
-
- return binder.getGroupTO(group);
+ return binder.getGroupTO(groupKey);
}
- @PreAuthorize("isAuthenticated() "
- + "and not(hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT))")
+ @PreAuthorize("isAuthenticated() and not(hasRole('ANONYMOUS'))")
@Transactional(readOnly = true)
- public GroupTO readSelf(final Long groupKey) {
- // Explicit search instead of using binder.getGroupFromId() in order to bypass auth checks - will do here
- Group group = groupDAO.find(groupKey);
- if (group == null) {
- throw new NotFoundException("Group " + groupKey);
- }
-
- Set<Long> ownedGroupIds;
- User authUser = userDAO.find(AuthContextUtil.getAuthenticatedUsername());
- if (authUser == null) {
- ownedGroupIds = Collections.<Long>emptySet();
- } else {
- ownedGroupIds = authUser.getGroupKeys();
- }
-
- Set<Long> allowedGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
- allowedGroupIds.addAll(ownedGroupIds);
- if (!allowedGroupIds.contains(group.getKey())) {
- throw new UnauthorizedGroupException(group.getKey());
- }
-
- return binder.getGroupTO(group);
- }
-
- @PreAuthorize("hasRole('GROUP_READ')")
- @Transactional(readOnly = true)
- public GroupTO parent(final Long groupKey) {
- Group group = groupDAO.authFetch(groupKey);
-
- Set<Long> allowedGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
- if (group.getParent() != null && !allowedGroupIds.contains(group.getParent().getKey())) {
- throw new UnauthorizedGroupException(group.getParent().getKey());
- }
-
- GroupTO result = group.getParent() == null
- ? null
- : binder.getGroupTO(group.getParent());
-
- return result;
- }
-
- @PreAuthorize("hasRole('GROUP_READ')")
- @Transactional(readOnly = true)
- public List<GroupTO> children(final Long groupKey) {
- Group group = groupDAO.authFetch(groupKey);
- final Set<Long> allowedGroupKeys =
- GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
-
- return CollectionUtils2.collect(groupDAO.findChildren(group), new Transformer<Group, GroupTO>() {
-
- @Override
- public GroupTO transform(final Group group) {
- return binder.getGroupTO(group);
- }
- }, new Predicate<Group>() {
-
- @Override
- public boolean evaluate(final Group group) {
- return allowedGroupKeys.contains(group.getKey());
- }
- }, new ArrayList<GroupTO>());
+ public List<GroupTO> own() {
+ return CollectionUtils.collect(
+ userDAO.find(AuthContextUtils.getAuthenticatedUsername()).getGroups(),
+ new Transformer<Group, GroupTO>() {
+
+ @Override
+ public GroupTO transform(final Group input) {
+ return binder.getGroupTO(input);
+ }
+ }, new ArrayList<GroupTO>());
}
@PreAuthorize("isAuthenticated()")
@Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
- public int count() {
- return groupDAO.count();
+ public int count(final List<String> realms) {
+ return groupDAO.count(getEffectiveRealms(SyncopeConstants.FULL_ADMIN_REALMS, realms));
}
@PreAuthorize("isAuthenticated()")
@Transactional(readOnly = true)
@Override
- public List<GroupTO> list(final int page, final int size, final List<OrderByClause> orderBy) {
- return CollectionUtils.collect(groupDAO.findAll(page, size, orderBy), new Transformer<Group, GroupTO>() {
-
- @Override
- public GroupTO transform(final Group input) {
- return binder.getGroupTO(input);
- }
- }, new ArrayList<GroupTO>());
+ public List<GroupTO> list(
+ final int page, final int size, final List<OrderByClause> orderBy, final List<String> realms) {
+
+ return CollectionUtils.collect(groupDAO.findAll(
+ getEffectiveRealms(SyncopeConstants.FULL_ADMIN_REALMS, realms),
+ page, size, orderBy),
+ new Transformer<Group, GroupTO>() {
+
+ @Override
+ public GroupTO transform(final Group input) {
+ return binder.getGroupTO(input);
+ }
+ }, new ArrayList<GroupTO>());
}
- @PreAuthorize("isAuthenticated()")
+ @PreAuthorize("hasRole('GROUP_SEARCH')")
@Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
- public int searchCount(final SearchCond searchCondition) {
- final Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
- return searchDAO.count(adminGroupIds, searchCondition, SubjectType.GROUP);
+ public int searchCount(final SearchCond searchCondition, final List<String> realms) {
+ return searchDAO.count(
+ getEffectiveRealms(AuthContextUtils.getAuthorizations().get(Entitlement.GROUP_SEARCH), realms),
+ searchCondition, SubjectType.GROUP);
}
- @PreAuthorize("isAuthenticated()")
+ @PreAuthorize("hasRole('GROUP_SEARCH')")
@Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
public List<GroupTO> search(final SearchCond searchCondition, final int page, final int size,
- final List<OrderByClause> orderBy) {
+ final List<OrderByClause> orderBy, final List<String> realms) {
- List<Group> matchingGroups = searchDAO.search(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.
- getOwnedEntitlementNames()),
+ final List<Group> matchingGroups = searchDAO.search(
+ getEffectiveRealms(AuthContextUtils.getAuthorizations().get(Entitlement.GROUP_SEARCH), realms),
searchCondition, page, size, orderBy, SubjectType.GROUP);
return CollectionUtils.collect(matchingGroups, new Transformer<Group, GroupTO>() {
@@ -228,10 +167,15 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
@PreAuthorize("hasRole('GROUP_CREATE')")
public GroupTO create(final GroupTO groupTO) {
- // Check that this operation is allowed to be performed by caller
- Set<Long> allowedGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
- if (groupTO.getParent() != 0 && !allowedGroupIds.contains(groupTO.getParent())) {
- throw new UnauthorizedGroupException(groupTO.getParent());
+ if (groupTO.getRealm() == null) {
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
+ throw sce;
+ }
+ Set<String> effectiveRealms = getEffectiveRealms(
+ AuthContextUtils.getAuthorizations().get(Entitlement.GROUP_CREATE),
+ Collections.singleton(groupTO.getRealm()));
+ if (effectiveRealms.isEmpty()) {
+ throw new UnauthorizedException(SubjectType.GROUP, null);
}
// Attributable transformation (if configured)
@@ -242,7 +186,7 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
* Actual operations: workflow, propagation
*/
Map.Entry<Long, List<PropagationStatus>> created = provisioningManager.create(groupTO);
- final GroupTO savedTO = binder.getGroupTO(created.getKey());
+ GroupTO savedTO = binder.getGroupTO(created.getKey());
savedTO.getPropagationStatusTOs().addAll(created.getValue());
return savedTO;
}
@@ -250,8 +194,16 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
@PreAuthorize("hasRole('GROUP_UPDATE')")
@Override
public GroupTO update(final GroupMod groupMod) {
- // Check that this operation is allowed to be performed by caller
- groupDAO.authFetch(groupMod.getKey());
+ Group group = groupDAO.authFetch(groupMod.getKey());
+ if (group == null) {
+ throw new NotFoundException("Group with key " + groupMod.getKey());
+ }
+ Set<String> effectiveRealms = getEffectiveRealms(
+ AuthContextUtils.getAuthorizations().get(Entitlement.GROUP_UPDATE),
+ Collections.singleton(RealmUtils.getGroupOwnerRealm(group.getRealm().getFullPath(), group.getKey())));
+ if (effectiveRealms.isEmpty()) {
+ throw new UnauthorizedException(SubjectType.GROUP, group.getKey());
+ }
// Attribute value transformation (if configured)
GroupMod actual = attrTransformer.transform(groupMod);
@@ -259,7 +211,7 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
Map.Entry<Long, List<PropagationStatus>> updated = provisioningManager.update(groupMod);
- final GroupTO updatedTO = binder.getGroupTO(updated.getKey());
+ GroupTO updatedTO = binder.getGroupTO(updated.getKey());
updatedTO.getPropagationStatusTOs().addAll(updated.getValue());
return updatedTO;
}
@@ -267,6 +219,17 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
@PreAuthorize("hasRole('GROUP_DELETE')")
@Override
public GroupTO delete(final Long groupKey) {
+ Group group = groupDAO.authFetch(groupKey);
+ if (group == null) {
+ throw new NotFoundException("Group with key " + groupKey);
+ }
+ Set<String> effectiveRealms = getEffectiveRealms(
+ AuthContextUtils.getAuthorizations().get(Entitlement.GROUP_DELETE),
+ Collections.singleton(RealmUtils.getGroupOwnerRealm(group.getRealm().getFullPath(), group.getKey())));
+ if (effectiveRealms.isEmpty()) {
+ throw new UnauthorizedException(SubjectType.GROUP, group.getKey());
+ }
+
List<Group> ownedGroups = groupDAO.findOwnedByGroup(groupKey);
if (!ownedGroups.isEmpty()) {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.GroupOwnership);
@@ -290,26 +253,6 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
return groupTO;
}
- @PreAuthorize("(hasRole('GROUP_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE)")
- public BulkActionResult bulk(final BulkAction bulkAction) {
- BulkActionResult res = new BulkActionResult();
-
- if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
- for (String groupKey : bulkAction.getTargets()) {
- try {
- res.add(delete(Long.valueOf(groupKey)).getKey(), BulkActionResult.Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing delete for group {}", groupKey, e);
- res.add(groupKey, BulkActionResult.Status.FAILURE);
- }
- }
- } else {
- LOG.warn("Unsupported bulk action: {}", bulkAction.getOperation());
- }
-
- return res;
- }
-
@PreAuthorize("hasRole('GROUP_UPDATE')")
@Transactional(rollbackFor = { Throwable.class })
@Override
@@ -362,7 +305,7 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
List<PropagationStatus> statuses = provisioningManager.deprovision(groupKey, resources);
- final GroupTO updatedTO = binder.getGroupTO(group);
+ GroupTO updatedTO = binder.getGroupTO(group);
updatedTO.getPropagationStatusTOs().addAll(statuses);
return updatedTO;
}
@@ -372,7 +315,7 @@ public class GroupLogic extends AbstractSubjectLogic<GroupTO, GroupMod> {
@Override
public GroupTO provision(
final Long groupKey, final Collection<String> resources, final boolean changePwd, final String password) {
- final GroupTO original = binder.getGroupTO(groupKey);
+ GroupTO original = binder.getGroupTO(groupKey);
//trick: assign and retrieve propagation statuses ...
original.getPropagationStatusTOs().addAll(
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
index 09a5d6b..a315bb4 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
@@ -222,29 +222,26 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
@PreAuthorize("hasRole('AUDIT_LIST') or hasRole('NOTIFICATION_LIST')")
public List<EventCategoryTO> listAuditEvents() {
- // use set to avoi duplications or null elements
- final Set<EventCategoryTO> events = new HashSet<>();
+ // use set to avoid duplications or null elements
+ Set<EventCategoryTO> events = new HashSet<>();
try {
- final ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
- final MetadataReaderFactory metadataReaderFactory =
- new CachingMetadataReaderFactory(resourcePatternResolver);
+ ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
+ MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resourcePatternResolver);
- final String packageSearchPath =
- ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ ClassUtils.convertClassNameToResourcePath(
SystemPropertyUtils.resolvePlaceholders(this.getClass().getPackage().getName()))
- + "/" + "**/*.class";
+ + "/**/*.class";
- final Resource[] resources = resourcePatternResolver.getResources(packageSearchPath);
+ Resource[] resources = resourcePatternResolver.getResources(packageSearchPath);
for (Resource resource : resources) {
if (resource.isReadable()) {
final MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(resource);
final Class<?> clazz = Class.forName(metadataReader.getClassMetadata().getClassName());
- if (clazz.isAnnotationPresent(Component.class)
- && AbstractLogic.class.isAssignableFrom(clazz)) {
- final EventCategoryTO eventCategoryTO = new EventCategoryTO();
+ if (clazz.isAnnotationPresent(Component.class) && AbstractLogic.class.isAssignableFrom(clazz)) {
+ EventCategoryTO eventCategoryTO = new EventCategoryTO();
eventCategoryTO.setCategory(clazz.getSimpleName());
for (Method method : clazz.getDeclaredMethods()) {
if (Modifier.isPublic(method.getModifiers())) {
@@ -257,7 +254,7 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
}
//SYNCOPE-608
- final EventCategoryTO authenticationControllerEvents = new EventCategoryTO();
+ EventCategoryTO authenticationControllerEvents = new EventCategoryTO();
authenticationControllerEvents.setCategory("AuthenticationController");
authenticationControllerEvents.getEvents().add("login");
events.add(authenticationControllerEvents);
@@ -268,9 +265,9 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
for (AttributableType attributableType : AttributableType.values()) {
for (ExternalResource resource : resourceDAO.findAll()) {
- final EventCategoryTO propEventCategoryTO = new EventCategoryTO(EventCategoryType.PROPAGATION);
- final EventCategoryTO syncEventCategoryTO = new EventCategoryTO(EventCategoryType.SYNCHRONIZATION);
- final EventCategoryTO pushEventCategoryTO = new EventCategoryTO(EventCategoryType.PUSH);
+ EventCategoryTO propEventCategoryTO = new EventCategoryTO(EventCategoryType.PROPAGATION);
+ EventCategoryTO syncEventCategoryTO = new EventCategoryTO(EventCategoryType.SYNCHRONIZATION);
+ EventCategoryTO pushEventCategoryTO = new EventCategoryTO(EventCategoryType.PUSH);
propEventCategoryTO.setCategory(attributableType.name().toLowerCase());
propEventCategoryTO.setSubcategory(resource.getKey());
@@ -305,13 +302,13 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
}
for (SchedTask task : taskDAO.<SchedTask>findAll(TaskType.SCHEDULED)) {
- final EventCategoryTO eventCategoryTO = new EventCategoryTO(EventCategoryType.TASK);
+ EventCategoryTO eventCategoryTO = new EventCategoryTO(EventCategoryType.TASK);
eventCategoryTO.setCategory(Class.forName(task.getJobClassName()).getSimpleName());
events.add(eventCategoryTO);
}
for (SyncTask task : taskDAO.<SyncTask>findAll(TaskType.SYNCHRONIZATION)) {
- final EventCategoryTO eventCategoryTO = new EventCategoryTO(EventCategoryType.TASK);
+ EventCategoryTO eventCategoryTO = new EventCategoryTO(EventCategoryType.TASK);
eventCategoryTO.setCategory(Class.forName(task.getJobClassName()).getSimpleName());
events.add(eventCategoryTO);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
index 015c2a3..92be74b 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
@@ -102,36 +102,6 @@ public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
}
@PreAuthorize("hasRole('POLICY_READ')")
- public PasswordPolicyTO getGlobalPasswordPolicy() {
- PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
- if (policy == null) {
- throw new NotFoundException("No password policy found");
- }
-
- return (PasswordPolicyTO) binder.getPolicyTO(policy);
- }
-
- @PreAuthorize("hasRole('POLICY_READ')")
- public AccountPolicyTO getGlobalAccountPolicy() {
- AccountPolicy policy = policyDAO.getGlobalAccountPolicy();
- if (policy == null) {
- throw new NotFoundException("No account policy found");
- }
-
- return (AccountPolicyTO) binder.getPolicyTO(policy);
- }
-
- @PreAuthorize("hasRole('POLICY_READ')")
- public SyncPolicyTO getGlobalSyncPolicy() {
- SyncPolicy policy = policyDAO.getGlobalSyncPolicy();
- if (policy == null) {
- throw new NotFoundException("No sync policy found");
- }
-
- return (SyncPolicyTO) binder.getPolicyTO(policy);
- }
-
- @PreAuthorize("hasRole('POLICY_READ')")
public <T extends AbstractPolicyTO> T read(final Long id) {
Policy policy = policyDAO.find(id);
if (policy == null) {
@@ -154,12 +124,10 @@ public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
return policyToDelete;
}
- /**
- * {@inheritDoc}
- */
@Override
protected AbstractPolicyTO resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
+
Long id = null;
if (ArrayUtils.isNotEmpty(args)) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
index 9a3c641..3148d19 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
@@ -27,8 +27,6 @@ import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
@@ -39,8 +37,8 @@ import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
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.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
@@ -48,8 +46,8 @@ import org.apache.syncope.core.persistence.api.entity.Subject;
import org.apache.syncope.core.provisioning.api.Connector;
import org.apache.syncope.core.provisioning.api.ConnectorFactory;
import org.apache.syncope.core.provisioning.api.data.ResourceDataBinder;
-import org.apache.syncope.core.misc.ConnObjectUtil;
-import org.apache.syncope.core.misc.MappingUtil;
+import org.apache.syncope.core.misc.ConnObjectUtils;
+import org.apache.syncope.core.misc.MappingUtils;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.AttributeUtil;
import org.identityconnectors.framework.common.objects.ConnectorObject;
@@ -77,13 +75,13 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
private ResourceDataBinder binder;
@Autowired
- private ConnObjectUtil connObjectUtil;
+ private ConnObjectUtils connObjectUtils;
@Autowired
private ConnectorFactory connFactory;
@Autowired
- private AttributableUtilFactory attrUtilFactory;
+ private AttributableUtilsFactory attrUtilsFactory;
@PreAuthorize("hasRole('RESOURCE_CREATE')")
public ResourceTO create(final ResourceTO resourceTO) {
@@ -184,21 +182,21 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
throw new NotFoundException(type + " " + id);
}
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(type.asAttributableType());
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(type.asAttributableType());
- MappingItem accountIdItem = attrUtil.getAccountIdItem(resource);
+ MappingItem accountIdItem = attrUtils.getAccountIdItem(resource);
if (accountIdItem == null) {
throw new NotFoundException(
"AccountId mapping for " + type + " " + id + " on resource '" + resourceName + "'");
}
- final String accountIdValue = MappingUtil.getAccountIdValue(
- subject, resource, attrUtil.getAccountIdItem(resource));
+ final String accountIdValue = MappingUtils.getAccountIdValue(
+ subject, resource, attrUtils.getAccountIdItem(resource));
final ObjectClass objectClass = SubjectType.USER == type ? ObjectClass.ACCOUNT : ObjectClass.GROUP;
final Connector connector = connFactory.getConnector(resource);
final ConnectorObject connectorObject = connector.getObject(objectClass, new Uid(accountIdValue),
- connector.getOperationOptions(attrUtil.getMappingItems(resource, MappingPurpose.BOTH)));
+ connector.getOperationOptions(attrUtils.getMappingItems(resource, MappingPurpose.BOTH)));
if (connectorObject == null) {
throw new NotFoundException("Object " + accountIdValue + " with class " + objectClass
+ "not found on resource " + resourceName);
@@ -212,7 +210,7 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
attributes.add(connectorObject.getName());
}
- return connObjectUtil.getConnObjectTO(connectorObject);
+ return connObjectUtils.getConnObjectTO(connectorObject);
}
@PreAuthorize("hasRole('CONNECTOR_READ')")
@@ -234,24 +232,6 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
return result;
}
- @PreAuthorize("hasRole('RESOURCE_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE")
- public BulkActionResult bulk(final BulkAction bulkAction) {
- BulkActionResult res = new BulkActionResult();
-
- if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
- for (String name : bulkAction.getTargets()) {
- try {
- res.add(delete(name).getKey(), BulkActionResult.Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing delete for resource {}", name, e);
- res.add(name, BulkActionResult.Status.FAILURE);
- }
- }
- }
-
- return res;
- }
-
@Override
protected ResourceTO resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
index 8e15c96..1ced7a0 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
@@ -38,8 +38,8 @@ import org.apache.syncope.core.persistence.api.dao.DuplicateException;
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.dao.VirSchemaDAO;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
@@ -64,22 +64,22 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
private SchemaDataBinder binder;
@Autowired
- private AttributableUtilFactory attrUtilFactory;
+ private AttributableUtilsFactory attrUtilsFactory;
- private boolean doesSchemaExist(final SchemaType schemaType, final String name, final AttributableUtil attrUtil) {
+ private boolean doesSchemaExist(final SchemaType schemaType, final String name, final AttributableUtils attrUtils) {
boolean found;
switch (schemaType) {
case VIRTUAL:
- found = virSchemaDAO.find(name, attrUtil.virSchemaClass()) != null;
+ found = virSchemaDAO.find(name, attrUtils.virSchemaClass()) != null;
break;
case DERIVED:
- found = derSchemaDAO.find(name, attrUtil.derSchemaClass()) != null;
+ found = derSchemaDAO.find(name, attrUtils.derSchemaClass()) != null;
break;
case PLAIN:
- found = plainSchemaDAO.find(name, attrUtil.plainSchemaClass()) != null;
+ found = plainSchemaDAO.find(name, attrUtils.plainSchemaClass()) != null;
break;
default:
@@ -100,22 +100,21 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
throw sce;
}
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(attrType);
-
- if (doesSchemaExist(schemaType, schemaTO.getKey(), attrUtil)) {
- throw new DuplicateException(schemaType + "/" + attrType + "/" + schemaTO.getKey());
+ AttributableUtils attrUtils = attrUtilsFactory.getInstance(attrType);
+ if (doesSchemaExist(schemaType, schemaTO.getKey(), attrUtils)) {
+ throw new DuplicateException(attrType + "/" + schemaType + "/" + schemaTO.getKey());
}
T created;
switch (schemaType) {
case VIRTUAL:
- VirSchema virSchema = attrUtil.newVirSchema();
+ VirSchema virSchema = attrUtils.newVirSchema();
binder.create((VirSchemaTO) schemaTO, virSchema);
virSchema = virSchemaDAO.save(virSchema);
created = (T) binder.getVirSchemaTO(virSchema);
break;
case DERIVED:
- DerSchema derSchema = attrUtil.newDerSchema();
+ DerSchema derSchema = attrUtils.newDerSchema();
binder.create((DerSchemaTO) schemaTO, derSchema);
derSchema = derSchemaDAO.save(derSchema);
@@ -124,47 +123,47 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
case PLAIN:
default:
- PlainSchema normalSchema = attrUtil.newPlainSchema();
+ PlainSchema normalSchema = attrUtils.newPlainSchema();
binder.create((PlainSchemaTO) schemaTO, normalSchema);
normalSchema = plainSchemaDAO.save(normalSchema);
- created = (T) binder.getPlainSchemaTO(normalSchema, attrUtil);
+ created = (T) binder.getPlainSchemaTO(normalSchema, attrUtils);
}
return created;
}
@PreAuthorize("hasRole('SCHEMA_DELETE')")
public void delete(final AttributableType attrType, final SchemaType schemaType, final String schemaName) {
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(attrType);
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(attrType);
- if (!doesSchemaExist(schemaType, schemaName, attrUtil)) {
+ if (!doesSchemaExist(schemaType, schemaName, attrUtils)) {
throw new NotFoundException(schemaType + "/" + attrType + "/" + schemaName);
}
switch (schemaType) {
case VIRTUAL:
- virSchemaDAO.delete(schemaName, attrUtil);
+ virSchemaDAO.delete(schemaName, attrUtils);
break;
case DERIVED:
- derSchemaDAO.delete(schemaName, attrUtil);
+ derSchemaDAO.delete(schemaName, attrUtils);
break;
case PLAIN:
default:
- plainSchemaDAO.delete(schemaName, attrUtil);
+ plainSchemaDAO.delete(schemaName, attrUtils);
}
}
@PreAuthorize("isAuthenticated()")
@SuppressWarnings("unchecked")
public <T extends AbstractSchemaTO> List<T> list(final AttributableType attrType, final SchemaType schemaType) {
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(attrType);
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(attrType);
List<T> result;
switch (schemaType) {
case VIRTUAL:
- result = CollectionUtils.collect(virSchemaDAO.findAll(attrUtil.virSchemaClass()),
+ result = CollectionUtils.collect(virSchemaDAO.findAll(attrUtils.virSchemaClass()),
new Transformer<VirSchema, T>() {
@Override
@@ -175,7 +174,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
break;
case DERIVED:
- result = CollectionUtils.collect(derSchemaDAO.findAll(attrUtil.derSchemaClass()),
+ result = CollectionUtils.collect(derSchemaDAO.findAll(attrUtils.derSchemaClass()),
new Transformer<DerSchema, T>() {
@Override
@@ -187,12 +186,12 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
case PLAIN:
default:
- result = CollectionUtils.collect(plainSchemaDAO.findAll(attrUtil.plainSchemaClass()),
+ result = CollectionUtils.collect(plainSchemaDAO.findAll(attrUtils.plainSchemaClass()),
new Transformer<PlainSchema, T>() {
@Override
public T transform(final PlainSchema input) {
- return (T) binder.getPlainSchemaTO(input, attrUtil);
+ return (T) binder.getPlainSchemaTO(input, attrUtils);
}
}, new ArrayList<T>());
}
@@ -205,12 +204,12 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
public <T extends AbstractSchemaTO> T read(
final AttributableType attrType, final SchemaType schemaType, final String schemaName) {
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(attrType);
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(attrType);
T read;
switch (schemaType) {
case VIRTUAL:
- VirSchema virSchema = virSchemaDAO.find(schemaName, attrUtil.virSchemaClass());
+ VirSchema virSchema = virSchemaDAO.find(schemaName, attrUtils.virSchemaClass());
if (virSchema == null) {
throw new NotFoundException("Virtual Schema '" + schemaName + "'");
}
@@ -219,7 +218,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
break;
case DERIVED:
- DerSchema derSchema = derSchemaDAO.find(schemaName, attrUtil.derSchemaClass());
+ DerSchema derSchema = derSchemaDAO.find(schemaName, attrUtils.derSchemaClass());
if (derSchema == null) {
throw new NotFoundException("Derived schema '" + schemaName + "'");
}
@@ -229,12 +228,12 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
case PLAIN:
default:
- PlainSchema schema = plainSchemaDAO.find(schemaName, attrUtil.plainSchemaClass());
+ PlainSchema schema = plainSchemaDAO.find(schemaName, attrUtils.plainSchemaClass());
if (schema == null) {
throw new NotFoundException("Schema '" + schemaName + "'");
}
- read = (T) binder.getPlainSchemaTO(schema, attrUtil);
+ read = (T) binder.getPlainSchemaTO(schema, attrUtils);
}
return read;
@@ -244,15 +243,15 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
public <T extends AbstractSchemaTO> void update(
final AttributableType attrType, final SchemaType schemaType, final T schemaTO) {
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(attrType);
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(attrType);
- if (!doesSchemaExist(schemaType, schemaTO.getKey(), attrUtil)) {
+ if (!doesSchemaExist(schemaType, schemaTO.getKey(), attrUtils)) {
throw new NotFoundException(schemaType + "/" + attrType + "/" + schemaTO.getKey());
}
switch (schemaType) {
case VIRTUAL:
- VirSchema virSchema = virSchemaDAO.find(schemaTO.getKey(), attrUtil.virSchemaClass());
+ VirSchema virSchema = virSchemaDAO.find(schemaTO.getKey(), attrUtils.virSchemaClass());
if (virSchema == null) {
throw new NotFoundException("Virtual Schema '" + schemaTO.getKey() + "'");
}
@@ -262,7 +261,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
break;
case DERIVED:
- DerSchema derSchema = derSchemaDAO.find(schemaTO.getKey(), attrUtil.derSchemaClass());
+ DerSchema derSchema = derSchemaDAO.find(schemaTO.getKey(), attrUtils.derSchemaClass());
if (derSchema == null) {
throw new NotFoundException("Derived schema '" + schemaTO.getKey() + "'");
}
@@ -273,12 +272,12 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
case PLAIN:
default:
- PlainSchema schema = plainSchemaDAO.find(schemaTO.getKey(), attrUtil.plainSchemaClass());
+ PlainSchema schema = plainSchemaDAO.find(schemaTO.getKey(), attrUtils.plainSchemaClass());
if (schema == null) {
throw new NotFoundException("Schema '" + schemaTO.getKey() + "'");
}
- binder.update((PlainSchemaTO) schemaTO, schema, attrUtil);
+ binder.update((PlainSchemaTO) schemaTO, schema, attrUtils);
plainSchemaDAO.save(schema);
}
}
@@ -305,15 +304,15 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
if (key != null) {
try {
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(kind);
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(kind);
AbstractSchemaTO result = null;
- PlainSchema plainSchema = plainSchemaDAO.find(key, attrUtil.plainSchemaClass());
+ PlainSchema plainSchema = plainSchemaDAO.find(key, attrUtils.plainSchemaClass());
if (plainSchema == null) {
- DerSchema derSchema = derSchemaDAO.find(key, attrUtil.derSchemaClass());
+ DerSchema derSchema = derSchemaDAO.find(key, attrUtils.derSchemaClass());
if (derSchema == null) {
- VirSchema virSchema = virSchemaDAO.find(key, attrUtil.virSchemaClass());
+ VirSchema virSchema = virSchemaDAO.find(key, attrUtils.virSchemaClass());
if (virSchema != null) {
result = binder.getVirSchemaTO(virSchema);
}
@@ -321,7 +320,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
result = binder.getDerSchemaTO(derSchema);
}
} else {
- result = binder.getPlainSchemaTO(plainSchema, attrUtil);
+ result = binder.getPlainSchemaTO(plainSchema, attrUtils);
}
return result;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java
index b2a89ca..6963dbe 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java
@@ -105,7 +105,7 @@ public class SecurityQuestionLogic extends AbstractTransactionalLogic<SecurityQu
return deleted;
}
- @PreAuthorize("isAnonymous() or hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT)")
+ @PreAuthorize("isAnonymous() or hasRole('ANONYMOUS')")
public SecurityQuestionTO read(final String username) {
if (username == null) {
throw new NotFoundException("Null username");
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
index 8084cd4..09c606a 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
@@ -34,6 +34,7 @@ import org.apache.syncope.core.provisioning.api.AttributableTransformer;
import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
import org.apache.syncope.core.provisioning.api.GroupProvisioningManager;
import org.apache.syncope.core.provisioning.api.UserProvisioningManager;
+import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
import org.apache.syncope.core.provisioning.java.notification.NotificationManagerImpl;
import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
@@ -71,6 +72,9 @@ public class SyncopeLogic extends AbstractLogic<SyncopeTO> {
private GroupProvisioningManager gProvisioningManager;
@Autowired
+ private VirAttrCache virAttrCache;
+
+ @Autowired
private ImplementationClassNamesLoader classNamesLoader;
@Resource(name = "velocityResourceLoader")
@@ -114,6 +118,7 @@ public class SyncopeLogic extends AbstractLogic<SyncopeTO> {
syncopeTO.setUserProvisioningManager(uProvisioningManager.getClass().getName());
syncopeTO.setGroupProvisioningManager(gProvisioningManager.getClass().getName());
+ syncopeTO.setVirAttrCache(virAttrCache.getClass().getName());
syncopeTO.getReportlets().addAll(
classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.REPORTLET));
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
index 4e51328..168e306 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
@@ -27,8 +27,6 @@ import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AbstractTaskTO;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.SchedTaskTO;
import org.apache.syncope.common.lib.to.SyncTaskTO;
import org.apache.syncope.common.lib.to.TaskExecTO;
@@ -45,8 +43,8 @@ import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.persistence.api.entity.task.SchedTask;
import org.apache.syncope.core.persistence.api.entity.task.Task;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
-import org.apache.syncope.core.persistence.api.entity.task.TaskUtil;
-import org.apache.syncope.core.persistence.api.entity.task.TaskUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.task.TaskUtils;
+import org.apache.syncope.core.persistence.api.entity.task.TaskUtilsFactory;
import org.apache.syncope.core.provisioning.api.data.TaskDataBinder;
import org.apache.syncope.core.provisioning.api.job.JobNamer;
import org.apache.syncope.core.provisioning.api.job.TaskJob;
@@ -86,13 +84,13 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
private SchedulerFactoryBean scheduler;
@Autowired
- private TaskUtilFactory taskUtilFactory;
+ private TaskUtilsFactory taskUtilsFactory;
@PreAuthorize("hasRole('TASK_CREATE')")
public <T extends SchedTaskTO> T createSchedTask(final T taskTO) {
- TaskUtil taskUtil = taskUtilFactory.getInstance(taskTO);
+ TaskUtils taskUtils = taskUtilsFactory.getInstance(taskTO);
- SchedTask task = binder.createSchedTask(taskTO, taskUtil);
+ SchedTask task = binder.createSchedTask(taskTO, taskUtils);
task = taskDAO.save(task);
try {
@@ -105,7 +103,7 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
throw sce;
}
- return binder.getTaskTO(task, taskUtil);
+ return binder.getTaskTO(task, taskUtils);
}
@PreAuthorize("hasRole('TASK_UPDATE')")
@@ -120,9 +118,9 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
throw new NotFoundException("Task " + taskTO.getKey());
}
- TaskUtil taskUtil = taskUtilFactory.getInstance(task);
+ TaskUtils taskUtils = taskUtilsFactory.getInstance(task);
- binder.updateSchedTask(task, taskTO, taskUtil);
+ binder.updateSchedTask(task, taskTO, taskUtils);
task = taskDAO.save(task);
try {
@@ -135,7 +133,7 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
throw sce;
}
- return binder.getTaskTO(task, taskUtil);
+ return binder.getTaskTO(task, taskUtils);
}
@PreAuthorize("hasRole('TASK_LIST')")
@@ -148,14 +146,14 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
public <T extends AbstractTaskTO> List<T> list(final TaskType taskType,
final int page, final int size, final List<OrderByClause> orderByClauses) {
- final TaskUtil taskUtil = taskUtilFactory.getInstance(taskType);
+ final TaskUtils taskUtilss = taskUtilsFactory.getInstance(taskType);
return CollectionUtils.collect(taskDAO.findAll(page, size, orderByClauses, taskType),
new Transformer<Task, T>() {
@Override
public T transform(final Task task) {
- return (T) binder.getTaskTO(task, taskUtil);
+ return (T) binder.getTaskTO(task, taskUtilss);
}
}, new ArrayList<T>());
}
@@ -166,7 +164,7 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
if (task == null) {
throw new NotFoundException("Task " + taskId);
}
- return binder.getTaskTO(task, taskUtilFactory.getInstance(task));
+ return binder.getTaskTO(task, taskUtilsFactory.getInstance(task));
}
@PreAuthorize("hasRole('TASK_READ')")
@@ -184,10 +182,10 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
if (task == null) {
throw new NotFoundException("Task " + taskId);
}
- TaskUtil taskUtil = taskUtilFactory.getInstance(task);
+ TaskUtils taskUtils = taskUtilsFactory.getInstance(task);
TaskExecTO result = null;
- switch (taskUtil.getType()) {
+ switch (taskUtils.getType()) {
case PROPAGATION:
final TaskExec propExec = taskExecutor.execute((PropagationTask) task);
result = binder.getTaskExecTO(propExec);
@@ -241,14 +239,14 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidPropagationTaskExecReport);
- TaskUtil taskUtil = taskUtilFactory.getInstance(exec.getTask());
- if (TaskType.PROPAGATION == taskUtil.getType()) {
+ TaskUtils taskUtils = taskUtilsFactory.getInstance(exec.getTask());
+ if (TaskType.PROPAGATION == taskUtils.getType()) {
PropagationTask task = (PropagationTask) exec.getTask();
if (task.getPropagationMode() != PropagationMode.TWO_PHASES) {
sce.getElements().add("Propagation mode: " + task.getPropagationMode());
}
} else {
- sce.getElements().add("Task type: " + taskUtil);
+ sce.getElements().add("Task type: " + taskUtils);
}
switch (status) {
@@ -280,13 +278,13 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
if (task == null) {
throw new NotFoundException("Task " + taskId);
}
- TaskUtil taskUtil = taskUtilFactory.getInstance(task);
+ TaskUtils taskUtils = taskUtilsFactory.getInstance(task);
- T taskToDelete = binder.getTaskTO(task, taskUtil);
+ T taskToDelete = binder.getTaskTO(task, taskUtils);
- if (TaskType.SCHEDULED == taskUtil.getType()
- || TaskType.SYNCHRONIZATION == taskUtil.getType()
- || TaskType.PUSH == taskUtil.getType()) {
+ if (TaskType.SCHEDULED == taskUtils.getType()
+ || TaskType.SYNCHRONIZATION == taskUtils.getType()
+ || TaskType.PUSH == taskUtils.getType()) {
jobInstanceLoader.unregisterJob(task);
}
@@ -307,55 +305,6 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
return taskExecutionToDelete;
}
- @PreAuthorize("(hasRole('TASK_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE) or "
- + "(hasRole('TASK_EXECUTE') and "
- + "(#bulkAction.operation == #bulkAction.operation.EXECUTE or "
- + "#bulkAction.operation == #bulkAction.operation.DRYRUN))")
- public BulkActionResult bulk(final BulkAction bulkAction) {
- BulkActionResult res = new BulkActionResult();
-
- switch (bulkAction.getOperation()) {
- case DELETE:
- for (String taskId : bulkAction.getTargets()) {
- try {
- res.add(delete(Long.valueOf(taskId)).getKey(), BulkActionResult.Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing delete for task {}", taskId, e);
- res.add(taskId, BulkActionResult.Status.FAILURE);
- }
- }
- break;
-
- case DRYRUN:
- for (String taskId : bulkAction.getTargets()) {
- try {
- execute(Long.valueOf(taskId), true);
- res.add(taskId, BulkActionResult.Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing dryrun for task {}", taskId, e);
- res.add(taskId, BulkActionResult.Status.FAILURE);
- }
- }
- break;
-
- case EXECUTE:
- for (String taskId : bulkAction.getTargets()) {
- try {
- execute(Long.valueOf(taskId), false);
- res.add(taskId, BulkActionResult.Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing execute for task {}", taskId, e);
- res.add(taskId, BulkActionResult.Status.FAILURE);
- }
- }
- break;
-
- default:
- }
-
- return res;
- }
-
@Override
protected AbstractTaskTO resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
@@ -377,7 +326,7 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
if ((key != null) && !key.equals(0L)) {
try {
final Task task = taskDAO.find(key);
- return binder.getTaskTO(task, taskUtilFactory.getInstance(task));
+ return binder.getTaskTO(task, taskUtilsFactory.getInstance(task));
} catch (Throwable ignore) {
LOG.debug("Unresolved reference", ignore);
throw new UnresolvedReferenceException(ignore);
[18/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java
deleted file mode 100644
index ebacf04..0000000
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java
+++ /dev/null
@@ -1,405 +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.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.annotation.Resource;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
-import org.apache.syncope.common.lib.to.PropagationStatus;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
-import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.provisioning.api.AttributableTransformer;
-import org.apache.syncope.core.provisioning.api.RoleProvisioningManager;
-import org.apache.syncope.core.provisioning.api.data.RoleDataBinder;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.misc.security.UnauthorizedRoleException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.transaction.interceptor.TransactionInterceptor;
-
-/**
- * Note that this controller does not extend {@link AbstractTransactionalLogic}, hence does not provide any
- * Spring's Transactional logic at class level.
- */
-@Component
-public class RoleLogic extends AbstractSubjectLogic<RoleTO, RoleMod> {
-
- @Autowired
- protected RoleDAO roleDAO;
-
- @Autowired
- protected UserDAO userDAO;
-
- @Autowired
- protected SubjectSearchDAO searchDAO;
-
- @Autowired
- protected RoleDataBinder binder;
-
- @Autowired
- protected PropagationManager propagationManager;
-
- @Autowired
- protected PropagationTaskExecutor taskExecutor;
-
- @Autowired
- protected AttributableTransformer attrTransformer;
-
- @Resource(name = "anonymousUser")
- protected String anonymousUser;
-
- @Autowired
- protected RoleProvisioningManager provisioningManager;
-
- @PreAuthorize("hasAnyRole('ROLE_READ', T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT)")
- @Transactional(readOnly = true)
- @Override
- public RoleTO read(final Long roleKey) {
- Role role;
- // bypass role entitlements check
- if (anonymousUser.equals(AuthContextUtil.getAuthenticatedUsername())) {
- role = roleDAO.find(roleKey);
- } else {
- role = roleDAO.authFetch(roleKey);
- }
-
- if (role == null) {
- throw new NotFoundException("Role " + roleKey);
- }
-
- return binder.getRoleTO(role);
- }
-
- @PreAuthorize("isAuthenticated() "
- + "and not(hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT))")
- @Transactional(readOnly = true)
- public RoleTO readSelf(final Long roleKey) {
- // Explicit search instead of using binder.getRoleFromId() in order to bypass auth checks - will do here
- Role role = roleDAO.find(roleKey);
- if (role == null) {
- throw new NotFoundException("Role " + roleKey);
- }
-
- Set<Long> ownedRoleIds;
- User authUser = userDAO.find(AuthContextUtil.getAuthenticatedUsername());
- if (authUser == null) {
- ownedRoleIds = Collections.<Long>emptySet();
- } else {
- ownedRoleIds = authUser.getRoleKeys();
- }
-
- Set<Long> allowedRoleIds = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
- allowedRoleIds.addAll(ownedRoleIds);
- if (!allowedRoleIds.contains(role.getKey())) {
- throw new UnauthorizedRoleException(role.getKey());
- }
-
- return binder.getRoleTO(role);
- }
-
- @PreAuthorize("hasRole('ROLE_READ')")
- @Transactional(readOnly = true)
- public RoleTO parent(final Long roleKey) {
- Role role = roleDAO.authFetch(roleKey);
-
- Set<Long> allowedRoleIds = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
- if (role.getParent() != null && !allowedRoleIds.contains(role.getParent().getKey())) {
- throw new UnauthorizedRoleException(role.getParent().getKey());
- }
-
- RoleTO result = role.getParent() == null
- ? null
- : binder.getRoleTO(role.getParent());
-
- return result;
- }
-
- @PreAuthorize("hasRole('ROLE_READ')")
- @Transactional(readOnly = true)
- public List<RoleTO> children(final Long roleKey) {
- Role role = roleDAO.authFetch(roleKey);
-
- Set<Long> allowedRoleIds = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
-
- List<Role> children = roleDAO.findChildren(role);
- List<RoleTO> childrenTOs = new ArrayList<>(children.size());
- for (Role child : children) {
- if (allowedRoleIds.contains(child.getKey())) {
- childrenTOs.add(binder.getRoleTO(child));
- }
- }
-
- return childrenTOs;
- }
-
- @PreAuthorize("isAuthenticated()")
- @Transactional(readOnly = true, rollbackFor = { Throwable.class })
- @Override
- public int count() {
- return roleDAO.count();
- }
-
- @PreAuthorize("isAuthenticated()")
- @Transactional(readOnly = true)
- @Override
- public List<RoleTO> list(final int page, final int size, final List<OrderByClause> orderBy) {
- List<Role> roles = roleDAO.findAll(page, size, orderBy);
-
- List<RoleTO> roleTOs = new ArrayList<>(roles.size());
- for (Role role : roles) {
- roleTOs.add(binder.getRoleTO(role));
- }
-
- return roleTOs;
- }
-
- @PreAuthorize("isAuthenticated()")
- @Transactional(readOnly = true, rollbackFor = { Throwable.class })
- @Override
- public int searchCount(final SearchCond searchCondition) {
- final Set<Long> adminRoleIds = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
- return searchDAO.count(adminRoleIds, searchCondition, SubjectType.ROLE);
- }
-
- @PreAuthorize("isAuthenticated()")
- @Transactional(readOnly = true, rollbackFor = { Throwable.class })
- @Override
- public List<RoleTO> search(final SearchCond searchCondition, final int page, final int size,
- final List<OrderByClause> orderBy) {
-
- final List<Role> matchingRoles = searchDAO.search(
- RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames()),
- searchCondition, page, size, orderBy, SubjectType.ROLE);
-
- final List<RoleTO> result = new ArrayList<>(matchingRoles.size());
- for (Role role : matchingRoles) {
- result.add(binder.getRoleTO(role));
- }
-
- return result;
- }
-
- @PreAuthorize("hasRole('ROLE_CREATE')")
- public RoleTO create(final RoleTO roleTO) {
- // Check that this operation is allowed to be performed by caller
- Set<Long> allowedRoleIds = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
- if (roleTO.getParent() != 0 && !allowedRoleIds.contains(roleTO.getParent())) {
- throw new UnauthorizedRoleException(roleTO.getParent());
- }
-
- // Attributable transformation (if configured)
- RoleTO actual = attrTransformer.transform(roleTO);
- LOG.debug("Transformed: {}", actual);
-
- /*
- * Actual operations: workflow, propagation
- */
- Map.Entry<Long, List<PropagationStatus>> created = provisioningManager.create(roleTO);
- final RoleTO savedTO = binder.getRoleTO(created.getKey());
- savedTO.getPropagationStatusTOs().addAll(created.getValue());
- return savedTO;
- }
-
- @PreAuthorize("hasRole('ROLE_UPDATE')")
- @Override
- public RoleTO update(final RoleMod roleMod) {
- // Check that this operation is allowed to be performed by caller
- roleDAO.authFetch(roleMod.getKey());
-
- // Attribute value transformation (if configured)
- RoleMod actual = attrTransformer.transform(roleMod);
- LOG.debug("Transformed: {}", actual);
-
- Map.Entry<Long, List<PropagationStatus>> updated = provisioningManager.update(roleMod);
-
- final RoleTO updatedTO = binder.getRoleTO(updated.getKey());
- updatedTO.getPropagationStatusTOs().addAll(updated.getValue());
- return updatedTO;
- }
-
- @PreAuthorize("hasRole('ROLE_DELETE')")
- @Override
- public RoleTO delete(final Long roleKey) {
- List<Role> ownedRoles = roleDAO.findOwnedByRole(roleKey);
- if (!ownedRoles.isEmpty()) {
- List<String> owned = new ArrayList<String>(ownedRoles.size());
- for (Role role : ownedRoles) {
- owned.add(role.getKey() + " " + role.getName());
- }
-
- SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RoleOwnership);
- sce.getElements().addAll(owned);
- throw sce;
- }
-
- List<PropagationStatus> statuses = provisioningManager.delete(roleKey);
-
- RoleTO roleTO = new RoleTO();
- roleTO.setKey(roleKey);
-
- roleTO.getPropagationStatusTOs().addAll(statuses);
-
- return roleTO;
- }
-
- @PreAuthorize("(hasRole('ROLE_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE)")
- public BulkActionResult bulk(final BulkAction bulkAction) {
- BulkActionResult res = new BulkActionResult();
-
- if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
- for (String roleKey : bulkAction.getTargets()) {
- try {
- res.add(delete(Long.valueOf(roleKey)).getKey(), BulkActionResult.Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing delete for role {}", roleKey, e);
- res.add(roleKey, BulkActionResult.Status.FAILURE);
- }
- }
- } else {
- LOG.warn("Unsupported bulk action: {}", bulkAction.getOperation());
- }
-
- return res;
- }
-
- @PreAuthorize("hasRole('ROLE_UPDATE')")
- @Transactional(rollbackFor = { Throwable.class })
- @Override
- public RoleTO unlink(final Long roleKey, final Collection<String> resources) {
- final RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleKey);
- roleMod.getResourcesToRemove().addAll(resources);
- final Long updatedResult = provisioningManager.unlink(roleMod);
-
- return binder.getRoleTO(updatedResult);
- }
-
- @PreAuthorize("hasRole('ROLE_UPDATE')")
- @Transactional(rollbackFor = { Throwable.class })
- @Override
- public RoleTO link(final Long roleKey, final Collection<String> resources) {
- final RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleKey);
- roleMod.getResourcesToAdd().addAll(resources);
- return binder.getRoleTO(provisioningManager.link(roleMod));
- }
-
- @PreAuthorize("hasRole('ROLE_UPDATE')")
- @Transactional(rollbackFor = { Throwable.class })
- @Override
- public RoleTO unassign(final Long roleKey, final Collection<String> resources) {
- final RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleKey);
- roleMod.getResourcesToRemove().addAll(resources);
- return update(roleMod);
- }
-
- @PreAuthorize("hasRole('ROLE_UPDATE')")
- @Transactional(rollbackFor = { Throwable.class })
- @Override
- public RoleTO assign(
- final Long roleKey, final Collection<String> resources, final boolean changePwd, final String password) {
-
- final RoleMod userMod = new RoleMod();
- userMod.setKey(roleKey);
- userMod.getResourcesToAdd().addAll(resources);
- return update(userMod);
- }
-
- @PreAuthorize("hasRole('ROLE_UPDATE')")
- @Transactional(rollbackFor = { Throwable.class })
- @Override
- public RoleTO deprovision(final Long roleKey, final Collection<String> resources) {
- final Role role = roleDAO.authFetch(roleKey);
-
- List<PropagationStatus> statuses = provisioningManager.deprovision(roleKey, resources);
-
- final RoleTO updatedTO = binder.getRoleTO(role);
- updatedTO.getPropagationStatusTOs().addAll(statuses);
- return updatedTO;
- }
-
- @PreAuthorize("hasRole('ROLE_UPDATE')")
- @Transactional(rollbackFor = { Throwable.class })
- @Override
- public RoleTO provision(
- final Long roleKey, final Collection<String> resources, final boolean changePwd, final String password) {
- final RoleTO original = binder.getRoleTO(roleKey);
-
- //trick: assign and retrieve propagation statuses ...
- original.getPropagationStatusTOs().addAll(
- assign(roleKey, resources, changePwd, password).getPropagationStatusTOs());
-
- // .... rollback.
- TransactionInterceptor.currentTransactionStatus().setRollbackOnly();
- return original;
- }
-
- @Override
- protected RoleTO resolveReference(final Method method, final Object... args) throws UnresolvedReferenceException {
- Long key = null;
-
- if (ArrayUtils.isNotEmpty(args)) {
- for (int i = 0; key == null && i < args.length; i++) {
- if (args[i] instanceof Long) {
- key = (Long) args[i];
- } else if (args[i] instanceof RoleTO) {
- key = ((RoleTO) args[i]).getKey();
- } else if (args[i] instanceof RoleMod) {
- key = ((RoleMod) args[i]).getKey();
- }
- }
- }
-
- if ((key != null) && !key.equals(0l)) {
- try {
- return binder.getRoleTO(key);
- } catch (Throwable ignore) {
- LOG.debug("Unresolved reference", ignore);
- throw new UnresolvedReferenceException(ignore);
- }
- }
-
- throw new UnresolvedReferenceException();
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
index 153b45a..8084cd4 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
@@ -32,10 +32,10 @@ import org.apache.syncope.core.misc.spring.ResourceWithFallbackLoader;
import org.apache.syncope.core.persistence.api.dao.ConfDAO;
import org.apache.syncope.core.provisioning.api.AttributableTransformer;
import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
-import org.apache.syncope.core.provisioning.api.RoleProvisioningManager;
+import org.apache.syncope.core.provisioning.api.GroupProvisioningManager;
import org.apache.syncope.core.provisioning.api.UserProvisioningManager;
import org.apache.syncope.core.provisioning.java.notification.NotificationManagerImpl;
-import org.apache.syncope.core.workflow.api.RoleWorkflowAdapter;
+import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -62,13 +62,13 @@ public class SyncopeLogic extends AbstractLogic<SyncopeTO> {
private UserWorkflowAdapter uwfAdapter;
@Autowired
- private RoleWorkflowAdapter rwfAdapter;
+ private GroupWorkflowAdapter gwfAdapter;
@Autowired
private UserProvisioningManager uProvisioningManager;
@Autowired
- private RoleProvisioningManager rProvisioningManager;
+ private GroupProvisioningManager gProvisioningManager;
@Autowired
private ImplementationClassNamesLoader classNamesLoader;
@@ -110,10 +110,10 @@ public class SyncopeLogic extends AbstractLogic<SyncopeTO> {
syncopeTO.setAttributableTransformer(attrTransformer.getClass().getName());
syncopeTO.setUserWorkflowAdapter(AopUtils.getTargetClass(uwfAdapter).getName());
- syncopeTO.setRoleWorkflowAdapter(AopUtils.getTargetClass(rwfAdapter).getName());
+ syncopeTO.setGroupWorkflowAdapter(AopUtils.getTargetClass(gwfAdapter).getName());
syncopeTO.setUserProvisioningManager(uProvisioningManager.getClass().getName());
- syncopeTO.setRoleProvisioningManager(rProvisioningManager.getClass().getName());
+ syncopeTO.setGroupProvisioningManager(gProvisioningManager.getClass().getName());
syncopeTO.getReportlets().addAll(
classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.REPORTLET));
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index 17e577b..c86525e 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@ -18,7 +18,7 @@
*/
package org.apache.syncope.core.logic;
-import org.apache.syncope.core.misc.security.UnauthorizedRoleException;
+import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
import java.lang.reflect.Method;
import java.security.AccessControlException;
import java.util.ArrayList;
@@ -41,14 +41,14 @@ import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+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.provisioning.api.AttributableTransformer;
import org.apache.syncope.core.provisioning.api.UserProvisioningManager;
@@ -74,7 +74,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
protected UserDAO userDAO;
@Autowired
- protected RoleDAO roleDAO;
+ protected GroupDAO groupDAO;
@Autowired
protected SubjectSearchDAO searchDAO;
@@ -114,14 +114,14 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
@Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
public int count() {
- return userDAO.count(RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames()));
+ return userDAO.count(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames()));
}
@PreAuthorize("hasRole('USER_LIST')")
@Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
public int searchCount(final SearchCond searchCondition) {
- return searchDAO.count(RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames()),
+ return searchDAO.count(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames()),
searchCondition, SubjectType.USER);
}
@@ -129,9 +129,9 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
@Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
public List<UserTO> list(final int page, final int size, final List<OrderByClause> orderBy) {
- Set<Long> adminRoleIds = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
+ Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
- List<User> users = userDAO.findAll(adminRoleIds, page, size, orderBy);
+ List<User> users = userDAO.findAll(adminGroupIds, page, size, orderBy);
List<UserTO> userTOs = new ArrayList<>(users.size());
for (User user : users) {
userTOs.add(binder.getUserTO(user));
@@ -160,8 +160,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
public List<UserTO> search(final SearchCond searchCondition, final int page, final int size,
final List<OrderByClause> orderBy) {
- final List<User> matchingUsers = searchDAO.search(
- RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames()),
+ final List<User> matchingUsers = searchDAO.search(GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames()),
searchCondition, page, size, orderBy, SubjectType.USER);
final List<UserTO> result = new ArrayList<>(matchingUsers.size());
@@ -179,14 +178,14 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
@PreAuthorize("hasRole('USER_CREATE')")
public UserTO create(final UserTO userTO, final boolean storePassword) {
- Set<Long> requestRoleIds = new HashSet<>(userTO.getMemberships().size());
+ Set<Long> requestGroupIds = new HashSet<>(userTO.getMemberships().size());
for (MembershipTO membership : userTO.getMemberships()) {
- requestRoleIds.add(membership.getRoleId());
+ requestGroupIds.add(membership.getGroupId());
}
- Set<Long> adminRoleIds = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
- requestRoleIds.removeAll(adminRoleIds);
- if (!requestRoleIds.isEmpty()) {
- throw new UnauthorizedRoleException(requestRoleIds);
+ Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
+ requestGroupIds.removeAll(adminGroupIds);
+ if (!requestGroupIds.isEmpty()) {
+ throw new UnauthorizedGroupException(requestGroupIds);
}
return doCreate(userTO, storePassword);
@@ -321,14 +320,14 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
@PreAuthorize("hasRole('USER_DELETE')")
@Override
public UserTO delete(final Long key) {
- List<Role> ownedRoles = roleDAO.findOwnedByUser(key);
- if (!ownedRoles.isEmpty()) {
- List<String> owned = new ArrayList<>(ownedRoles.size());
- for (Role role : ownedRoles) {
- owned.add(role.getKey() + " " + role.getName());
+ List<Group> ownedGroups = groupDAO.findOwnedByUser(key);
+ if (!ownedGroups.isEmpty()) {
+ List<String> owned = new ArrayList<>(ownedGroups.size());
+ for (Group group : ownedGroups) {
+ owned.add(group.getKey() + " " + group.getName());
}
- SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RoleOwnership);
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.GroupOwnership);
sce.getElements().addAll(owned);
throw sce;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/java/org/apache/syncope/core/logic/WorkflowLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/WorkflowLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/WorkflowLogic.java
index c8dcc93..8c6426d 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/WorkflowLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/WorkflowLogic.java
@@ -22,7 +22,7 @@ import java.io.OutputStream;
import java.lang.reflect.Method;
import javax.ws.rs.core.MediaType;
import org.apache.syncope.common.lib.AbstractBaseBean;
-import org.apache.syncope.core.workflow.api.RoleWorkflowAdapter;
+import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
import org.apache.syncope.core.workflow.api.WorkflowAdapter;
import org.apache.syncope.core.workflow.api.WorkflowDefinitionFormat;
@@ -39,7 +39,7 @@ public class WorkflowLogic extends AbstractTransactionalLogic<AbstractBaseBean>
private UserWorkflowAdapter uwfAdapter;
@Autowired
- private RoleWorkflowAdapter rwfAdapter;
+ private GroupWorkflowAdapter gwfAdapter;
private void exportDefinition(
final WorkflowAdapter adapter, final WorkflowDefinitionFormat format, final OutputStream os)
@@ -64,10 +64,10 @@ public class WorkflowLogic extends AbstractTransactionalLogic<AbstractBaseBean>
@PreAuthorize("hasRole('WORKFLOW_DEF_READ')")
@Transactional(readOnly = true)
- public void exportRoleDefinition(final MediaType format, final OutputStream os)
+ public void exportGroupDefinition(final MediaType format, final OutputStream os)
throws WorkflowException {
- exportDefinition(rwfAdapter, getFormat(format), os);
+ exportDefinition(gwfAdapter, getFormat(format), os);
}
private void exportDiagram(final WorkflowAdapter adapter, final OutputStream os)
@@ -85,10 +85,10 @@ public class WorkflowLogic extends AbstractTransactionalLogic<AbstractBaseBean>
@PreAuthorize("hasRole('WORKFLOW_DEF_READ')")
@Transactional(readOnly = true)
- public void exportRoleDiagram(final OutputStream os)
+ public void exportGroupDiagram(final OutputStream os)
throws WorkflowException {
- exportDiagram(rwfAdapter, os);
+ exportDiagram(gwfAdapter, os);
}
private void importDefinition(
@@ -103,8 +103,8 @@ public class WorkflowLogic extends AbstractTransactionalLogic<AbstractBaseBean>
}
@PreAuthorize("hasRole('WORKFLOW_DEF_UPDATE')")
- public void importRoleDefinition(final MediaType format, final String definition) {
- importDefinition(rwfAdapter, getFormat(format), definition);
+ public void importGroupDefinition(final MediaType format, final String definition) {
+ importDefinition(gwfAdapter, getFormat(format), definition);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
new file mode 100644
index 0000000..38c96c6
--- /dev/null
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
@@ -0,0 +1,328 @@
+/*
+ * 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.report;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.report.GroupReportletConf;
+import org.apache.syncope.common.lib.report.GroupReportletConf.Feature;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
+import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
+import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.core.persistence.api.entity.membership.Membership;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.misc.search.SearchCondConverter;
+import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+@ReportletConfClass(GroupReportletConf.class)
+public class GroupReportlet extends AbstractReportlet<GroupReportletConf> {
+
+ private static final int PAGE_SIZE = 10;
+
+ @Autowired
+ private EntitlementDAO entitlementDAO;
+
+ @Autowired
+ private GroupDAO groupDAO;
+
+ @Autowired
+ private SubjectSearchDAO searchDAO;
+
+ @Autowired
+ private GroupDataBinder groupDataBinder;
+
+ private List<Group> getPagedgroups(final int page) {
+ final Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
+ final List<Group> result;
+ if (StringUtils.isBlank(conf.getMatchingCond())) {
+ result = groupDAO.findAll();
+ } else {
+ result = searchDAO.search(adminGroupIds, SearchCondConverter.convert(conf.getMatchingCond()),
+ page, PAGE_SIZE, Collections.<OrderByClause>emptyList(), SubjectType.GROUP);
+ }
+
+ return result;
+ }
+
+ private int count() {
+ Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
+
+ return StringUtils.isBlank(conf.getMatchingCond())
+ ? groupDAO.findAll().size()
+ : searchDAO.count(adminGroupIds,
+ SearchCondConverter.convert(conf.getMatchingCond()), SubjectType.GROUP);
+ }
+
+ private void doExtractResources(final ContentHandler handler, final AbstractSubjectTO subjectTO)
+ throws SAXException {
+
+ if (subjectTO.getResources().isEmpty()) {
+ LOG.debug("No resources found for {}[{}]", subjectTO.getClass().getSimpleName(), subjectTO.getKey());
+ } else {
+ AttributesImpl atts = new AttributesImpl();
+ handler.startElement("", "", "resources", null);
+
+ for (String resourceName : subjectTO.getResources()) {
+ atts.clear();
+
+ atts.addAttribute("", "", ReportXMLConst.ATTR_NAME, ReportXMLConst.XSD_STRING, resourceName);
+ handler.startElement("", "", "resource", atts);
+ handler.endElement("", "", "resource");
+ }
+
+ handler.endElement("", "", "resources");
+ }
+ }
+
+ private void doExtractAttributes(final ContentHandler handler, final AbstractAttributableTO attributableTO,
+ final Collection<String> attrs, final Collection<String> derAttrs, final Collection<String> virAttrs)
+ throws SAXException {
+
+ AttributesImpl atts = new AttributesImpl();
+ if (!attrs.isEmpty()) {
+ Map<String, AttrTO> attrMap = attributableTO.getPlainAttrMap();
+
+ handler.startElement("", "", "attributes", null);
+ for (String attrName : attrs) {
+ atts.clear();
+
+ atts.addAttribute("", "", ReportXMLConst.ATTR_NAME, ReportXMLConst.XSD_STRING, attrName);
+ handler.startElement("", "", "attribute", atts);
+
+ if (attrMap.containsKey(attrName)) {
+ for (String value : attrMap.get(attrName).getValues()) {
+ handler.startElement("", "", "value", null);
+ handler.characters(value.toCharArray(), 0, value.length());
+ handler.endElement("", "", "value");
+ }
+ } else {
+ LOG.debug("{} not found for {}[{}]", attrName,
+ attributableTO.getClass().getSimpleName(), attributableTO.getKey());
+ }
+
+ handler.endElement("", "", "attribute");
+ }
+ handler.endElement("", "", "attributes");
+ }
+
+ if (!derAttrs.isEmpty()) {
+ Map<String, AttrTO> derAttrMap = attributableTO.getDerAttrMap();
+
+ handler.startElement("", "", "derivedAttributes", null);
+ for (String attrName : derAttrs) {
+ atts.clear();
+
+ atts.addAttribute("", "", ReportXMLConst.ATTR_NAME, ReportXMLConst.XSD_STRING, attrName);
+ handler.startElement("", "", "derivedAttribute", atts);
+
+ if (derAttrMap.containsKey(attrName)) {
+ for (String value : derAttrMap.get(attrName).getValues()) {
+ handler.startElement("", "", "value", null);
+ handler.characters(value.toCharArray(), 0, value.length());
+ handler.endElement("", "", "value");
+ }
+ } else {
+ LOG.debug("{} not found for {}[{}]", attrName,
+ attributableTO.getClass().getSimpleName(), attributableTO.getKey());
+ }
+
+ handler.endElement("", "", "derivedAttribute");
+ }
+ handler.endElement("", "", "derivedAttributes");
+ }
+
+ if (!virAttrs.isEmpty()) {
+ Map<String, AttrTO> virAttrMap = attributableTO.getVirAttrMap();
+
+ handler.startElement("", "", "virtualAttributes", null);
+ for (String attrName : virAttrs) {
+ atts.clear();
+
+ atts.addAttribute("", "", ReportXMLConst.ATTR_NAME, ReportXMLConst.XSD_STRING, attrName);
+ handler.startElement("", "", "virtualAttribute", atts);
+
+ if (virAttrMap.containsKey(attrName)) {
+ for (String value : virAttrMap.get(attrName).getValues()) {
+ handler.startElement("", "", "value", null);
+ handler.characters(value.toCharArray(), 0, value.length());
+ handler.endElement("", "", "value");
+ }
+ } else {
+ LOG.debug("{} not found for {}[{}]", attrName,
+ attributableTO.getClass().getSimpleName(), attributableTO.getKey());
+ }
+
+ handler.endElement("", "", "virtualAttribute");
+ }
+ handler.endElement("", "", "virtualAttributes");
+ }
+ }
+
+ private void doExtract(final ContentHandler handler, final List<Group> groups)
+ throws SAXException, ReportException {
+
+ AttributesImpl atts = new AttributesImpl();
+ for (Group group : groups) {
+ atts.clear();
+
+ for (Feature feature : conf.getFeatures()) {
+ String type = null;
+ String value = null;
+ switch (feature) {
+ case key:
+ type = ReportXMLConst.XSD_LONG;
+ value = String.valueOf(group.getKey());
+ break;
+
+ case name:
+ type = ReportXMLConst.XSD_STRING;
+ value = String.valueOf(group.getName());
+ break;
+
+ case groupOwner:
+ type = ReportXMLConst.XSD_LONG;
+ value = String.valueOf(group.getGroupOwner());
+ break;
+
+ case userOwner:
+ type = ReportXMLConst.XSD_LONG;
+ value = String.valueOf(group.getUserOwner());
+ break;
+
+ default:
+ }
+
+ if (type != null && value != null) {
+ atts.addAttribute("", "", feature.name(), type, value);
+ }
+ }
+
+ handler.startElement("", "", "group", atts);
+
+ // Using GroupTO for attribute values, since the conversion logic of
+ // values to String is already encapsulated there
+ GroupTO groupTO = groupDataBinder.getGroupTO(group);
+
+ doExtractAttributes(handler, groupTO, conf.getPlainAttrs(), conf.getDerAttrs(), conf.getVirAttrs());
+
+ if (conf.getFeatures().contains(Feature.entitlements)) {
+ handler.startElement("", "", "entitlements", null);
+
+ for (String ent : groupTO.getEntitlements()) {
+ atts.clear();
+
+ atts.addAttribute("", "", "id", ReportXMLConst.XSD_STRING, String.valueOf(ent));
+
+ handler.startElement("", "", "entitlement", atts);
+ handler.endElement("", "", "entitlement");
+ }
+
+ handler.endElement("", "", "entitlements");
+ }
+ // to get resources associated to a group
+ if (conf.getFeatures().contains(Feature.resources)) {
+ doExtractResources(handler, groupTO);
+ }
+ //to get users asscoiated to a group is preferred GroupDAO to GroupTO
+ if (conf.getFeatures().contains(Feature.users)) {
+ handler.startElement("", "", "users", null);
+
+ for (Membership memb : groupDAO.findMemberships(group)) {
+ atts.clear();
+
+ atts.addAttribute("", "", "key", ReportXMLConst.XSD_LONG,
+ String.valueOf(memb.getUser().getKey()));
+ atts.addAttribute("", "", "username", ReportXMLConst.XSD_STRING,
+ String.valueOf(memb.getUser().getUsername()));
+
+ handler.startElement("", "", "user", atts);
+ handler.endElement("", "", "user");
+ }
+
+ handler.endElement("", "", "users");
+ }
+
+ handler.endElement("", "", "group");
+ }
+ }
+
+ private void doExtractConf(final ContentHandler handler) throws SAXException {
+ if (conf == null) {
+ LOG.debug("Report configuration is not present");
+ }
+
+ AttributesImpl atts = new AttributesImpl();
+ handler.startElement("", "", "configurations", null);
+ handler.startElement("", "", "groupAttributes", atts);
+
+ for (Feature feature : conf.getFeatures()) {
+ atts.clear();
+ handler.startElement("", "", "feature", atts);
+ handler.characters(feature.name().toCharArray(), 0, feature.name().length());
+ handler.endElement("", "", "feature");
+ }
+
+ for (String attr : conf.getPlainAttrs()) {
+ atts.clear();
+ handler.startElement("", "", "attribute", atts);
+ handler.characters(attr.toCharArray(), 0, attr.length());
+ handler.endElement("", "", "attribute");
+ }
+
+ for (String derAttr : conf.getDerAttrs()) {
+ atts.clear();
+ handler.startElement("", "", "derAttribute", atts);
+ handler.characters(derAttr.toCharArray(), 0, derAttr.length());
+ handler.endElement("", "", "derAttribute");
+ }
+
+ for (String virAttr : conf.getVirAttrs()) {
+ atts.clear();
+ handler.startElement("", "", "virAttribute", atts);
+ handler.characters(virAttr.toCharArray(), 0, virAttr.length());
+ handler.endElement("", "", "virAttribute");
+ }
+
+ handler.endElement("", "", "groupAttributes");
+ handler.endElement("", "", "configurations");
+ }
+
+ @Override
+ protected void doExtract(final ContentHandler handler) throws SAXException, ReportException {
+ doExtractConf(handler);
+ for (int i = 1; i <= (count() / PAGE_SIZE) + 1; i++) {
+ doExtract(handler, getPagedgroups(i));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/java/org/apache/syncope/core/logic/report/RoleReportlet.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/RoleReportlet.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/RoleReportlet.java
deleted file mode 100644
index 5bada5d..0000000
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/RoleReportlet.java
+++ /dev/null
@@ -1,327 +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.report;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.report.RoleReportletConf;
-import org.apache.syncope.common.lib.report.RoleReportletConf.Feature;
-import org.apache.syncope.common.lib.to.AbstractAttributableTO;
-import org.apache.syncope.common.lib.to.AbstractSubjectTO;
-import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
-import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.provisioning.java.data.RoleDataBinderImpl;
-import org.apache.syncope.core.misc.search.SearchCondConverter;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-@ReportletConfClass(RoleReportletConf.class)
-public class RoleReportlet extends AbstractReportlet<RoleReportletConf> {
-
- private static final int PAGE_SIZE = 10;
-
- @Autowired
- private EntitlementDAO entitlementDAO;
-
- @Autowired
- private RoleDAO roleDAO;
-
- @Autowired
- private SubjectSearchDAO searchDAO;
-
- @Autowired
- private RoleDataBinderImpl roleDataBinder;
-
- private List<Role> getPagedRoles(final int page) {
- final Set<Long> adminRoleIds = RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll());
- final List<Role> result;
- if (StringUtils.isBlank(conf.getMatchingCond())) {
- result = roleDAO.findAll();
- } else {
- result = searchDAO.search(adminRoleIds, SearchCondConverter.convert(conf.getMatchingCond()),
- page, PAGE_SIZE, Collections.<OrderByClause>emptyList(), SubjectType.ROLE);
- }
-
- return result;
- }
-
- private int count() {
- Set<Long> adminRoleIds = RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll());
-
- return StringUtils.isBlank(conf.getMatchingCond())
- ? roleDAO.findAll().size()
- : searchDAO.count(adminRoleIds, SearchCondConverter.convert(conf.getMatchingCond()), SubjectType.ROLE);
- }
-
- private void doExtractResources(final ContentHandler handler, final AbstractSubjectTO subjectTO)
- throws SAXException {
-
- if (subjectTO.getResources().isEmpty()) {
- LOG.debug("No resources found for {}[{}]", subjectTO.getClass().getSimpleName(), subjectTO.getKey());
- } else {
- AttributesImpl atts = new AttributesImpl();
- handler.startElement("", "", "resources", null);
-
- for (String resourceName : subjectTO.getResources()) {
- atts.clear();
-
- atts.addAttribute("", "", ReportXMLConst.ATTR_NAME, ReportXMLConst.XSD_STRING, resourceName);
- handler.startElement("", "", "resource", atts);
- handler.endElement("", "", "resource");
- }
-
- handler.endElement("", "", "resources");
- }
- }
-
- private void doExtractAttributes(final ContentHandler handler, final AbstractAttributableTO attributableTO,
- final Collection<String> attrs, final Collection<String> derAttrs, final Collection<String> virAttrs)
- throws SAXException {
-
- AttributesImpl atts = new AttributesImpl();
- if (!attrs.isEmpty()) {
- Map<String, AttrTO> attrMap = attributableTO.getPlainAttrMap();
-
- handler.startElement("", "", "attributes", null);
- for (String attrName : attrs) {
- atts.clear();
-
- atts.addAttribute("", "", ReportXMLConst.ATTR_NAME, ReportXMLConst.XSD_STRING, attrName);
- handler.startElement("", "", "attribute", atts);
-
- if (attrMap.containsKey(attrName)) {
- for (String value : attrMap.get(attrName).getValues()) {
- handler.startElement("", "", "value", null);
- handler.characters(value.toCharArray(), 0, value.length());
- handler.endElement("", "", "value");
- }
- } else {
- LOG.debug("{} not found for {}[{}]", attrName,
- attributableTO.getClass().getSimpleName(), attributableTO.getKey());
- }
-
- handler.endElement("", "", "attribute");
- }
- handler.endElement("", "", "attributes");
- }
-
- if (!derAttrs.isEmpty()) {
- Map<String, AttrTO> derAttrMap = attributableTO.getDerAttrMap();
-
- handler.startElement("", "", "derivedAttributes", null);
- for (String attrName : derAttrs) {
- atts.clear();
-
- atts.addAttribute("", "", ReportXMLConst.ATTR_NAME, ReportXMLConst.XSD_STRING, attrName);
- handler.startElement("", "", "derivedAttribute", atts);
-
- if (derAttrMap.containsKey(attrName)) {
- for (String value : derAttrMap.get(attrName).getValues()) {
- handler.startElement("", "", "value", null);
- handler.characters(value.toCharArray(), 0, value.length());
- handler.endElement("", "", "value");
- }
- } else {
- LOG.debug("{} not found for {}[{}]", attrName,
- attributableTO.getClass().getSimpleName(), attributableTO.getKey());
- }
-
- handler.endElement("", "", "derivedAttribute");
- }
- handler.endElement("", "", "derivedAttributes");
- }
-
- if (!virAttrs.isEmpty()) {
- Map<String, AttrTO> virAttrMap = attributableTO.getVirAttrMap();
-
- handler.startElement("", "", "virtualAttributes", null);
- for (String attrName : virAttrs) {
- atts.clear();
-
- atts.addAttribute("", "", ReportXMLConst.ATTR_NAME, ReportXMLConst.XSD_STRING, attrName);
- handler.startElement("", "", "virtualAttribute", atts);
-
- if (virAttrMap.containsKey(attrName)) {
- for (String value : virAttrMap.get(attrName).getValues()) {
- handler.startElement("", "", "value", null);
- handler.characters(value.toCharArray(), 0, value.length());
- handler.endElement("", "", "value");
- }
- } else {
- LOG.debug("{} not found for {}[{}]", attrName,
- attributableTO.getClass().getSimpleName(), attributableTO.getKey());
- }
-
- handler.endElement("", "", "virtualAttribute");
- }
- handler.endElement("", "", "virtualAttributes");
- }
- }
-
- private void doExtract(final ContentHandler handler, final List<Role> roles)
- throws SAXException, ReportException {
-
- AttributesImpl atts = new AttributesImpl();
- for (Role role : roles) {
- atts.clear();
-
- for (Feature feature : conf.getFeatures()) {
- String type = null;
- String value = null;
- switch (feature) {
- case key:
- type = ReportXMLConst.XSD_LONG;
- value = String.valueOf(role.getKey());
- break;
-
- case name:
- type = ReportXMLConst.XSD_STRING;
- value = String.valueOf(role.getName());
- break;
-
- case roleOwner:
- type = ReportXMLConst.XSD_LONG;
- value = String.valueOf(role.getRoleOwner());
- break;
-
- case userOwner:
- type = ReportXMLConst.XSD_LONG;
- value = String.valueOf(role.getUserOwner());
- break;
-
- default:
- }
-
- if (type != null && value != null) {
- atts.addAttribute("", "", feature.name(), type, value);
- }
- }
-
- handler.startElement("", "", "role", atts);
-
- // Using RoleTO for attribute values, since the conversion logic of
- // values to String is already encapsulated there
- RoleTO roleTO = roleDataBinder.getRoleTO(role);
-
- doExtractAttributes(handler, roleTO, conf.getPlainAttrs(), conf.getDerAttrs(), conf.getVirAttrs());
-
- if (conf.getFeatures().contains(Feature.entitlements)) {
- handler.startElement("", "", "entitlements", null);
-
- for (String ent : roleTO.getEntitlements()) {
- atts.clear();
-
- atts.addAttribute("", "", "id", ReportXMLConst.XSD_STRING, String.valueOf(ent));
-
- handler.startElement("", "", "entitlement", atts);
- handler.endElement("", "", "entitlement");
- }
-
- handler.endElement("", "", "entitlements");
- }
- // to get resources associated to a role
- if (conf.getFeatures().contains(Feature.resources)) {
- doExtractResources(handler, roleTO);
- }
- //to get users asscoiated to a role is preferred RoleDAO to RoleTO
- if (conf.getFeatures().contains(Feature.users)) {
- handler.startElement("", "", "users", null);
-
- for (Membership memb : roleDAO.findMemberships(role)) {
- atts.clear();
-
- atts.addAttribute("", "", "key", ReportXMLConst.XSD_LONG,
- String.valueOf(memb.getUser().getKey()));
- atts.addAttribute("", "", "username", ReportXMLConst.XSD_STRING,
- String.valueOf(memb.getUser().getUsername()));
-
- handler.startElement("", "", "user", atts);
- handler.endElement("", "", "user");
- }
-
- handler.endElement("", "", "users");
- }
-
- handler.endElement("", "", "role");
- }
- }
-
- private void doExtractConf(final ContentHandler handler) throws SAXException {
- if (conf == null) {
- LOG.debug("Report configuration is not present");
- }
-
- AttributesImpl atts = new AttributesImpl();
- handler.startElement("", "", "configurations", null);
- handler.startElement("", "", "roleAttributes", atts);
-
- for (Feature feature : conf.getFeatures()) {
- atts.clear();
- handler.startElement("", "", "feature", atts);
- handler.characters(feature.name().toCharArray(), 0, feature.name().length());
- handler.endElement("", "", "feature");
- }
-
- for (String attr : conf.getPlainAttrs()) {
- atts.clear();
- handler.startElement("", "", "attribute", atts);
- handler.characters(attr.toCharArray(), 0, attr.length());
- handler.endElement("", "", "attribute");
- }
-
- for (String derAttr : conf.getDerAttrs()) {
- atts.clear();
- handler.startElement("", "", "derAttribute", atts);
- handler.characters(derAttr.toCharArray(), 0, derAttr.length());
- handler.endElement("", "", "derAttribute");
- }
-
- for (String virAttr : conf.getVirAttrs()) {
- atts.clear();
- handler.startElement("", "", "virAttribute", atts);
- handler.characters(virAttr.toCharArray(), 0, virAttr.length());
- handler.endElement("", "", "virAttribute");
- }
-
- handler.endElement("", "", "roleAttributes");
- handler.endElement("", "", "configurations");
- }
-
- @Override
- protected void doExtract(final ContentHandler handler) throws SAXException, ReportException {
- doExtractConf(handler);
- for (int i = 1; i <= (count() / PAGE_SIZE) + 1; i++) {
- doExtract(handler, getPagedRoles(i));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
index 76efe89..f0023fc 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
@@ -32,7 +32,7 @@ import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
@@ -41,7 +41,7 @@ import org.apache.syncope.core.persistence.api.entity.membership.Membership;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.misc.search.SearchCondConverter;
import org.apache.syncope.core.misc.DataFormat;
-import org.apache.syncope.core.provisioning.api.data.RoleDataBinder;
+import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
import org.springframework.beans.factory.annotation.Autowired;
import org.xml.sax.ContentHandler;
@@ -66,16 +66,16 @@ public class UserReportlet extends AbstractReportlet<UserReportletConf> {
private UserDataBinder userDataBinder;
@Autowired
- private RoleDataBinder roleDataBinder;
+ private GroupDataBinder groupDataBinder;
private List<User> getPagedUsers(final int page) {
- final Set<Long> adminRoleIds = RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll());
+ final Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
final List<User> result;
if (StringUtils.isBlank(conf.getMatchingCond())) {
- result = userDAO.findAll(adminRoleIds, page, PAGE_SIZE);
+ result = userDAO.findAll(adminGroupIds, page, PAGE_SIZE);
} else {
- result = searchDAO.search(adminRoleIds, SearchCondConverter.convert(conf.getMatchingCond()),
+ result = searchDAO.search(adminGroupIds, SearchCondConverter.convert(conf.getMatchingCond()),
page, PAGE_SIZE, Collections.<OrderByClause>emptyList(), SubjectType.USER);
}
@@ -83,11 +83,11 @@ public class UserReportlet extends AbstractReportlet<UserReportletConf> {
}
private int count() {
- Set<Long> adminRoleIds = RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll());
+ Set<Long> adminGroupIds = GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll());
return StringUtils.isBlank(conf.getMatchingCond())
- ? userDAO.count(adminRoleIds)
- : searchDAO.count(adminRoleIds, SearchCondConverter.convert(conf.getMatchingCond()), SubjectType.USER);
+ ? userDAO.count(adminGroupIds)
+ : searchDAO.count(adminGroupIds, SearchCondConverter.convert(conf.getMatchingCond()), SubjectType.USER);
}
private void doExtractResources(final ContentHandler handler, final AbstractSubjectTO subjectTO)
@@ -280,20 +280,20 @@ public class UserReportlet extends AbstractReportlet<UserReportletConf> {
atts.clear();
atts.addAttribute("", "", "id", ReportXMLConst.XSD_LONG, String.valueOf(memb.getKey()));
- atts.addAttribute("", "", "roleId", ReportXMLConst.XSD_LONG, String.valueOf(memb.getRoleId()));
- atts.addAttribute("", "", "roleName", ReportXMLConst.XSD_STRING, String.valueOf(memb.getRoleName()));
+ atts.addAttribute("", "", "groupId", ReportXMLConst.XSD_LONG, String.valueOf(memb.getGroupId()));
+ atts.addAttribute("", "", "groupName", ReportXMLConst.XSD_STRING, String.valueOf(memb.getGroupName()));
handler.startElement("", "", "membership", atts);
doExtractAttributes(handler, memb, memb.getPlainAttrMap().keySet(), memb.getDerAttrMap()
.keySet(), memb.getVirAttrMap().keySet());
if (conf.getFeatures().contains(Feature.resources)) {
- Membership actualMemb = user.getMembership(memb.getRoleId());
+ Membership actualMemb = user.getMembership(memb.getGroupId());
if (actualMemb == null) {
- LOG.warn("Unexpected: cannot find membership for role {} for user {}", memb.getRoleId(),
+ LOG.warn("Unexpected: cannot find membership for group {} for user {}", memb.getGroupId(),
user);
} else {
- doExtractResources(handler, roleDataBinder.getRoleTO(actualMemb.getRole()));
+ doExtractResources(handler, groupDataBinder.getGroupTO(actualMemb.getGroup()));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/groupReportlet2csv.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/groupReportlet2csv.xsl b/core/logic/src/main/resources/report/groupReportlet2csv.xsl
new file mode 100644
index 0000000..06730dc
--- /dev/null
+++ b/core/logic/src/main/resources/report/groupReportlet2csv.xsl
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+ <xsl:variable name="delimiter" select="';'"/>
+
+ <xsl:template match="reportlet[@class='org.apache.syncope.core.report.GroupReportlet']">
+
+ <xsl:call-template name="header">
+ <xsl:with-param name="node" select="configurations/groupAttributes"/>
+ </xsl:call-template>
+ <xsl:for-each select="group">
+ <xsl:call-template name="groupAttributes">
+ <xsl:with-param name="header" select="../configurations/groupAttributes"/>
+ <xsl:with-param name="attrs" select="."/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="header">
+ <xsl:param name="node"/>
+ <xsl:for-each select="$node/*">
+ <xsl:value-of select="text()"/>
+ <xsl:if test="position() != last()">
+ <xsl:value-of select="$delimiter"/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template name="groupAttributes">
+ <xsl:param name="header"/>
+ <xsl:param name="attrs"/>
+
+ <xsl:for-each select="$header/*">
+ <xsl:variable name="nameAttr" select="text()"/>
+
+ <xsl:choose>
+ <xsl:when test="string-length($attrs/@*[name()=$nameAttr]) > 0">
+ <xsl:variable name="groupAttr" select="$attrs/@*[name()=$nameAttr]"/>
+ <xsl:text>"</xsl:text>
+ <xsl:value-of select="$groupAttr/."/>
+ <xsl:text>"</xsl:text>
+ </xsl:when>
+ <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='entitlement'])
+ and count($attrs/*[name(.)=$nameAttr]/node()) > 0">
+ <xsl:text>"</xsl:text>
+ <xsl:for-each select="$attrs/*/entitlement">
+ <xsl:variable name="value" select="@id"/>
+ <xsl:value-of select="$value"/>
+ <xsl:if test="position() != last()">
+ <xsl:value-of select="$delimiter"/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text>"</xsl:text>
+ </xsl:when>
+ <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='resource'])
+ and count($attrs/*[name(.)=$nameAttr]/node()) > 0">
+ <xsl:text>"</xsl:text>
+ <xsl:for-each select="$attrs/*/resource">
+ <xsl:variable name="value" select="@name"/>
+ <xsl:value-of select="$value"/>
+ <xsl:if test="position() != last()">
+ <xsl:value-of select="$delimiter"/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text>"</xsl:text>
+ </xsl:when>
+ <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='user'])
+ and count($attrs/*[name(.)=$nameAttr]/node()) > 0">
+ <xsl:text>"</xsl:text>
+ <xsl:for-each select="$attrs/*/user">
+ <xsl:variable name="value" select="@userUsername"/>
+ <xsl:value-of select="$value"/>
+ <xsl:if test="position() != last()">
+ <xsl:value-of select="$delimiter"/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text>"</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>"</xsl:text>
+ <xsl:if test="string-length($attrs/*/*[@name=$nameAttr]/value/text()) > 0">
+ <xsl:variable name="value" select="$attrs/*/*[@name=$nameAttr]/value/text()"/>
+ <xsl:value-of select="$value"/>
+ </xsl:if>
+ <xsl:text>"</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="position() != last()">
+ <xsl:value-of select="$delimiter"/>
+ </xsl:if>
+
+ </xsl:for-each>
+ </xsl:template>
+
+</xsl:stylesheet>
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/groupReportlet2fo.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/groupReportlet2fo.xsl b/core/logic/src/main/resources/report/groupReportlet2fo.xsl
new file mode 100644
index 0000000..c83eb31
--- /dev/null
+++ b/core/logic/src/main/resources/report/groupReportlet2fo.xsl
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <xsl:template match="reportlet[@class='org.apache.syncope.core.report.GroupReportlet']">
+
+ <fo:block font-size="16pt" font-weight="bold" space-after="0.5cm" space-before="5mm">Reportlet: <xsl:value-of select="@name"/></fo:block>
+
+ <xsl:for-each select="group">
+ <fo:block font-size="14pt" font-weight="bold" space-before="15mm" space-after="5mm" background-color="(#8888ff)">Group <xsl:value-of select="@name"/></fo:block>
+ <fo:table table-layout="fixed" space-after="7mm">
+ <fo:table-column/>
+ <fo:table-column/>
+ <fo:table-body>
+ <fo:table-row background-color="(#ccccff)">
+ <fo:table-cell>
+ <fo:block>Id:</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block font-style="italic">
+ <xsl:value-of select="@id"/>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ <xsl:if test="@groupOwner != 'null'">
+ <fo:table-row background-color="(#ccccff)">
+ <fo:table-cell>
+ <fo:block>Group Owner:</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block font-style="italic">
+ <xsl:value-of select="@groupOwner"/>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </xsl:if>
+ <xsl:if test="@userOwner != 'null'">
+ <fo:table-row background-color="(#ccccff)">
+ <fo:table-cell>
+ <fo:block>Last Login Date:</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block font-style="italic">
+ <xsl:value-of select="@userOwner"/>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </xsl:if>
+ </fo:table-body>
+ </fo:table>
+ <xsl:choose>
+ <xsl:when test="string-length(attributes/attribute) > 0">
+ <xsl:call-template name="attributes">
+ <xsl:with-param name="label">Attributes</xsl:with-param>
+ <xsl:with-param name="node" select="attributes/attribute"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:block color="red" font-size="9pt" space-after="3mm">THIS GROUP HASN'T ANY ATTRIBUTE</fo:block>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0">
+ <xsl:call-template name="attributes">
+ <xsl:with-param name="label">Derived Attributes</xsl:with-param>
+ <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:block color="red" font-size="9pt" space-after="3mm">THIS GROUP HASN'T ANY DERIVED ATTRIBUTE</fo:block>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0">
+ <xsl:call-template name="attributes">
+ <xsl:with-param name="label">Virtual Attributes</xsl:with-param>
+ <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:block color="red" font-size="9pt" space-after="3mm">THIS GROUP HASN'T ANY VIRTUAL ATTRIBUTE</fo:block>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!--entitlements-->
+ <xsl:choose>
+ <xsl:when test="entitlements/entitlement">
+ <xsl:call-template name="entitlements">
+ <xsl:with-param name="label">Entitlements</xsl:with-param>
+ <xsl:with-param name="node" select="entitlements/entitlement"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:block color="red" font-size="9pt" space-after="3mm">THIS GROUP HASN'T ANY ENTITLEMENT</fo:block>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="users/user">
+ <fo:block font-size="11pt" font-weight="bold">Users</fo:block>
+ <xsl:for-each select="users/user">
+ <fo:block background-color="(#ccccff)" font-size="9pt" font-weight="bold" space-before="4mm">User: <xsl:value-of select="@userUsername"/> (Id: <xsl:value-of select="@userId"/>)</fo:block>
+
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:block color="red" font-size="9pt" space-after="3mm">THIS GROUP HASN'T ANY USER ASSIGNED TO</fo:block>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="groupResources">
+ <xsl:with-param name="node" select="resources/resource"/>
+ </xsl:call-template>
+ </xsl:for-each>
+
+ </xsl:template>
+
+ <xsl:template name="attributes">
+ <xsl:param name="label"/>
+ <xsl:param name="node"/>
+ <fo:block font-size="11pt" font-weight="bold" space-after="2mm">
+ <xsl:value-of select="$label"/>
+ </fo:block>
+ <fo:table table-layout="fixed" space-after="7mm">
+ <fo:table-column/>
+ <fo:table-column/>
+ <fo:table-header>
+ <fo:table-row height="7mm" background-color="(#ccccba)">
+ <fo:table-cell>
+ <fo:block font-weight="bold">Schema name</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block font-weight="bold">Value(s)</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-header>
+ <fo:table-body>
+ <xsl:for-each select="$node">
+ <xsl:if test="string-length(value/text()) > 0">
+ <fo:table-row height="4mm" background-color="(#ccccff)">
+ <fo:table-cell>
+ <fo:block>
+ <xsl:value-of select="@name"/>
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <xsl:for-each select="value">
+ <fo:block></fo:block><!-- <fo:block>•</fo:block>-->
+ <fo:block font-style="italic">
+ <xsl:value-of select="text()"/>
+ </fo:block>
+ </xsl:for-each>
+ </fo:table-cell>
+ </fo:table-row>
+ </xsl:if>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block></fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block></fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </xsl:for-each>
+ </fo:table-body>
+ </fo:table>
+ </xsl:template>
+ <!--entitlements template-->
+ <xsl:template name="entitlements">
+ <xsl:param name="label"/>
+ <xsl:param name="node"/>
+ <fo:block font-size="11pt" font-weight="bold" space-after="2mm" space-before="5mm">
+ <xsl:value-of select="$label"/>
+ </fo:block>
+ <fo:table table-layout="fixed" space-after="7mm">
+ <fo:table-column/>
+ <!--<fo:table-column/>-->
+ <fo:table-header>
+ <fo:table-row height="7mm" background-color="(#ccccba)">
+ <fo:table-cell>
+ <fo:block font-weight="bold">Name</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-header>
+ <fo:table-body>
+ <xsl:for-each select="$node">
+ <fo:table-row height="4mm" background-color="(#ccccff)">
+ <fo:table-cell>
+ <fo:block>
+ <xsl:value-of select="@id"/>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </xsl:for-each>
+ </fo:table-body>
+ </fo:table>
+ </xsl:template>
+
+ <xsl:template name="groupResources">
+ <xsl:param name="node"/>
+ <fo:block font-size="11pt" font-weight="bold" space-after="3mm" space-before="5mm">Group Resources</fo:block>
+ <xsl:for-each select="$node">
+ <fo:block></fo:block> <!-- <fo:block>•</fo:block>-->
+ <fo:block background-color="(#ccccff)">
+ <xsl:value-of select="@name"/>
+ </fo:block>
+ </xsl:for-each>
+ </xsl:template>
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/groupReportlet2html.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/groupReportlet2html.xsl b/core/logic/src/main/resources/report/groupReportlet2html.xsl
new file mode 100644
index 0000000..ce36c6b
--- /dev/null
+++ b/core/logic/src/main/resources/report/groupReportlet2html.xsl
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+ <xsl:template match="reportlet[@class='org.apache.syncope.core.report.GroupReportlet']">
+ <h2>Reportlet: <xsl:value-of select="@name"/></h2>
+ <xsl:for-each select="group">
+ <h3>Group <xsl:value-of select="@name"/></h3>
+
+ <table style="border: 1px solid black;">
+ <tr>
+ <td>Id:</td>
+ <td>
+ <xsl:value-of select="@id"/>
+ </td>
+ </tr>
+ <xsl:if test="@groupOwner != 'null'"> <!--!= null test="not(USER/FIRSTNAME)" -->
+ <tr>
+ <td>Group Owner:</td>
+ <td>
+ <xsl:value-of select="@groupOwner"/>
+ </td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@userOwner != 'null'">
+ <tr>
+ <td>User Owner:</td>
+ <td>
+ <xsl:value-of select="@userOwner"/>
+ </td>
+ </tr>
+ </xsl:if>
+
+ </table>
+
+ <xsl:choose>
+ <xsl:when test="string-length(attributes/attribute) > 0">
+ <xsl:call-template name="attributes">
+ <xsl:with-param name="label">Attributes</xsl:with-param>
+ <xsl:with-param name="node" select="attributes/attribute"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <h5>THIS GROUP HASN'T ANY ATTRIBUTE</h5>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0">
+ <xsl:call-template name="attributes">
+ <xsl:with-param name="label">Derived Attributes</xsl:with-param>
+ <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <h5>THIS GROUP HASN'T ANY DERIVED ATTRIBUTE</h5>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--</xsl:if>-->
+ <xsl:choose>
+ <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0">
+ <xsl:call-template name="attributes">
+ <xsl:with-param name="label">Virtual Attributes</xsl:with-param>
+ <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <h5>THIS GROUP HASN'T ANY VIRTUAL ATTRIBUTE</h5>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="entitlements/entitlement">
+ <xsl:call-template name="entitlements">
+ <xsl:with-param name="label">Entitlements: </xsl:with-param>
+ <xsl:with-param name="node" select="entitlements/entitlement"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <h5>THIS GROUP HASN'T ANY ENTITLEMENT</h5>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="users/user">
+ <h4>Users</h4>
+ <xsl:for-each select="users/user">
+ <h5>User: <xsl:value-of select="@userUsername"/> (Id: <xsl:value-of select="@userId"/>)</h5>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <h5>THIS GROUP HASN'T ANY USER ASSIGNED TO</h5>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:call-template name="groupResources">
+ <xsl:with-param name="node" select="resources/resource"/>
+ </xsl:call-template>
+ <hr/>
+
+ </xsl:for-each>
+ </xsl:template>
+
+ <!--entitlement template-->
+ <xsl:template name="entitlements">
+ <xsl:param name="label"/>
+ <xsl:param name="node"/>
+
+ <h4>
+ <xsl:value-of select="$label"/>
+ </h4>
+
+ <table>
+
+ <tbody>
+ <xsl:for-each select="$node">
+ <tr>
+ <td>
+ <xsl:value-of select="@id"/>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:template>
+
+
+ <xsl:template name="attributes">
+ <xsl:param name="label"/>
+ <xsl:param name="node"/>
+
+ <h4>
+ <xsl:value-of select="$label"/>
+ </h4>
+
+ <table>
+ <thead>
+ <tr>
+ <th>Schema name</th>
+ <th>Value(s)</th>
+ </tr>
+ </thead>
+ <tbody>
+ <xsl:for-each select="$node">
+ <xsl:if test="string-length(value/text()) > 0">
+ <tr>
+ <td>
+ <xsl:value-of select="@name"/>
+ </td>
+ <td>
+ <ul>
+ <xsl:for-each select="value">
+ <li>
+ <xsl:value-of select="text()"/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </td>
+ </tr>
+ </xsl:if>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:template>
+
+ <xsl:template name="groupResources">
+ <xsl:param name="node"/>
+
+ <h4>Group Resources</h4>
+ <ul>
+ <xsl:for-each select="$node">
+ <li>
+ <xsl:value-of select="@name"/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:template>
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/report2csv.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/report2csv.xsl b/core/logic/src/main/resources/report/report2csv.xsl
index b1e2c71..a7a0a42 100644
--- a/core/logic/src/main/resources/report/report2csv.xsl
+++ b/core/logic/src/main/resources/report/report2csv.xsl
@@ -21,7 +21,7 @@ under the License.
version="1.0">
<xsl:import href="userReportlet2csv.xsl"/>
- <xsl:import href="roleReportlet2csv.xsl"/>
+ <xsl:import href="groupReportlet2csv.xsl"/>
<xsl:import href="staticReportlet2csv.xsl"/>
<xsl:param name="status"/>
@@ -33,4 +33,4 @@ under the License.
<xsl:apply-templates/>
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/report2fo.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/report2fo.xsl b/core/logic/src/main/resources/report/report2fo.xsl
index 7da9cab..e8dcefc 100644
--- a/core/logic/src/main/resources/report/report2fo.xsl
+++ b/core/logic/src/main/resources/report/report2fo.xsl
@@ -22,7 +22,7 @@ under the License.
version="1.0">
<xsl:import href="userReportlet2fo.xsl"/>
- <xsl:import href="roleReportlet2fo.xsl"/>
+ <xsl:import href="groupReportlet2fo.xsl"/>
<xsl:import href="staticReportlet2fo.xsl"/>
<xsl:param name="status"/>
@@ -94,4 +94,4 @@ under the License.
</fo:root>
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/report2html.xsl
----------------------------------------------------------------------
diff --git a/core/logic/src/main/resources/report/report2html.xsl b/core/logic/src/main/resources/report/report2html.xsl
index c1d6b67..e18f70d 100644
--- a/core/logic/src/main/resources/report/report2html.xsl
+++ b/core/logic/src/main/resources/report/report2html.xsl
@@ -21,7 +21,7 @@ under the License.
version="1.0">
<xsl:import href="userReportlet2html.xsl"/>
- <xsl:import href="roleReportlet2html.xsl"/>
+ <xsl:import href="groupReportlet2html.xsl"/>
<xsl:import href="staticReportlet2html.xsl"/>
<xsl:param name="status"/>
@@ -74,4 +74,4 @@ under the License.
</html>
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
[45/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
----------------------------------------------------------------------
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 e6dcc7b..720b875 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
@@ -19,14 +19,12 @@
package org.apache.syncope.core.persistence.jpa.entity.group;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
-import javax.persistence.Basic;
import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
+import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
@@ -36,50 +34,35 @@ import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
import javax.validation.Valid;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.collections4.Transformer;
-import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.Schema;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
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.jpa.validation.entity.GroupCheck;
import org.apache.syncope.core.persistence.jpa.entity.AbstractSubject;
-import org.apache.syncope.core.persistence.jpa.entity.JPAAccountPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.JPAEntitlement;
import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
-import org.apache.syncope.core.persistence.jpa.entity.JPAPasswordPolicy;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
@Entity
-@Table(name = JPAGroup.TABLE, uniqueConstraints =
- @UniqueConstraint(columnNames = { "name", "parent_id" }))
+@Table(name = JPAGroup.TABLE)
@Cacheable
@GroupCheck
public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> implements Group {
@@ -91,36 +74,27 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
@Id
private Long id;
+ @Column(unique = true)
@NotNull
private String name;
- @ManyToOne(optional = true)
- private JPAGroup parent;
-
- @ManyToOne(optional = true)
+ @ManyToOne
private JPAUser userOwner;
- @ManyToOne(optional = true)
+ @ManyToOne
private JPAGroup groupOwner;
- @ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(joinColumns =
- @JoinColumn(name = "group_id"),
- inverseJoinColumns =
- @JoinColumn(name = "entitlement_name"))
- private Set<JPAEntitlement> entitlements;
-
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
@Valid
- private List<JPAGPlainAttrTemplate> rAttrTemplates;
+ private List<JPAGPlainAttrTemplate> gAttrTemplates;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
@Valid
- private List<JPAGDerAttrTemplate> rDerAttrTemplates;
+ private List<JPAGDerAttrTemplate> gDerAttrTemplates;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
@Valid
- private List<JPAGVirAttrTemplate> rVirAttrTemplates;
+ private List<JPAGVirAttrTemplate> gVirAttrTemplates;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
@Valid
@@ -146,47 +120,6 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
@Valid
private List<JPAGVirAttr> virAttrs;
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritOwner;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritTemplates;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritPlainAttrs;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritDerAttrs;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritVirAttrs;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritPasswordPolicy;
-
- @Basic(optional = true)
- @Min(0)
- @Max(1)
- private Integer inheritAccountPolicy;
-
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
- private JPAPasswordPolicy passwordPolicy;
-
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
- private JPAAccountPolicy accountPolicy;
-
/**
* Provisioning external resources.
*/
@@ -201,11 +134,9 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
public JPAGroup() {
super();
- entitlements = new HashSet<>();
-
- rAttrTemplates = new ArrayList<>();
- rDerAttrTemplates = new ArrayList<>();
- rVirAttrTemplates = new ArrayList<>();
+ gAttrTemplates = new ArrayList<>();
+ gDerAttrTemplates = new ArrayList<>();
+ gVirAttrTemplates = new ArrayList<>();
mAttrTemplates = new ArrayList<>();
mDerAttrTemplates = new ArrayList<>();
mVirAttrTemplates = new ArrayList<>();
@@ -214,14 +145,6 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
derAttrs = new ArrayList<>();
virAttrs = new ArrayList<>();
- inheritOwner = getBooleanAsInteger(false);
- inheritTemplates = getBooleanAsInteger(false);
- inheritPlainAttrs = getBooleanAsInteger(false);
- inheritDerAttrs = getBooleanAsInteger(false);
- inheritVirAttrs = getBooleanAsInteger(false);
- inheritPasswordPolicy = getBooleanAsInteger(false);
- inheritAccountPolicy = getBooleanAsInteger(false);
-
resources = new HashSet<>();
}
@@ -246,27 +169,6 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
}
@Override
- public Group getParent() {
- return parent;
- }
-
- @Override
- public void setParent(final Group parent) {
- checkType(parent, JPAGroup.class);
- this.parent = (JPAGroup) parent;
- }
-
- @Override
- public boolean isInheritOwner() {
- return isBooleanAsInteger(inheritOwner);
- }
-
- @Override
- public void setInheritOwner(final boolean inheritOwner) {
- this.inheritOwner = getBooleanAsInteger(inheritOwner);
- }
-
- @Override
public User getUserOwner() {
return userOwner;
}
@@ -289,43 +191,16 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
}
@Override
- public boolean addEntitlement(final Entitlement entitlement) {
- checkType(entitlement, JPAEntitlement.class);
- return entitlements.add((JPAEntitlement) entitlement);
- }
-
- @Override
- public boolean removeEntitlement(final Entitlement entitlement) {
- checkType(entitlement, JPAEntitlement.class);
- return entitlements.remove((JPAEntitlement) entitlement);
- }
-
- @Override
- public Set<? extends Entitlement> getEntitlements() {
- return entitlements;
- }
-
- @Override
- public boolean isInheritTemplates() {
- return isBooleanAsInteger(inheritTemplates);
- }
-
- @Override
- public void setInheritTemplates(final boolean inheritAttrTemplates) {
- this.inheritTemplates = getBooleanAsInteger(inheritAttrTemplates);
- }
-
- @Override
@SuppressWarnings("unchecked")
public <T extends AttrTemplate<K>, K extends Schema> List<T> getAttrTemplates(final Class<T> reference) {
List<T> result = new ArrayList<>();
if (GPlainAttrTemplate.class.isAssignableFrom(reference)) {
- result = (List<T>) rAttrTemplates;
+ result = (List<T>) gAttrTemplates;
} else if (GDerAttrTemplate.class.isAssignableFrom(reference)) {
- result = (List<T>) rDerAttrTemplates;
+ result = (List<T>) gDerAttrTemplates;
} else if (GVirAttrTemplate.class.isAssignableFrom(reference)) {
- result = (List<T>) rVirAttrTemplates;
+ result = (List<T>) gVirAttrTemplates;
} else if (MPlainAttrTemplate.class.isAssignableFrom(reference)) {
result = (List<T>) mAttrTemplates;
} else if (MDerAttrTemplate.class.isAssignableFrom(reference)) {
@@ -341,7 +216,7 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
public <T extends AttrTemplate<K>, K extends Schema> T getAttrTemplate(
final Class<T> reference, final String schemaName) {
- return CollectionUtils.find(findInheritedTemplates(reference), new Predicate<T>() {
+ return CollectionUtils.find(getAttrTemplates(reference), new Predicate<T>() {
@Override
public boolean evaluate(final T template) {
@@ -352,7 +227,7 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
@Override
public <T extends AttrTemplate<K>, K extends Schema> List<K> getAttrTemplateSchemas(final Class<T> reference) {
- return CollectionUtils.collect(findInheritedTemplates(reference), new Transformer<T, K>() {
+ return CollectionUtils.collect(getAttrTemplates(reference), new Transformer<T, K>() {
@Override
public K transform(final T input) {
@@ -362,17 +237,6 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
}
@Override
- public <T extends AttrTemplate<K>, K extends Schema> List<T> findInheritedTemplates(final Class<T> reference) {
- final List<T> result = new ArrayList<>(getAttrTemplates(reference));
-
- if (isInheritTemplates() && getParent() != null) {
- result.addAll(getParent().findInheritedTemplates(reference));
- }
-
- return result;
- }
-
- @Override
public boolean addPlainAttr(final GPlainAttr attr) {
checkType(attr, JPAGPlainAttr.class);
return plainAttrs.add((JPAGPlainAttr) attr);
@@ -422,172 +286,4 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im
public List<? extends GVirAttr> getVirAttrs() {
return virAttrs;
}
-
- @Override
- public boolean isInheritPlainAttrs() {
- return isBooleanAsInteger(inheritPlainAttrs);
- }
-
- @Override
- public void setInheritPlainAttrs(final boolean inheritPlainAttrs) {
- this.inheritPlainAttrs = getBooleanAsInteger(inheritPlainAttrs);
- }
-
- /**
- * Get all inherited attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- @Override
- public List<? extends GPlainAttr> findLastInheritedAncestorPlainAttrs() {
- if (!isInheritPlainAttrs()) {
- return plainAttrs;
- }
-
- final Map<JPAGPlainSchema, GPlainAttr> result = new HashMap<>();
- if (isInheritPlainAttrs() && getParent() != null) {
- final Map<PlainSchema, GPlainAttr> attrMap = getPlainAttrMap();
-
- // Add inherit attributes
- for (GPlainAttr attr : getParent().findLastInheritedAncestorPlainAttrs()) {
- if (attrMap.containsKey(attr.getSchema())) {
- result.remove((JPAGPlainSchema) attr.getSchema());
- }
- result.put((JPAGPlainSchema) attr.getSchema(), attr);
- }
- }
- return new ArrayList<>(result.values());
- }
-
- @Override
- public boolean isInheritDerAttrs() {
- return isBooleanAsInteger(inheritDerAttrs);
- }
-
- @Override
- public void setInheritDerAttrs(final boolean inheritDerAttrs) {
- this.inheritDerAttrs = getBooleanAsInteger(inheritDerAttrs);
-
- }
-
- /**
- * Get all inherited derived attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- @Override
- public List<? extends GDerAttr> findLastInheritedAncestorDerAttrs() {
- if (!isInheritDerAttrs()) {
- return derAttrs;
- }
-
- final Map<GDerSchema, GDerAttr> result = new HashMap<>();
- if (isInheritDerAttrs() && getParent() != null) {
- Map<DerSchema, GDerAttr> derAttrMap = getDerAttrMap();
-
- // Add inherit derived attributes
- for (GDerAttr attr : getParent().findLastInheritedAncestorDerAttrs()) {
- if (derAttrMap.containsKey(attr.getSchema())) {
- result.remove(attr.getSchema());
- }
- result.put(attr.getSchema(), attr);
- }
- }
- return new ArrayList<>(result.values());
- }
-
- @Override
- public boolean isInheritVirAttrs() {
- return isBooleanAsInteger(inheritVirAttrs);
- }
-
- @Override
- public void setInheritVirAttrs(final boolean inheritVirAttrs) {
- this.inheritVirAttrs = getBooleanAsInteger(inheritVirAttrs);
-
- }
-
- /**
- * Get all inherited virtual attributes from the ancestors.
- *
- * @return a list of inherited and only inherited attributes.
- */
- @Override
- public List<? extends GVirAttr> findLastInheritedAncestorVirAttrs() {
- if (!isInheritVirAttrs()) {
- return virAttrs;
- }
-
- final Map<GVirSchema, GVirAttr> result = new HashMap<>();
- if (isInheritVirAttrs() && getParent() != null) {
- Map<VirSchema, GVirAttr> virAttrMap = getVirAttrMap();
-
- // Add inherit virtual attributes
- for (GVirAttr attr : getParent().findLastInheritedAncestorVirAttrs()) {
- if (virAttrMap.containsKey(attr.getSchema())) {
- result.remove(attr.getSchema());
- }
- result.put(attr.getSchema(), attr);
- }
- }
- return new ArrayList<>(result.values());
- }
-
- /**
- * Get first valid password policy.
- *
- * @return parent password policy if isInheritPasswordPolicy is 'true' and parent is not null, local password policy
- * otherwise
- */
- @Override
- public PasswordPolicy getPasswordPolicy() {
- return isInheritPasswordPolicy() && getParent() != null
- ? getParent().getPasswordPolicy()
- : passwordPolicy;
- }
-
- @Override
- public void setPasswordPolicy(final PasswordPolicy passwordPolicy) {
- checkType(passwordPolicy, JPAPasswordPolicy.class);
- this.passwordPolicy = (JPAPasswordPolicy) passwordPolicy;
- }
-
- @Override
- public boolean isInheritPasswordPolicy() {
- return isBooleanAsInteger(inheritPasswordPolicy);
- }
-
- @Override
- public void setInheritPasswordPolicy(final boolean inheritPasswordPolicy) {
- this.inheritPasswordPolicy = getBooleanAsInteger(inheritPasswordPolicy);
- }
-
- /**
- * Get first valid account policy.
- *
- * @return parent account policy if isInheritAccountPolicy is 'true' and parent is not null, local account policy
- * otherwise.
- */
- @Override
- public AccountPolicy getAccountPolicy() {
- return isInheritAccountPolicy() && getParent() != null
- ? getParent().getAccountPolicy()
- : accountPolicy;
- }
-
- @Override
- public void setAccountPolicy(final AccountPolicy accountPolicy) {
- checkType(accountPolicy, JPAAccountPolicy.class);
- this.accountPolicy = (JPAAccountPolicy) accountPolicy;
- }
-
- @Override
- public boolean isInheritAccountPolicy() {
- return isBooleanAsInteger(inheritAccountPolicy);
- }
-
- @Override
- public void setInheritAccountPolicy(boolean inheritAccountPolicy) {
- this.inheritAccountPolicy = getBooleanAsInteger(inheritAccountPolicy);
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
index ad79250..dc02cf3 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
@@ -37,6 +37,7 @@ import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.jpa.entity.AbstractAttributable;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
@@ -108,9 +109,28 @@ public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MV
}
@Override
- public boolean addPlainAttr(final MPlainAttr attr) {
- checkType(attr, JPAMPlainAttr.class);
- return plainAttrs.add((JPAMPlainAttr) attr);
+ public boolean addPlainAttr(final MPlainAttr plainAttr) {
+ checkType(plainAttr, JPAMPlainAttr.class);
+
+ if (getGroup() != null && plainAttr.getSchema() != null) {
+ MPlainAttrTemplate found = CollectionUtils.find(getGroup().getAttrTemplates(MPlainAttrTemplate.class),
+ new Predicate<MPlainAttrTemplate>() {
+
+ @Override
+ public boolean evaluate(final MPlainAttrTemplate template) {
+ return plainAttr.getSchema().equals(template.getSchema());
+ }
+
+ });
+ if (found != null) {
+ plainAttr.setTemplate(found);
+ return plainAttrs.add((JPAMPlainAttr) plainAttr);
+ }
+ }
+
+ LOG.warn("Attribute not added because either group was not yet set, "
+ + "schema was not specified or no template for that schema is available");
+ return false;
}
@Override
@@ -129,7 +149,7 @@ public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MV
checkType(derAttr, JPAMDerAttr.class);
if (getGroup() != null && derAttr.getSchema() != null) {
- MDerAttrTemplate found = CollectionUtils.find(getGroup().findInheritedTemplates(MDerAttrTemplate.class),
+ MDerAttrTemplate found = CollectionUtils.find(getGroup().getAttrTemplates(MDerAttrTemplate.class),
new Predicate<MDerAttrTemplate>() {
@Override
@@ -166,7 +186,7 @@ public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, MV
if (getGroup() != null && virAttr.getSchema() != null) {
MVirAttrTemplate found = null;
- for (MVirAttrTemplate template : getGroup().findInheritedTemplates(MVirAttrTemplate.class)) {
+ for (MVirAttrTemplate template : getGroup().getAttrTemplates(MVirAttrTemplate.class)) {
if (virAttr.getSchema().equals(template.getSchema())) {
found = template;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java
index b26bb0c..f98074d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java
@@ -29,6 +29,7 @@ import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import org.apache.syncope.common.lib.to.GroupTO;
@@ -37,6 +38,8 @@ import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
import org.apache.syncope.core.provisioning.api.job.SyncJob;
import org.apache.syncope.core.misc.serialization.POJOHelper;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.jpa.entity.JPARealm;
@Entity
@DiscriminatorValue("SyncTask")
@@ -44,6 +47,9 @@ public class JPASyncTask extends AbstractProvisioningTask implements SyncTask {
private static final long serialVersionUID = -4141057723006682563L;
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ private JPARealm destinationRealm;
+
@ElementCollection(fetch = FetchType.EAGER)
@Column(name = "actionClassName")
@CollectionTable(name = "SyncTask_actionsClassNames",
@@ -70,6 +76,17 @@ public class JPASyncTask extends AbstractProvisioningTask implements SyncTask {
}
@Override
+ public Realm getDestinatioRealm() {
+ return destinationRealm;
+ }
+
+ @Override
+ public void setDestinationRealm(final Realm destinationRealm) {
+ checkType(destinationRealm, JPARealm.class);
+ this.destinationRealm = (JPARealm) destinationRealm;
+ }
+
+ @Override
public List<String> getActionsClassNames() {
return actionsClassNames;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtil.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtil.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtil.java
deleted file mode 100644
index c2f5e86..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtil.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.core.persistence.jpa.entity.task;
-
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
-import org.apache.syncope.common.lib.to.NotificationTaskTO;
-import org.apache.syncope.common.lib.to.PropagationTaskTO;
-import org.apache.syncope.common.lib.to.PushTaskTO;
-import org.apache.syncope.common.lib.to.SchedTaskTO;
-import org.apache.syncope.common.lib.to.SyncTaskTO;
-import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
-import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-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.task.SyncTask;
-import org.apache.syncope.core.persistence.api.entity.task.Task;
-import org.apache.syncope.core.persistence.api.entity.task.TaskUtil;
-
-@SuppressWarnings("unchecked")
-public final class JPATaskUtil implements TaskUtil {
-
- private final TaskType type;
-
- protected JPATaskUtil(final TaskType type) {
- this.type = type;
- }
-
- @Override
- public TaskType getType() {
- return type;
- }
-
- @Override
- public <T extends Task> Class<T> taskClass() {
- Class<T> result = null;
-
- switch (type) {
- case PROPAGATION:
- result = (Class<T>) PropagationTask.class;
- break;
-
- case SCHEDULED:
- result = (Class<T>) SchedTask.class;
- break;
-
- case SYNCHRONIZATION:
- result = (Class<T>) SyncTask.class;
- break;
-
- case PUSH:
- result = (Class<T>) PushTask.class;
- break;
-
- case NOTIFICATION:
- result = (Class<T>) NotificationTask.class;
- break;
-
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends Task> T newTask() {
- T result = null;
-
- switch (type) {
- case PROPAGATION:
- result = (T) new JPAPropagationTask();
- break;
-
- case SCHEDULED:
- result = (T) new JPASchedTask();
- break;
-
- case SYNCHRONIZATION:
- result = (T) new JPASyncTask();
- break;
-
- case PUSH:
- result = (T) new JPAPushTask();
- break;
-
- case NOTIFICATION:
- result = (T) new JPANotificationTask();
- break;
-
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AbstractTaskTO> Class<T> taskTOClass() {
- Class<T> result = null;
-
- switch (type) {
- case PROPAGATION:
- result = (Class<T>) PropagationTaskTO.class;
- break;
-
- case SCHEDULED:
- result = (Class<T>) SchedTaskTO.class;
- break;
-
- case SYNCHRONIZATION:
- result = (Class<T>) SyncTaskTO.class;
- break;
-
- case PUSH:
- result = (Class<T>) PushTaskTO.class;
- break;
-
- case NOTIFICATION:
- result = (Class<T>) NotificationTaskTO.class;
- break;
-
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AbstractTaskTO> T newTaskTO() {
- final Class<T> taskClass = taskTOClass();
- try {
- return taskClass == null ? null : taskClass.newInstance();
- } catch (Exception e) {
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilFactory.java
deleted file mode 100644
index bdda208..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilFactory.java
+++ /dev/null
@@ -1,91 +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.task;
-
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
-import org.apache.syncope.common.lib.to.NotificationTaskTO;
-import org.apache.syncope.common.lib.to.PropagationTaskTO;
-import org.apache.syncope.common.lib.to.PushTaskTO;
-import org.apache.syncope.common.lib.to.SchedTaskTO;
-import org.apache.syncope.common.lib.to.SyncTaskTO;
-import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
-import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-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.task.SyncTask;
-import org.apache.syncope.core.persistence.api.entity.task.Task;
-import org.apache.syncope.core.persistence.api.entity.task.TaskUtil;
-import org.apache.syncope.core.persistence.api.entity.task.TaskUtilFactory;
-import org.springframework.stereotype.Component;
-
-@Component
-public class JPATaskUtilFactory implements TaskUtilFactory {
-
- @Override
- public TaskUtil getInstance(final TaskType type) {
- return new JPATaskUtil(type);
- }
-
- @Override
- public TaskUtil getInstance(final Task task) {
- TaskType type;
- if (task instanceof SyncTask) {
- type = TaskType.SYNCHRONIZATION;
- } else if (task instanceof PushTask) {
- type = TaskType.PUSH;
- } else if (task instanceof SchedTask) {
- type = TaskType.SCHEDULED;
- } else if (task instanceof PropagationTask) {
- type = TaskType.PROPAGATION;
- } else if (task instanceof NotificationTask) {
- type = TaskType.NOTIFICATION;
- } else {
- throw new IllegalArgumentException("Invalid task: " + task);
- }
-
- return getInstance(type);
- }
-
- @Override
- public TaskUtil getInstance(final Class<? extends AbstractTaskTO> taskClass) {
- TaskType type;
- if (taskClass == PropagationTaskTO.class) {
- type = TaskType.PROPAGATION;
- } else if (taskClass == NotificationTaskTO.class) {
- type = TaskType.NOTIFICATION;
- } else if (taskClass == SchedTaskTO.class) {
- type = TaskType.SCHEDULED;
- } else if (taskClass == SyncTaskTO.class) {
- type = TaskType.SYNCHRONIZATION;
- } else if (taskClass == PushTaskTO.class) {
- type = TaskType.PUSH;
- } else {
- throw new IllegalArgumentException("Invalid TaskTO class: " + taskClass.getName());
- }
-
- return getInstance(type);
- }
-
- @Override
- public TaskUtil getInstance(final AbstractTaskTO taskTO) {
- return getInstance(taskTO.getClass());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtils.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtils.java
new file mode 100644
index 0000000..484af1e
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtils.java
@@ -0,0 +1,152 @@
+/*
+ * 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.task;
+
+import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.NotificationTaskTO;
+import org.apache.syncope.common.lib.to.PropagationTaskTO;
+import org.apache.syncope.common.lib.to.PushTaskTO;
+import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.to.SyncTaskTO;
+import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+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.task.SyncTask;
+import org.apache.syncope.core.persistence.api.entity.task.Task;
+import org.apache.syncope.core.persistence.api.entity.task.TaskUtils;
+
+@SuppressWarnings("unchecked")
+public final class JPATaskUtils implements TaskUtils {
+
+ private final TaskType type;
+
+ protected JPATaskUtils(final TaskType type) {
+ this.type = type;
+ }
+
+ @Override
+ public TaskType getType() {
+ return type;
+ }
+
+ @Override
+ public <T extends Task> Class<T> taskClass() {
+ Class<T> result = null;
+
+ switch (type) {
+ case PROPAGATION:
+ result = (Class<T>) PropagationTask.class;
+ break;
+
+ case SCHEDULED:
+ result = (Class<T>) SchedTask.class;
+ break;
+
+ case SYNCHRONIZATION:
+ result = (Class<T>) SyncTask.class;
+ break;
+
+ case PUSH:
+ result = (Class<T>) PushTask.class;
+ break;
+
+ case NOTIFICATION:
+ result = (Class<T>) NotificationTask.class;
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends Task> T newTask() {
+ T result = null;
+
+ switch (type) {
+ case PROPAGATION:
+ result = (T) new JPAPropagationTask();
+ break;
+
+ case SCHEDULED:
+ result = (T) new JPASchedTask();
+ break;
+
+ case SYNCHRONIZATION:
+ result = (T) new JPASyncTask();
+ break;
+
+ case PUSH:
+ result = (T) new JPAPushTask();
+ break;
+
+ case NOTIFICATION:
+ result = (T) new JPANotificationTask();
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AbstractTaskTO> Class<T> taskTOClass() {
+ Class<T> result = null;
+
+ switch (type) {
+ case PROPAGATION:
+ result = (Class<T>) PropagationTaskTO.class;
+ break;
+
+ case SCHEDULED:
+ result = (Class<T>) SchedTaskTO.class;
+ break;
+
+ case SYNCHRONIZATION:
+ result = (Class<T>) SyncTaskTO.class;
+ break;
+
+ case PUSH:
+ result = (Class<T>) PushTaskTO.class;
+ break;
+
+ case NOTIFICATION:
+ result = (Class<T>) NotificationTaskTO.class;
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AbstractTaskTO> T newTaskTO() {
+ final Class<T> taskClass = taskTOClass();
+ try {
+ return taskClass == null ? null : taskClass.newInstance();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilsFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilsFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilsFactory.java
new file mode 100644
index 0000000..26a1d4f
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilsFactory.java
@@ -0,0 +1,91 @@
+/*
+ * 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.task;
+
+import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.NotificationTaskTO;
+import org.apache.syncope.common.lib.to.PropagationTaskTO;
+import org.apache.syncope.common.lib.to.PushTaskTO;
+import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.to.SyncTaskTO;
+import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+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.task.SyncTask;
+import org.apache.syncope.core.persistence.api.entity.task.Task;
+import org.apache.syncope.core.persistence.api.entity.task.TaskUtils;
+import org.apache.syncope.core.persistence.api.entity.task.TaskUtilsFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class JPATaskUtilsFactory implements TaskUtilsFactory {
+
+ @Override
+ public TaskUtils getInstance(final TaskType type) {
+ return new JPATaskUtils(type);
+ }
+
+ @Override
+ public TaskUtils getInstance(final Task task) {
+ TaskType type;
+ if (task instanceof SyncTask) {
+ type = TaskType.SYNCHRONIZATION;
+ } else if (task instanceof PushTask) {
+ type = TaskType.PUSH;
+ } else if (task instanceof SchedTask) {
+ type = TaskType.SCHEDULED;
+ } else if (task instanceof PropagationTask) {
+ type = TaskType.PROPAGATION;
+ } else if (task instanceof NotificationTask) {
+ type = TaskType.NOTIFICATION;
+ } else {
+ throw new IllegalArgumentException("Invalid task: " + task);
+ }
+
+ return getInstance(type);
+ }
+
+ @Override
+ public TaskUtils getInstance(final Class<? extends AbstractTaskTO> taskClass) {
+ TaskType type;
+ if (taskClass == PropagationTaskTO.class) {
+ type = TaskType.PROPAGATION;
+ } else if (taskClass == NotificationTaskTO.class) {
+ type = TaskType.NOTIFICATION;
+ } else if (taskClass == SchedTaskTO.class) {
+ type = TaskType.SCHEDULED;
+ } else if (taskClass == SyncTaskTO.class) {
+ type = TaskType.SYNCHRONIZATION;
+ } else if (taskClass == PushTaskTO.class) {
+ type = TaskType.PUSH;
+ } else {
+ throw new IllegalArgumentException("Invalid TaskTO class: " + taskClass.getName());
+ }
+
+ return getInstance(type);
+ }
+
+ @Override
+ public TaskUtils getInstance(final AbstractTaskTO taskTO) {
+ return getInstance(taskTO.getClass());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
index a5e3f28..d12f46f 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
@@ -67,7 +67,9 @@ import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
import org.apache.syncope.core.persistence.jpa.entity.JPASecurityQuestion;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
import org.apache.syncope.core.misc.security.Encryptor;
-import org.apache.syncope.core.misc.security.SecureRandomUtil;
+import org.apache.syncope.core.misc.security.SecureRandomUtils;
+import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.persistence.jpa.entity.JPARole;
/**
* JPA user bean.
@@ -91,6 +93,13 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
@Transient
private String clearPassword;
+ @ManyToMany(fetch = FetchType.EAGER)
+ @JoinTable(joinColumns =
+ @JoinColumn(name = "user_id"),
+ inverseJoinColumns =
+ @JoinColumn(name = "role_id"))
+ private List<JPARole> roles;
+
@OneToMany(cascade = CascadeType.MERGE, mappedBy = "user")
@Valid
private List<JPAMembership> memberships;
@@ -124,8 +133,7 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
@ElementCollection
@Column(name = "passwordHistoryValue")
- @CollectionTable(name = "SyncopeUser_passwordHistory",
- joinColumns =
+ @CollectionTable(name = "SyncopeUser_passwordHistory", joinColumns =
@JoinColumn(name = "SyncopeUser_id", referencedColumnName = "id"))
private List<String> passwordHistory;
@@ -172,7 +180,7 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
@Valid
private Set<JPAExternalResource> resources;
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @ManyToOne(fetch = FetchType.EAGER)
private JPASecurityQuestion securityQuestion;
@Column(nullable = true)
@@ -181,6 +189,7 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
public JPAUser() {
super();
+ roles = new ArrayList<>();
memberships = new ArrayList<>();
plainAttrs = new ArrayList<>();
derAttrs = new ArrayList<>();
@@ -202,6 +211,23 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
}
@Override
+ public boolean addRole(final Role role) {
+ checkType(role, JPARole.class);
+ return roles.contains((JPARole) role) || roles.add((JPARole) role);
+ }
+
+ @Override
+ public boolean removeRole(final Role role) {
+ checkType(role, JPARole.class);
+ return roles.remove((JPARole) role);
+ }
+
+ @Override
+ public List<? extends Role> getRoles() {
+ return roles;
+ }
+
+ @Override
public boolean addMembership(final Membership membership) {
checkType(membership, JPAMembership.class);
return memberships.contains((JPAMembership) membership) || memberships.add((JPAMembership) membership);
@@ -209,7 +235,8 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
@Override
public boolean removeMembership(final Membership membership) {
- return memberships.remove(membership);
+ checkType(membership, JPAMembership.class);
+ return memberships.remove((JPAMembership) membership);
}
@Override
@@ -387,7 +414,7 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp
@Override
public void generateToken(final int tokenLength, final int tokenExpireTime) {
- this.token = SecureRandomUtil.generateRandomPassword(tokenLength);
+ this.token = SecureRandomUtils.generateRandomPassword(tokenLength);
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MINUTE, tokenExpireTime);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ConnInstanceValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ConnInstanceValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ConnInstanceValidator.java
index 2393975..1ce2190 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ConnInstanceValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ConnInstanceValidator.java
@@ -21,8 +21,8 @@ package org.apache.syncope.core.persistence.jpa.validation.entity;
import javax.validation.ConstraintValidatorContext;
import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
-import org.apache.syncope.core.provisioning.api.URIUtil;
-import org.apache.syncope.core.provisioning.api.ConnPoolConfUtil;
+import org.apache.syncope.core.provisioning.api.URIUtils;
+import org.apache.syncope.core.provisioning.api.ConnPoolConfUtils;
public class ConnInstanceValidator extends AbstractValidator<ConnInstanceCheck, ConnInstance> {
@@ -31,7 +31,7 @@ public class ConnInstanceValidator extends AbstractValidator<ConnInstanceCheck,
boolean isValid = true;
try {
- URIUtil.buildForConnId(connInstance.getLocation());
+ URIUtils.buildForConnId(connInstance.getLocation());
} catch (Exception e) {
LOG.error("While validating {}", connInstance.getLocation(), e);
@@ -45,7 +45,7 @@ public class ConnInstanceValidator extends AbstractValidator<ConnInstanceCheck,
if (isValid && connInstance.getPoolConf() != null) {
try {
- ConnPoolConfUtil.getObjectPoolConfiguration(connInstance.getPoolConf()).validate();
+ ConnPoolConfUtils.getObjectPoolConfiguration(connInstance.getPoolConf()).validate();
} catch (Exception e) {
LOG.error("Invalid pool configuration", e);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmValidator.java
index aa92d00..76bdb2b 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RealmValidator.java
@@ -20,6 +20,7 @@ package org.apache.syncope.core.persistence.jpa.validation.entity;
import java.util.regex.Pattern;
import javax.validation.ConstraintValidatorContext;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.core.persistence.api.entity.Realm;
@@ -33,7 +34,7 @@ public class RealmValidator extends AbstractValidator<RealmCheck, Realm> {
boolean isValid = true;
- if ("/".equals(object.getName())) {
+ if (SyncopeConstants.ROOT_REALM.equals(object.getName())) {
if (object.getParent() != null) {
isValid = false;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java
index 0b5ac42..fac60cb 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java
@@ -30,12 +30,13 @@ import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Policy;
-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.misc.policy.AccountPolicyEnforcer;
import org.apache.syncope.core.misc.policy.AccountPolicyException;
import org.apache.syncope.core.misc.policy.PasswordPolicyEnforcer;
import org.apache.syncope.core.misc.policy.PolicyEvaluator;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
import org.springframework.beans.factory.annotation.Autowired;
public class UserValidator extends AbstractValidator<UserCheck, User> {
@@ -50,6 +51,9 @@ public class UserValidator extends AbstractValidator<UserCheck, User> {
private PolicyDAO policyDAO;
@Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
private PolicyEvaluator evaluator;
@Autowired
@@ -62,6 +66,15 @@ public class UserValidator extends AbstractValidator<UserCheck, User> {
public boolean isValid(final User user, final ConstraintValidatorContext context) {
context.disableDefaultConstraintViolation();
+ // need to treat it explicitly, otherwise policy evaluation will silently fail
+ if (user.getRealm() == null) {
+ context.buildConstraintViolationWithTemplate(
+ getTemplate(EntityViolationType.InvalidRealm, "realm not specified")).
+ addPropertyNode("realm").addConstraintViolation();
+
+ return false;
+ }
+
// ------------------------------
// Verify password policies
// ------------------------------
@@ -71,7 +84,7 @@ public class UserValidator extends AbstractValidator<UserCheck, User> {
int maxPPSpecHistory = 0;
for (Policy policy : getPasswordPolicies(user)) {
// evaluate policy
- final PasswordPolicySpec ppSpec = evaluator.evaluate(policy, user);
+ PasswordPolicySpec ppSpec = evaluator.evaluate(policy, user);
// enforce policy
ppEnforcer.enforce(ppSpec, policy.getType(), user);
@@ -117,7 +130,7 @@ public class UserValidator extends AbstractValidator<UserCheck, User> {
// invalid username
for (Policy policy : getAccountPolicies(user)) {
// evaluate policy
- final AccountPolicySpec accountPolicy = evaluator.evaluate(policy, user);
+ AccountPolicySpec accountPolicy = evaluator.evaluate(policy, user);
// enforce policy
apEnforcer.enforce(accountPolicy, policy.getType(), user);
@@ -137,13 +150,9 @@ public class UserValidator extends AbstractValidator<UserCheck, User> {
}
private List<PasswordPolicy> getPasswordPolicies(final User user) {
- final List<PasswordPolicy> policies = new ArrayList<>();
+ List<PasswordPolicy> policies = new ArrayList<>();
- // Add global policy
- PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
- if (policy != null) {
- policies.add(policy);
- }
+ PasswordPolicy policy;
// add resource policies
for (ExternalResource resource : user.getResources()) {
@@ -153,9 +162,9 @@ public class UserValidator extends AbstractValidator<UserCheck, User> {
}
}
- // add group policies
- for (Group group : user.getGroups()) {
- policy = group.getPasswordPolicy();
+ // add realm policies
+ for (Realm realm : realmDAO.findAncestors(user.getRealm())) {
+ policy = realm.getPasswordPolicy();
if (policy != null) {
policies.add(policy);
}
@@ -165,13 +174,9 @@ public class UserValidator extends AbstractValidator<UserCheck, User> {
}
private List<AccountPolicy> getAccountPolicies(final User user) {
- final List<AccountPolicy> policies = new ArrayList<>();
+ List<AccountPolicy> policies = new ArrayList<>();
- // add global policy
- AccountPolicy policy = policyDAO.getGlobalAccountPolicy();
- if (policy != null) {
- policies.add(policy);
- }
+ AccountPolicy policy;
// add resource policies
for (ExternalResource resource : user.getResources()) {
@@ -181,9 +186,9 @@ public class UserValidator extends AbstractValidator<UserCheck, User> {
}
}
- // add group policies
- for (Group group : user.getGroups()) {
- policy = group.getAccountPolicy();
+ // add realm policies
+ for (Realm realm : realmDAO.findAncestors(user.getRealm())) {
+ policy = realm.getAccountPolicy();
if (policy != null) {
policies.add(policy);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/content.xml b/core/persistence-jpa/src/main/resources/content.xml
index 6b6c287..0f4ab83 100644
--- a/core/persistence-jpa/src/main/resources/content.xml
+++ b/core/persistence-jpa/src/main/resources/content.xml
@@ -108,87 +108,6 @@ under the License.
<Notification id="2" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1"
sender="admin@syncope.apache.org" subject="Password Reset successful" template="confirmPasswordReset"
traceLevel="FAILURES" userAbout="token!=$null"/>
- <Notification_events Notification_id="2" event="[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"/>
-
- <!-- Authentication and authorization -->
- <Entitlement name="REALM_LIST"/>
- <Entitlement name="REALM_CREATE"/>
- <Entitlement name="REALM_UPDATE"/>
- <Entitlement name="REALM_DELETE"/>
- <Entitlement name="ROLE_LIST"/>
- <Entitlement name="ROLE_CREATE"/>
- <Entitlement name="ROLE_READ"/>
- <Entitlement name="ROLE_UPDATE"/>
- <Entitlement name="ROLE_DELETE"/>
- <Entitlement name="SCHEMA_LIST"/>
- <Entitlement name="SCHEMA_CREATE"/>
- <Entitlement name="SCHEMA_READ"/>
- <Entitlement name="SCHEMA_UPDATE"/>
- <Entitlement name="SCHEMA_DELETE"/>
- <Entitlement name="USER_LIST"/>
- <Entitlement name="USER_CREATE"/>
- <Entitlement name="USER_READ"/>
- <Entitlement name="USER_UPDATE"/>
- <Entitlement name="USER_DELETE"/>
- <Entitlement name="USER_VIEW"/>
- <Entitlement name="GROUP_LIST"/>
- <Entitlement name="GROUP_CREATE"/>
- <Entitlement name="GROUP_READ"/>
- <Entitlement name="GROUP_UPDATE"/>
- <Entitlement name="GROUP_DELETE"/>
- <Entitlement name="RESOURCE_LIST"/>
- <Entitlement name="RESOURCE_CREATE"/>
- <Entitlement name="RESOURCE_READ"/>
- <Entitlement name="RESOURCE_UPDATE"/>
- <Entitlement name="RESOURCE_DELETE"/>
- <Entitlement name="RESOURCE_GETCONNECTOROBJECT"/>
- <Entitlement name="CONNECTOR_LIST"/>
- <Entitlement name="CONNECTOR_CREATE"/>
- <Entitlement name="CONNECTOR_READ"/>
- <Entitlement name="CONNECTOR_UPDATE"/>
- <Entitlement name="CONNECTOR_DELETE"/>
- <Entitlement name="CONNECTOR_RELOAD"/>
- <Entitlement name="CONFIGURATION_EXPORT"/>
- <Entitlement name="CONFIGURATION_LIST"/>
- <Entitlement name="CONFIGURATION_SET"/>
- <Entitlement name="CONFIGURATION_DELETE"/>
- <Entitlement name="TASK_LIST"/>
- <Entitlement name="TASK_CREATE"/>
- <Entitlement name="TASK_READ"/>
- <Entitlement name="TASK_UPDATE"/>
- <Entitlement name="TASK_DELETE"/>
- <Entitlement name="TASK_EXECUTE"/>
- <Entitlement name="POLICY_LIST"/>
- <Entitlement name="POLICY_CREATE"/>
- <Entitlement name="POLICY_READ"/>
- <Entitlement name="POLICY_UPDATE"/>
- <Entitlement name="POLICY_DELETE"/>
- <Entitlement name="WORKFLOW_DEF_READ"/>
- <Entitlement name="WORKFLOW_DEF_UPDATE"/>
- <Entitlement name="WORKFLOW_TASK_LIST"/>
- <Entitlement name="WORKFLOW_FORM_LIST"/>
- <Entitlement name="WORKFLOW_FORM_READ"/>
- <Entitlement name="WORKFLOW_FORM_CLAIM"/>
- <Entitlement name="WORKFLOW_FORM_SUBMIT"/>
- <Entitlement name="NOTIFICATION_LIST"/>
- <Entitlement name="NOTIFICATION_CREATE"/>
- <Entitlement name="NOTIFICATION_READ"/>
- <Entitlement name="NOTIFICATION_UPDATE"/>
- <Entitlement name="NOTIFICATION_DELETE"/>
- <Entitlement name="REPORT_LIST"/>
- <Entitlement name="REPORT_READ"/>
- <Entitlement name="REPORT_CREATE"/>
- <Entitlement name="REPORT_UPDATE"/>
- <Entitlement name="REPORT_DELETE"/>
- <Entitlement name="REPORT_EXECUTE"/>
- <Entitlement name="LOG_LIST"/>
- <Entitlement name="LOG_SET_LEVEL"/>
- <Entitlement name="LOG_DELETE"/>
- <Entitlement name="AUDIT_LIST"/>
- <Entitlement name="AUDIT_ENABLE"/>
- <Entitlement name="AUDIT_DISABLE"/>
- <Entitlement name="SECURITY_QUESTION_CREATE"/>
- <Entitlement name="SECURITY_QUESTION_UPDATE"/>
- <Entitlement name="SECURITY_QUESTION_DELETE"/>
+ <Notification_events Notification_id="2" event="[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"/>
</dataset>
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/resources/views.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/views.xml b/core/persistence-jpa/src/main/resources/views.xml
index aa0ec48..8cd392d 100644
--- a/core/persistence-jpa/src/main/resources/views.xml
+++ b/core/persistence-jpa/src/main/resources/views.xml
@@ -139,11 +139,5 @@ under the License.
SELECT st.group_id AS subject_id, st.resource_name AS resource_name
FROM SyncopeGroup_ExternalResource st
</entry>
- <entry key="group_search_entitlements">
- CREATE VIEW group_search_entitlements AS
-
- SELECT st.group_id AS subject_id, st.entitlement_name AS entitlement_name
- FROM SyncopeGroup_Entitlement st
- </entry>
</properties>
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/AbstractTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/AbstractTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/AbstractTest.java
index 29a28de..668c868 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/AbstractTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/AbstractTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.syncope.core.persistence.jpa;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +33,6 @@ public abstract class AbstractTest {
protected EntityFactory entityFactory;
@Autowired
- protected AttributableUtilFactory attrUtilFactory;
+ protected AttributableUtilsFactory attrUtilsFactory;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttrTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttrTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttrTest.java
index 39e4cd2..289f898 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttrTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttrTest.java
@@ -87,15 +87,15 @@ public class AttrTest extends AbstractTest {
Exception thrown = null;
try {
- attribute.addValue("john.doe@gmail.com", attrUtilFactory.getInstance(AttributableType.USER));
- attribute.addValue("mario.rossi@gmail.com", attrUtilFactory.getInstance(AttributableType.USER));
+ attribute.addValue("john.doe@gmail.com", attrUtilsFactory.getInstance(AttributableType.USER));
+ attribute.addValue("mario.rossi@gmail.com", attrUtilsFactory.getInstance(AttributableType.USER));
} catch (ValidationException e) {
thrown = e;
}
assertNull("no validation exception expected here ", thrown);
try {
- attribute.addValue("http://www.apache.org", attrUtilFactory.getInstance(AttributableType.USER));
+ attribute.addValue("http://www.apache.org", attrUtilsFactory.getInstance(AttributableType.USER));
} catch (ValidationException e) {
thrown = e;
}
@@ -119,13 +119,13 @@ public class AttrTest extends AbstractTest {
Exception thrown = null;
try {
- attribute.addValue("A", attrUtilFactory.getInstance(AttributableType.USER));
+ attribute.addValue("A", attrUtilsFactory.getInstance(AttributableType.USER));
} catch (ValidationException e) {
thrown = e;
}
assertNotNull("validation exception expected here ", thrown);
- attribute.addValue("M", attrUtilFactory.getInstance(AttributableType.USER));
+ attribute.addValue("M", attrUtilsFactory.getInstance(AttributableType.USER));
InvalidEntityException iee = null;
try {
@@ -183,7 +183,7 @@ public class AttrTest extends AbstractTest {
UPlainAttr attribute = entityFactory.newEntity(UPlainAttr.class);
attribute.setSchema(obscureSchema);
- attribute.addValue("testvalue", attrUtilFactory.getInstance(AttributableType.USER));
+ attribute.addValue("testvalue", attrUtilsFactory.getInstance(AttributableType.USER));
attribute.setOwner(user);
user.addPlainAttr(attribute);
@@ -210,7 +210,7 @@ public class AttrTest extends AbstractTest {
UPlainAttr attribute = entityFactory.newEntity(UPlainAttr.class);
attribute.setSchema(photoSchema);
- attribute.addValue(photoB64Value, attrUtilFactory.getInstance(AttributableType.USER));
+ attribute.addValue(photoB64Value, attrUtilsFactory.getInstance(AttributableType.USER));
attribute.setOwner(user);
user.addPlainAttr(attribute);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttributableSearchTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttributableSearchTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttributableSearchTest.java
index dc338b6..ea93dae 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttributableSearchTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/AttributableSearchTest.java
@@ -28,9 +28,10 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
@@ -59,9 +60,6 @@ public class AttributableSearchTest extends AbstractTest {
@Autowired
private SubjectSearchDAO searchDAO;
- @Autowired
- private EntitlementDAO entitlementDAO;
-
@Test
public void userMatch() {
User user = userDAO.find(1L);
@@ -111,8 +109,7 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(cond.isValid());
- List<User> users =
- searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS, cond, SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
}
@@ -126,8 +123,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond cond = SearchCond.getNotLeafCond(fullnameLeafCond);
assertTrue(cond.isValid());
- List<User> users =
- searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS, cond, SubjectType.USER);
assertNotNull(users);
assertEquals(4, users.size());
@@ -148,8 +144,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond cond = SearchCond.getLeafCond(coolLeafCond);
assertTrue(cond.isValid());
- List<User> users =
- searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), cond, SubjectType.USER);
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS, cond, SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
@@ -169,8 +164,8 @@ public class AttributableSearchTest extends AbstractTest {
loginDateCond.setSchema("loginDate");
loginDateCond.setExpression("2009-05-26");
- SearchCond subCond = SearchCond.getAndCond(SearchCond.getLeafCond(fullnameLeafCond), SearchCond.getLeafCond(
- membershipCond));
+ SearchCond subCond = SearchCond.getAndCond(
+ SearchCond.getLeafCond(fullnameLeafCond), SearchCond.getLeafCond(membershipCond));
assertTrue(subCond.isValid());
@@ -178,13 +173,13 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(cond.isValid());
- List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
cond, 1, 2, Collections.<OrderByClause>emptyList(),
SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
- users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
cond, 2, 2, Collections.<OrderByClause>emptyList(),
SubjectType.USER);
assertNotNull(users);
@@ -196,16 +191,16 @@ public class AttributableSearchTest extends AbstractTest {
MembershipCond membershipCond = new MembershipCond();
membershipCond.setGroupId(1L);
- List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), SearchCond.getLeafCond(membershipCond),
- SubjectType.USER);
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
+ SearchCond.getLeafCond(membershipCond), SubjectType.USER);
assertNotNull(users);
assertEquals(2, users.size());
membershipCond = new MembershipCond();
membershipCond.setGroupId(5L);
- users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), SearchCond.getNotLeafCond(membershipCond),
- SubjectType.USER);
+ users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
+ SearchCond.getNotLeafCond(membershipCond), SubjectType.USER);
assertNotNull(users);
assertEquals(5, users.size());
}
@@ -215,16 +210,16 @@ public class AttributableSearchTest extends AbstractTest {
AttributeCond coolLeafCond = new AttributeCond(AttributeCond.Type.ISNULL);
coolLeafCond.setSchema("cool");
- List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), SearchCond.getLeafCond(coolLeafCond),
- SubjectType.USER);
+ List<User> users = searchDAO.search(
+ SyncopeConstants.FULL_ADMIN_REALMS, SearchCond.getLeafCond(coolLeafCond), SubjectType.USER);
assertNotNull(users);
assertEquals(4, users.size());
coolLeafCond = new AttributeCond(AttributeCond.Type.ISNOTNULL);
coolLeafCond.setSchema("cool");
- users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), SearchCond.getLeafCond(coolLeafCond),
- SubjectType.USER);
+ users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
+ SearchCond.getLeafCond(coolLeafCond), SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
}
@@ -241,8 +236,7 @@ public class AttributableSearchTest extends AbstractTest {
assertTrue(searchCondition.isValid());
- List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), searchCondition,
- SubjectType.USER);
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS, searchCondition, SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
@@ -250,14 +244,12 @@ public class AttributableSearchTest extends AbstractTest {
@Test
public void searchByBooleanSubjectCond() {
- SubjectCond booleanCond = new SubjectCond(SubjectCond.Type.EQ);
- booleanCond.setSchema("inheritPlainAttrs");
+ AttributeCond booleanCond = new AttributeCond(SubjectCond.Type.EQ);
+ booleanCond.setSchema("show");
booleanCond.setExpression("true");
- SearchCond searchCondition = SearchCond.getLeafCond(booleanCond);
-
- List<Group> matchingGroups = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
- searchCondition, SubjectType.GROUP);
+ List<Group> matchingGroups = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
+ SearchCond.getLeafCond(booleanCond), SubjectType.GROUP);
assertNotNull(matchingGroups);
assertFalse(matchingGroups.isEmpty());
}
@@ -272,16 +264,17 @@ public class AttributableSearchTest extends AbstractTest {
idRightCond.setSchema("key");
idRightCond.setExpression("2");
- SearchCond searchCondition = SearchCond.getAndCond(SearchCond.getLeafCond(usernameLeafCond),
+ SearchCond searchCondition = SearchCond.getAndCond(
+ SearchCond.getLeafCond(usernameLeafCond),
SearchCond.getLeafCond(idRightCond));
- List<User> matchingUsers = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ List<User> matchingUsers = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
searchCondition, SubjectType.USER);
assertNotNull(matchingUsers);
assertEquals(1, matchingUsers.size());
assertEquals("rossini", matchingUsers.iterator().next().getUsername());
- assertEquals(1L, matchingUsers.iterator().next().getKey().longValue());
+ assertEquals(1L, matchingUsers.iterator().next().getKey(), 0);
}
@Test
@@ -294,18 +287,19 @@ public class AttributableSearchTest extends AbstractTest {
idRightCond.setSchema("key");
idRightCond.setExpression("2");
- SearchCond searchCondition = SearchCond.getAndCond(SearchCond.getLeafCond(groupNameLeafCond),
+ SearchCond searchCondition = SearchCond.getAndCond(
+ SearchCond.getLeafCond(groupNameLeafCond),
SearchCond.getLeafCond(idRightCond));
assertTrue(searchCondition.isValid());
- List<Group> matchingGroups = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ List<Group> matchingGroups = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
searchCondition, SubjectType.GROUP);
assertNotNull(matchingGroups);
assertEquals(1, matchingGroups.size());
assertEquals("root", matchingGroups.iterator().next().getName());
- assertEquals(1L, matchingGroups.iterator().next().getKey().longValue());
+ assertEquals(1L, matchingGroups.iterator().next().getKey(), 0);
}
@Test
@@ -318,13 +312,12 @@ public class AttributableSearchTest extends AbstractTest {
idRightCond.setSchema("fullname");
idRightCond.setExpression("Giuseppe V%");
- SearchCond searchCondition = SearchCond.getOrCond(SearchCond.getLeafCond(usernameLeafCond),
+ SearchCond searchCondition = SearchCond.getOrCond(
+ SearchCond.getLeafCond(usernameLeafCond),
SearchCond.getLeafCond(idRightCond));
- List<User> matchingUsers =
- searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), searchCondition,
- SubjectType.USER);
-
+ List<User> matchingUsers = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
+ searchCondition, SubjectType.USER);
assertNotNull(matchingUsers);
assertEquals(2, matchingUsers.size());
}
@@ -338,13 +331,10 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond searchCondition = SearchCond.getLeafCond(idLeafCond);
assertTrue(searchCondition.isValid());
- List<User> users =
- searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), searchCondition,
- SubjectType.USER);
-
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS, searchCondition, SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
- assertEquals(1L, users.iterator().next().getKey().longValue());
+ assertEquals(1L, users.iterator().next().getKey(), 0);
idLeafCond = new SubjectCond(SubjectCond.Type.LT);
idLeafCond.setSchema("id");
@@ -353,18 +343,16 @@ public class AttributableSearchTest extends AbstractTest {
searchCondition = SearchCond.getNotLeafCond(idLeafCond);
assertTrue(searchCondition.isValid());
- users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), searchCondition,
- SubjectType.USER);
-
+ users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS, searchCondition, SubjectType.USER);
assertNotNull(users);
assertEquals(2, users.size());
- boolean found = false;
- for (User user : users) {
- if (user.getKey() == 4) {
- found = true;
+ assertTrue(CollectionUtils.exists(users, new Predicate<User>() {
+
+ @Override
+ public boolean evaluate(User user) {
+ return user.getKey() == 4;
}
- }
- assertTrue(found);
+ }));
}
@Test
@@ -378,7 +366,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond searchCondition = SearchCond.getOrCond(
SearchCond.getLeafCond(usernameLeafCond), SearchCond.getLeafCond(idRightCond));
- List<OrderByClause> orderByClauses = new ArrayList<OrderByClause>();
+ List<OrderByClause> orderByClauses = new ArrayList<>();
OrderByClause orderByClause = new OrderByClause();
orderByClause.setField("username");
orderByClause.setDirection(OrderByClause.Direction.DESC);
@@ -388,11 +376,9 @@ public class AttributableSearchTest extends AbstractTest {
orderByClause.setDirection(OrderByClause.Direction.ASC);
orderByClauses.add(orderByClause);
- List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
- searchCondition, Collections.singletonList(orderByClause),
- SubjectType.USER);
- assertEquals(searchDAO.count(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
- searchCondition, SubjectType.USER),
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
+ searchCondition, orderByClauses, SubjectType.USER);
+ assertEquals(searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, searchCondition, SubjectType.USER),
users.size());
}
@@ -407,9 +393,9 @@ public class AttributableSearchTest extends AbstractTest {
OrderByClause orderByClause = new OrderByClause();
orderByClause.setField("name");
- List<Group> groups = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ List<Group> groups = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS,
searchCondition, Collections.singletonList(orderByClause), SubjectType.GROUP);
- assertEquals(searchDAO.count(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ assertEquals(searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS,
searchCondition, SubjectType.GROUP),
groups.size());
}
@@ -426,17 +412,16 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond.getAndCond(SearchCond.getNotLeafCond(ws2), SearchCond.getNotLeafCond(ws1));
assertTrue(searchCondition.isValid());
- List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
- searchCondition, SubjectType.USER);
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS, searchCondition, SubjectType.USER);
assertNotNull(users);
assertEquals(2, users.size());
- boolean found = false;
- for (User user : users) {
- if (user.getKey() == 4) {
- found = true;
+ assertTrue(CollectionUtils.exists(users, new Predicate<User>() {
+
+ @Override
+ public boolean evaluate(User user) {
+ return user.getKey() == 4;
}
- }
- assertTrue(found);
+ }));
}
@Test
@@ -448,8 +433,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond searchCondition = SearchCond.getLeafCond(cond);
assertTrue(searchCondition.isValid());
- List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
- searchCondition, SubjectType.USER);
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS, searchCondition, SubjectType.USER);
assertNotNull(users);
assertTrue(users.isEmpty());
}
@@ -463,8 +447,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond searchCondition = SearchCond.getLeafCond(cond);
assertTrue(searchCondition.isValid());
- List<User> users = searchDAO.search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
- searchCondition, SubjectType.USER);
+ List<User> users = searchDAO.search(SyncopeConstants.FULL_ADMIN_REALMS, searchCondition, SubjectType.USER);
assertNotNull(users);
assertEquals(1, users.size());
}
@@ -481,8 +464,7 @@ public class AttributableSearchTest extends AbstractTest {
SearchCond searchCond = SearchCond.getOrCond(
SearchCond.getLeafCond(isNullCond), SearchCond.getLeafCond(likeCond));
- Integer count = searchDAO.count(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()), searchCond,
- SubjectType.USER);
+ Integer count = searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, searchCond, SubjectType.USER);
assertNotNull(count);
assertTrue(count > 0);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/ConfTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/ConfTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/ConfTest.java
index e5e1ecc..2539a44 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/ConfTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/ConfTest.java
@@ -72,7 +72,7 @@ public class ConfTest extends AbstractTest {
// 2. create conf
CPlainAttr newConf = entityFactory.newEntity(CPlainAttr.class);
newConf.setSchema(useless);
- newConf.addValue("2014-06-20", attrUtilFactory.getInstance(AttributableType.CONFIGURATION));
+ newConf.addValue("2014-06-20", attrUtilsFactory.getInstance(AttributableType.CONFIGURATION));
confDAO.save(newConf);
CPlainAttr actual = confDAO.find("useless");
@@ -80,7 +80,7 @@ public class ConfTest extends AbstractTest {
// 3. update conf
newConf.getValues().clear();
- newConf.addValue("2014-06-20", attrUtilFactory.getInstance(AttributableType.CONFIGURATION));
+ newConf.addValue("2014-06-20", attrUtilsFactory.getInstance(AttributableType.CONFIGURATION));
confDAO.save(newConf);
actual = confDAO.find("useless");
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerSchemaTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerSchemaTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerSchemaTest.java
index e7f7533..8b4090b 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/DerSchemaTest.java
@@ -73,7 +73,7 @@ public class DerSchemaTest extends AbstractTest {
UDerSchema cn = derSchemaDAO.find("cn", UDerSchema.class);
assertNotNull(cn);
- derSchemaDAO.delete(cn.getKey(), attrUtilFactory.getInstance(AttributableType.USER));
+ derSchemaDAO.delete(cn.getKey(), attrUtilsFactory.getInstance(AttributableType.USER));
DerSchema actual = derSchemaDAO.find("cn", UDerSchema.class);
assertNull("delete did not work", actual);
@@ -82,7 +82,7 @@ public class DerSchemaTest extends AbstractTest {
GDerSchema rderiveddata = derSchemaDAO.find("rderiveddata", GDerSchema.class);
assertNotNull(rderiveddata);
- derSchemaDAO.delete(rderiveddata.getKey(), attrUtilFactory.getInstance(AttributableType.GROUP));
+ derSchemaDAO.delete(rderiveddata.getKey(), attrUtilsFactory.getInstance(AttributableType.GROUP));
actual = derSchemaDAO.find("rderiveddata", GDerSchema.class);
assertNull("delete did not work", actual);
[50/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java
new file mode 100644
index 0000000..2b10228
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java
@@ -0,0 +1,746 @@
+/*
+ * 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.misc;
+
+import org.apache.syncope.core.misc.policy.InvalidPasswordPolicySpecException;
+import org.apache.syncope.core.misc.security.PasswordGenerator;
+import org.apache.syncope.core.misc.security.SecureRandomUtils;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.AttributableOperations;
+import org.apache.syncope.common.lib.mod.AbstractAttributableMod;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.MembershipTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.common.lib.types.PasswordPolicySpec;
+import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
+import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
+import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
+import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+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.Attributable;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.Subject;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+import org.apache.syncope.core.persistence.api.entity.membership.Membership;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.provisioning.api.Connector;
+import org.apache.syncope.core.provisioning.api.ConnectorFactory;
+import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
+import org.apache.syncope.core.provisioning.api.cache.VirAttrCacheValue;
+import org.apache.syncope.core.misc.security.Encryptor;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.identityconnectors.common.Base64;
+import org.identityconnectors.common.security.GuardedByteArray;
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.OperationOptions;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+public class ConnObjectUtils {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(ConnObjectUtils.class);
+
+ @Autowired
+ private PolicyDAO policyDAO;
+
+ @Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
+ private UserDAO userDAO;
+
+ @Autowired
+ private GroupDAO groupDAO;
+
+ @Autowired
+ private ExternalResourceDAO resourceDAO;
+
+ @Autowired
+ private PlainSchemaDAO plainSchemaDAO;
+
+ @Autowired
+ private PasswordGenerator pwdGen;
+
+ private final Encryptor encryptor = Encryptor.getInstance();
+
+ /**
+ * Virtual attribute cache.
+ */
+ @Autowired
+ private VirAttrCache virAttrCache;
+
+ public ObjectClass fromSubject(final Subject<?, ?, ?> subject) {
+ if (subject == null) {
+ throw new IllegalArgumentException("No ObjectClass could be provided for " + subject);
+ }
+
+ ObjectClass result = null;
+ if (subject instanceof User) {
+ result = ObjectClass.ACCOUNT;
+ }
+ if (subject instanceof Group) {
+ result = ObjectClass.GROUP;
+ }
+
+ return result;
+ }
+
+ /**
+ * Build a UserTO / GroupTO out of connector object attributes and schema mapping.
+ *
+ * @param obj connector object
+ * @param syncTask synchronization task
+ * @param attrUtils AttributableUtils
+ * @param <T> user/group
+ * @return UserTO for the user to be created
+ */
+ @Transactional(readOnly = true)
+ public <T extends AbstractSubjectTO> T getSubjectTO(final ConnectorObject obj, final SyncTask syncTask,
+ final AttributableUtils attrUtils) {
+
+ T subjectTO = getSubjectTOFromConnObject(obj, syncTask, attrUtils);
+
+ // (for users) if password was not set above, generate
+ if (subjectTO instanceof UserTO && StringUtils.isBlank(((UserTO) subjectTO).getPassword())) {
+ final UserTO userTO = (UserTO) subjectTO;
+
+ List<PasswordPolicySpec> ppSpecs = new ArrayList<>();
+
+ Realm realm = realmDAO.find(userTO.getRealm());
+ if (realm != null) {
+ for (Realm ancestor : realmDAO.findAncestors(realm)) {
+ if (ancestor.getPasswordPolicy() != null
+ && ancestor.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
+
+ ppSpecs.add(ancestor.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
+ }
+ }
+ }
+
+ for (String resName : userTO.getResources()) {
+ ExternalResource resource = resourceDAO.find(resName);
+ if (resource != null && resource.getPasswordPolicy() != null
+ && resource.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
+
+ ppSpecs.add(resource.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
+ }
+ }
+
+ String password;
+ try {
+ password = pwdGen.generate(ppSpecs);
+ } catch (InvalidPasswordPolicySpecException e) {
+ LOG.error("Could not generate policy-compliant random password for {}", userTO, e);
+
+ password = SecureRandomUtils.generateRandomPassword(16);
+ }
+ userTO.setPassword(password);
+ }
+
+ return subjectTO;
+ }
+
+ /**
+ * Build an UserMod out of connector object attributes and schema mapping.
+ *
+ * @param key user to be updated
+ * @param obj connector object
+ * @param original subject to get diff from
+ * @param syncTask synchronization task
+ * @param attrUtils AttributableUtil
+ * @param <T> user/group
+ * @return modifications for the user/group to be updated
+ */
+ @SuppressWarnings("unchecked")
+ @Transactional(readOnly = true)
+ public <T extends AbstractAttributableMod> T getAttributableMod(final Long key, final ConnectorObject obj,
+ final AbstractAttributableTO original, final SyncTask syncTask, final AttributableUtils attrUtils) {
+
+ final AbstractAttributableTO updated = getSubjectTOFromConnObject(obj, syncTask, attrUtils);
+ updated.setKey(key);
+
+ if (AttributableType.USER == attrUtils.getType()) {
+ // update password if and only if password is really changed
+ final User user = userDAO.authFetch(key);
+ if (StringUtils.isBlank(((UserTO) updated).getPassword())
+ || encryptor.verify(((UserTO) updated).getPassword(),
+ user.getCipherAlgorithm(), user.getPassword())) {
+
+ ((UserTO) updated).setPassword(null);
+ }
+
+ for (MembershipTO membTO : ((UserTO) updated).getMemberships()) {
+ Membership memb = user.getMembership(membTO.getGroupKey());
+ if (memb != null) {
+ membTO.setKey(memb.getKey());
+ }
+ }
+
+ return (T) AttributableOperations.diff(((UserTO) updated), ((UserTO) original), true);
+ }
+ if (AttributableType.GROUP == attrUtils.getType()) {
+ return (T) AttributableOperations.diff(((GroupTO) updated), ((GroupTO) original), true);
+ }
+
+ return null;
+ }
+
+ private <T extends AbstractSubjectTO> T getSubjectTOFromConnObject(final ConnectorObject obj,
+ final SyncTask syncTask, final AttributableUtils attrUtils) {
+
+ final T subjectTO = attrUtils.newSubjectTO();
+
+ // 1. fill with data from connector object
+ subjectTO.setRealm(syncTask.getDestinatioRealm().getFullPath());
+ for (MappingItem item : attrUtils.getUidToMappingItems(
+ syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)) {
+
+ Attribute attribute = obj.getAttributeByName(item.getExtAttrName());
+
+ AttrTO attributeTO;
+ switch (item.getIntMappingType()) {
+ case UserId:
+ case GroupId:
+ break;
+
+ case Password:
+ if (subjectTO instanceof UserTO && attribute != null && attribute.getValue() != null
+ && !attribute.getValue().isEmpty()) {
+
+ ((UserTO) subjectTO).setPassword(getPassword(attribute.getValue().get(0)));
+ }
+ break;
+
+ case Username:
+ if (subjectTO instanceof UserTO) {
+ ((UserTO) subjectTO).setUsername(attribute == null || attribute.getValue().isEmpty()
+ || attribute.getValue().get(0) == null
+ ? null
+ : attribute.getValue().get(0).toString());
+ }
+ break;
+
+ case GroupName:
+ if (subjectTO instanceof GroupTO) {
+ ((GroupTO) subjectTO).setName(attribute == null || attribute.getValue().isEmpty()
+ || attribute.getValue().get(0) == null
+ ? null
+ : attribute.getValue().get(0).toString());
+ }
+ break;
+
+ case GroupOwnerSchema:
+ if (subjectTO instanceof GroupTO && attribute != null) {
+ // using a special attribute (with schema "", that will be ignored) for carrying the
+ // GroupOwnerSchema value
+ attributeTO = new AttrTO();
+ attributeTO.setSchema(StringUtils.EMPTY);
+ if (attribute.getValue().isEmpty() || attribute.getValue().get(0) == null) {
+ attributeTO.getValues().add(StringUtils.EMPTY);
+ } else {
+ attributeTO.getValues().add(attribute.getValue().get(0).toString());
+ }
+
+ ((GroupTO) subjectTO).getPlainAttrs().add(attributeTO);
+ }
+ break;
+
+ case UserPlainSchema:
+ case GroupPlainSchema:
+ attributeTO = new AttrTO();
+ attributeTO.setSchema(item.getIntAttrName());
+
+ PlainSchema schema = plainSchemaDAO.find(item.getIntAttrName(), attrUtils.plainSchemaClass());
+
+ for (Object value : attribute == null || attribute.getValue() == null
+ ? Collections.emptyList()
+ : attribute.getValue()) {
+
+ AttrSchemaType schemaType = schema == null ? AttrSchemaType.String : schema.getType();
+ if (value != null) {
+ final PlainAttrValue attrValue = attrUtils.newPlainAttrValue();
+ switch (schemaType) {
+ case String:
+ attrValue.setStringValue(value.toString());
+ break;
+
+ case Binary:
+ attrValue.setBinaryValue((byte[]) value);
+ break;
+
+ default:
+ try {
+ attrValue.parseValue(schema, value.toString());
+ } catch (ParsingValidationException e) {
+ LOG.error("While parsing provided value {}", value, e);
+ attrValue.setStringValue(value.toString());
+ schemaType = AttrSchemaType.String;
+ }
+ break;
+ }
+ attributeTO.getValues().add(attrValue.getValueAsString(schemaType));
+ }
+ }
+
+ subjectTO.getPlainAttrs().add(attributeTO);
+ break;
+
+ case UserDerivedSchema:
+ case GroupDerivedSchema:
+ attributeTO = new AttrTO();
+ attributeTO.setSchema(item.getIntAttrName());
+ subjectTO.getDerAttrs().add(attributeTO);
+ break;
+
+ case UserVirtualSchema:
+ case GroupVirtualSchema:
+ attributeTO = new AttrTO();
+ attributeTO.setSchema(item.getIntAttrName());
+
+ for (Object value : attribute == null || attribute.getValue() == null
+ ? Collections.emptyList()
+ : attribute.getValue()) {
+
+ if (value != null) {
+ attributeTO.getValues().add(value.toString());
+ }
+ }
+
+ subjectTO.getVirAttrs().add(attributeTO);
+ break;
+
+ default:
+ }
+ }
+
+ // 2. add data from defined template (if any)
+ AbstractSubjectTO template = AttributableType.USER == attrUtils.getType()
+ ? syncTask.getUserTemplate() : syncTask.getGroupTemplate();
+
+ if (template != null) {
+ if (template.getRealm() != null) {
+ subjectTO.setRealm(template.getRealm());
+ }
+
+ if (template instanceof UserTO) {
+ if (StringUtils.isNotBlank(((UserTO) template).getUsername())) {
+ String evaluated = JexlUtils.evaluate(((UserTO) template).getUsername(), subjectTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ ((UserTO) subjectTO).setUsername(evaluated);
+ }
+ }
+
+ if (StringUtils.isNotBlank(((UserTO) template).getPassword())) {
+ String evaluated = JexlUtils.evaluate(((UserTO) template).getPassword(), subjectTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ ((UserTO) subjectTO).setPassword(evaluated);
+ }
+ }
+
+ Map<Long, MembershipTO> currentMembs = ((UserTO) subjectTO).getMembershipMap();
+ for (MembershipTO membTO : ((UserTO) template).getMemberships()) {
+ MembershipTO membTBU;
+ if (currentMembs.containsKey(membTO.getGroupKey())) {
+ membTBU = currentMembs.get(membTO.getGroupKey());
+ } else {
+ membTBU = new MembershipTO();
+ membTBU.setGroupKey(membTO.getGroupKey());
+ ((UserTO) subjectTO).getMemberships().add(membTBU);
+ }
+ fillFromTemplate(membTBU, membTO);
+ }
+ }
+ if (template instanceof GroupTO) {
+ if (StringUtils.isNotBlank(((GroupTO) template).getName())) {
+ String evaluated = JexlUtils.evaluate(((GroupTO) template).getName(), subjectTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ ((GroupTO) subjectTO).setName(evaluated);
+ }
+ }
+
+ if (((GroupTO) template).getUserOwner() != null) {
+ final User userOwner = userDAO.find(((GroupTO) template).getUserOwner());
+ if (userOwner != null) {
+ ((GroupTO) subjectTO).setUserOwner(userOwner.getKey());
+ }
+ }
+ if (((GroupTO) template).getGroupOwner() != null) {
+ final Group groupOwner = groupDAO.find(((GroupTO) template).getGroupOwner());
+ if (groupOwner != null) {
+ ((GroupTO) subjectTO).setGroupOwner(groupOwner.getKey());
+ }
+ }
+
+ ((GroupTO) subjectTO).getGPlainAttrTemplates().addAll(((GroupTO) template).getGPlainAttrTemplates());
+ ((GroupTO) subjectTO).getGDerAttrTemplates().addAll(((GroupTO) template).getGDerAttrTemplates());
+ ((GroupTO) subjectTO).getGVirAttrTemplates().addAll(((GroupTO) template).getGVirAttrTemplates());
+ ((GroupTO) subjectTO).getMPlainAttrTemplates().addAll(((GroupTO) template).getMPlainAttrTemplates());
+ ((GroupTO) subjectTO).getMDerAttrTemplates().addAll(((GroupTO) template).getMDerAttrTemplates());
+ ((GroupTO) subjectTO).getMVirAttrTemplates().addAll(((GroupTO) template).getMVirAttrTemplates());
+ }
+
+ fillFromTemplate(subjectTO, template);
+
+ for (String resource : template.getResources()) {
+ subjectTO.getResources().add(resource);
+ }
+ }
+
+ return subjectTO;
+ }
+
+ /**
+ * Extract password value from passed value (if instance of GuardedString or GuardedByteArray).
+ *
+ * @param pwd received from the underlying connector
+ * @return password value
+ */
+ public String getPassword(final Object pwd) {
+ final StringBuilder result = new StringBuilder();
+
+ if (pwd instanceof GuardedString) {
+ ((GuardedString) pwd).access(new GuardedString.Accessor() {
+
+ @Override
+ public void access(final char[] clearChars) {
+ result.append(clearChars);
+ }
+ });
+ } else if (pwd instanceof GuardedByteArray) {
+ ((GuardedByteArray) pwd).access(new GuardedByteArray.Accessor() {
+
+ @Override
+ public void access(final byte[] clearBytes) {
+ result.append(new String(clearBytes));
+ }
+ });
+ } else if (pwd instanceof String) {
+ result.append((String) pwd);
+ } else {
+ result.append(pwd.toString());
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * Get connector object TO from a connector object.
+ *
+ * @param connObject connector object.
+ * @return connector object TO.
+ */
+ public ConnObjectTO getConnObjectTO(final ConnectorObject connObject) {
+ final ConnObjectTO connObjectTO = new ConnObjectTO();
+
+ for (Attribute attr : connObject.getAttributes()) {
+ AttrTO attrTO = new AttrTO();
+ attrTO.setSchema(attr.getName());
+
+ if (attr.getValue() != null) {
+ for (Object value : attr.getValue()) {
+ if (value != null) {
+ if (value instanceof GuardedString || value instanceof GuardedByteArray) {
+ attrTO.getValues().add(getPassword(value));
+ } else if (value instanceof byte[]) {
+ attrTO.getValues().add(Base64.encode((byte[]) value));
+ } else {
+ attrTO.getValues().add(value.toString());
+ }
+ }
+ }
+ }
+
+ connObjectTO.getPlainAttrs().add(attrTO);
+ }
+
+ return connObjectTO;
+ }
+
+ /**
+ * Query connected external resources for values to populated virtual attributes associated with the given owner.
+ *
+ * @param owner user or group
+ * @param attrUtils attributable util
+ */
+ public void retrieveVirAttrValues(final Attributable<?, ?, ?> owner, final AttributableUtils attrUtils) {
+ final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
+ final ConnectorFactory connFactory = context.getBean(ConnectorFactory.class);
+
+ final IntMappingType type = attrUtils.getType() == AttributableType.USER
+ ? IntMappingType.UserVirtualSchema : attrUtils.getType() == AttributableType.GROUP
+ ? IntMappingType.GroupVirtualSchema : IntMappingType.MembershipVirtualSchema;
+
+ final Map<String, ConnectorObject> externalResources = new HashMap<>();
+
+ // -----------------------
+ // Retrieve virtual attribute values if and only if they have not been retrieved yet
+ // -----------------------
+ for (VirAttr virAttr : owner.getVirAttrs()) {
+ // reset value set
+ if (virAttr.getValues().isEmpty()) {
+ retrieveVirAttrValue(owner, virAttr, attrUtils, type, externalResources, connFactory);
+ }
+ }
+ // -----------------------
+ }
+
+ private void retrieveVirAttrValue(
+ final Attributable<?, ?, ?> owner,
+ final VirAttr virAttr,
+ final AttributableUtils attrUtils,
+ final IntMappingType type,
+ final Map<String, ConnectorObject> externalResources,
+ final ConnectorFactory connFactory) {
+
+ final String schemaName = virAttr.getSchema().getKey();
+ final VirAttrCacheValue virAttrCacheValue = virAttrCache.get(attrUtils.getType(), owner.getKey(), schemaName);
+
+ LOG.debug("Retrieve values for virtual attribute {} ({})", schemaName, type);
+
+ if (virAttrCache.isValidEntry(virAttrCacheValue)) {
+ // cached ...
+ LOG.debug("Values found in cache {}", virAttrCacheValue);
+ virAttr.getValues().clear();
+ virAttr.getValues().addAll(new ArrayList<>(virAttrCacheValue.getValues()));
+ } else {
+ // not cached ...
+ LOG.debug("Need one or more remote connections");
+
+ final VirAttrCacheValue toBeCached = new VirAttrCacheValue();
+
+ // SYNCOPE-458 if virattr owner is a Membership, owner must become user involved in membership because
+ // membership mapping is contained in user mapping
+ final Subject<?, ?, ?> realOwner = owner instanceof Membership
+ ? ((Membership) owner).getUser()
+ : (Subject) owner;
+
+ final Set<ExternalResource> targetResources = owner instanceof Membership
+ ? getTargetResources(virAttr, type, attrUtils, realOwner.getResources())
+ : getTargetResources(virAttr, type, attrUtils);
+
+ for (ExternalResource resource : targetResources) {
+ LOG.debug("Search values into {}", resource.getKey());
+ try {
+ List<MappingItem> mappings = attrUtils.getMappingItems(resource, MappingPurpose.BOTH);
+
+ ConnectorObject connectorObject;
+ if (externalResources.containsKey(resource.getKey())) {
+ connectorObject = externalResources.get(resource.getKey());
+ } else {
+ LOG.debug("Perform connection to {}", resource.getKey());
+ final String accountId = attrUtils.getAccountIdItem(resource) == null
+ ? null
+ : MappingUtils.getAccountIdValue(
+ realOwner, resource, attrUtils.getAccountIdItem(resource));
+
+ if (StringUtils.isBlank(accountId)) {
+ throw new IllegalArgumentException("No AccountId found for " + resource.getKey());
+ }
+
+ Connector connector = connFactory.getConnector(resource);
+
+ OperationOptions oo =
+ connector.getOperationOptions(MappingUtils.getMatchingMappingItems(mappings, type));
+
+ connectorObject = connector.getObject(fromSubject(realOwner), new Uid(accountId), oo);
+ externalResources.put(resource.getKey(), connectorObject);
+ }
+
+ if (connectorObject != null) {
+ // ask for searched virtual attribute value
+ Collection<MappingItem> virAttrMappings =
+ MappingUtils.getMatchingMappingItems(mappings, schemaName, type);
+
+ // the same virtual attribute could be mapped with one or more external attribute
+ for (MappingItem mapping : virAttrMappings) {
+ final Attribute attribute = connectorObject.getAttributeByName(mapping.getExtAttrName());
+
+ if (attribute != null && attribute.getValue() != null) {
+ for (Object obj : attribute.getValue()) {
+ if (obj != null) {
+ virAttr.getValues().add(obj.toString());
+ }
+ }
+ }
+ }
+
+ toBeCached.setResourceValues(resource.getKey(), new HashSet<>(virAttr.getValues()));
+
+ LOG.debug("Retrieved values {}", virAttr.getValues());
+ }
+ } catch (Exception e) {
+ LOG.error("Error reading connector object from {}", resource.getKey(), e);
+
+ if (virAttrCacheValue != null) {
+ toBeCached.forceExpiring();
+ LOG.debug("Search for a cached value (even expired!) ...");
+ final Set<String> cachedValues = virAttrCacheValue.getValues(resource.getKey());
+ if (cachedValues != null) {
+ LOG.debug("Use cached value {}", cachedValues);
+ virAttr.getValues().addAll(cachedValues);
+ toBeCached.setResourceValues(resource.getKey(), new HashSet<>(cachedValues));
+ }
+ }
+ }
+ }
+
+ virAttrCache.put(attrUtils.getType(), owner.getKey(), schemaName, toBeCached);
+ }
+ }
+
+ private Set<ExternalResource> getTargetResources(
+ final VirAttr attr, final IntMappingType type, final AttributableUtils attrUtils) {
+
+ final Set<ExternalResource> resources = new HashSet<>();
+
+ if (attr.getOwner() instanceof Subject) {
+ for (ExternalResource res : ((Subject<?, ?, ?>) attr.getOwner()).getResources()) {
+ if (!MappingUtils.getMatchingMappingItems(
+ attrUtils.getMappingItems(res, MappingPurpose.BOTH),
+ attr.getSchema().getKey(), type).isEmpty()) {
+
+ resources.add(res);
+ }
+ }
+ }
+
+ return resources;
+ }
+
+ private Set<ExternalResource> getTargetResources(final VirAttr attr, final IntMappingType type,
+ final AttributableUtils attrUtils, final Set<? extends ExternalResource> ownerResources) {
+
+ final Set<ExternalResource> resources = new HashSet<>();
+
+ for (ExternalResource res : ownerResources) {
+ if (!MappingUtils.getMatchingMappingItems(
+ attrUtils.getMappingItems(res, MappingPurpose.BOTH),
+ attr.getSchema().getKey(), type).isEmpty()) {
+
+ resources.add(res);
+ }
+ }
+
+ return resources;
+ }
+
+ private void fillFromTemplate(final AbstractAttributableTO attributableTO, final AbstractAttributableTO template) {
+ Map<String, AttrTO> currentAttrMap = attributableTO.getPlainAttrMap();
+ for (AttrTO templateAttr : template.getPlainAttrs()) {
+ if (templateAttr.getValues() != null && !templateAttr.getValues().isEmpty()
+ && (!currentAttrMap.containsKey(templateAttr.getSchema())
+ || currentAttrMap.get(templateAttr.getSchema()).getValues().isEmpty())) {
+
+ attributableTO.getPlainAttrs().add(evaluateAttrTemplate(attributableTO, templateAttr));
+ }
+ }
+
+ currentAttrMap = attributableTO.getDerAttrMap();
+ for (AttrTO templateDerAttr : template.getDerAttrs()) {
+ if (!currentAttrMap.containsKey(templateDerAttr.getSchema())) {
+ attributableTO.getDerAttrs().add(templateDerAttr);
+ }
+ }
+
+ currentAttrMap = attributableTO.getVirAttrMap();
+ for (AttrTO templateVirAttr : template.getVirAttrs()) {
+ if (templateVirAttr.getValues() != null && !templateVirAttr.getValues().isEmpty()
+ && (!currentAttrMap.containsKey(templateVirAttr.getSchema())
+ || currentAttrMap.get(templateVirAttr.getSchema()).getValues().isEmpty())) {
+
+ attributableTO.getVirAttrs().add(evaluateAttrTemplate(attributableTO, templateVirAttr));
+ }
+ }
+ }
+
+ private AttrTO evaluateAttrTemplate(final AbstractAttributableTO attributableTO, final AttrTO template) {
+ AttrTO result = new AttrTO();
+ result.setSchema(template.getSchema());
+
+ if (template.getValues() != null && !template.getValues().isEmpty()) {
+ for (String value : template.getValues()) {
+ String evaluated = JexlUtils.evaluate(value, attributableTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ result.getValues().add(evaluated);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Transform a
+ * <code>Collection</code> of {@link Attribute} instances into a {@link Map}. The key to each element in the map is
+ * the <i>name</i> of an
+ * <code>Attribute</code>. The value of each element in the map is the
+ * <code>Attribute</code> instance with that name. <br/> Different from the original because: <ul> <li>map keys are
+ * transformed toUpperCase()</li> <li>returned map is mutable</li> </ul>
+ *
+ * @param attributes set of attribute to transform to a map.
+ * @return a map of string and attribute.
+ *
+ * @see org.identityconnectors.framework.common.objects.AttributeUtil#toMap(java.util.Collection)
+ */
+ public Map<String, Attribute> toMap(final Collection<? extends Attribute> attributes) {
+ final Map<String, Attribute> map = new HashMap<>();
+ for (Attribute attr : attributes) {
+ map.put(attr.getName().toUpperCase(), attr);
+ }
+ return map;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtil.java
deleted file mode 100644
index 8dcebec..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtil.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.misc;
-
-import org.apache.commons.lang3.exception.ExceptionUtils;
-
-public final class ExceptionUtil {
-
- /**
- * Uses commons lang's ExceptionUtils to provide a representation of the full stack trace of the given throwable.
- *
- * @param t throwable to build stack trace from
- * @return a string representation of full stack trace of the given throwable
- */
- public static String getFullStackTrace(final Throwable t) {
- StringBuilder result = new StringBuilder();
-
- for (Throwable throwable : ExceptionUtils.getThrowableList(t)) {
- result.append(ExceptionUtils.getMessage(throwable)).append('\n').
- append(ExceptionUtils.getStackTrace(throwable)).append("\n\n");
- }
-
- return result.toString();
- }
-
- /**
- * Private default constructor, for static-only classes.
- */
- private ExceptionUtil() {
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtils2.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtils2.java b/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtils2.java
new file mode 100644
index 0000000..a4f04a6
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtils2.java
@@ -0,0 +1,47 @@
+/*
+ * 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.misc;
+
+import org.apache.commons.lang3.exception.ExceptionUtils;
+
+public final class ExceptionUtils2 {
+
+ /**
+ * Uses commons lang's ExceptionUtils to provide a representation of the full stack trace of the given throwable.
+ *
+ * @param t throwable to build stack trace from
+ * @return a string representation of full stack trace of the given throwable
+ */
+ public static String getFullStackTrace(final Throwable t) {
+ StringBuilder result = new StringBuilder();
+
+ for (Throwable throwable : ExceptionUtils.getThrowableList(t)) {
+ result.append(ExceptionUtils.getMessage(throwable)).append('\n').
+ append(ExceptionUtils.getStackTrace(throwable)).append("\n\n");
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * Private default constructor, for static-only classes.
+ */
+ private ExceptionUtils2() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java
deleted file mode 100644
index 8075650..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java
+++ /dev/null
@@ -1,738 +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.misc;
-
-import org.apache.syncope.core.misc.policy.InvalidPasswordPolicySpecException;
-import org.apache.syncope.core.misc.security.PasswordGenerator;
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.jexl2.JexlContext;
-import org.apache.commons.jexl2.MapContext;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.mod.AttrMod;
-import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
-import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.persistence.api.entity.EntityFactory;
-import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.Subject;
-import org.apache.syncope.core.persistence.api.entity.VirAttr;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
-import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
-import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
-import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
-import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
-import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.user.UVirSchema;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
-import org.apache.syncope.core.misc.security.Encryptor;
-import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.misc.jexl.JexlUtil;
-import org.identityconnectors.framework.common.FrameworkUtil;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.identityconnectors.framework.common.objects.AttributeUtil;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.OperationalAttributes;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ConfigurableApplicationContext;
-
-public final class MappingUtil {
-
- /**
- * Logger.
- */
- private static final Logger LOG = LoggerFactory.getLogger(MappingUtil.class);
-
- private static final Encryptor ENCRYPTOR = Encryptor.getInstance();
-
- public static <T extends MappingItem> List<T> getMatchingMappingItems(
- final Collection<T> items, final IntMappingType type) {
-
- final List<T> result = new ArrayList<>();
-
- for (T mapItem : items) {
- if (mapItem.getIntMappingType() == type) {
- result.add(mapItem);
- }
- }
-
- return result;
- }
-
- public static <T extends MappingItem> List<T> getMatchingMappingItems(final Collection<T> items,
- final String intAttrName, final IntMappingType type) {
-
- final List<T> result = new ArrayList<>();
-
- for (T mapItem : items) {
- if (mapItem.getIntMappingType() == type && intAttrName.equals(mapItem.getIntAttrName())) {
- result.add(mapItem);
- }
- }
-
- return result;
- }
-
- public static <T extends MappingItem> Set<T> getMatchingMappingItems(final Collection<T> mapItems,
- final String intAttrName) {
-
- final Set<T> result = new HashSet<>();
-
- for (T mapItem : mapItems) {
- if (intAttrName.equals(mapItem.getIntAttrName())) {
- result.add(mapItem);
- }
- }
-
- return result;
- }
-
- /**
- * Prepare attributes for sending to a connector instance.
- *
- * @param attrUtil user / group
- * @param subject given user / group
- * @param password clear-text password
- * @param changePwd whether password should be included for propagation attributes or not
- * @param vAttrsToBeRemoved virtual attributes to be removed
- * @param vAttrsToBeUpdated virtual attributes to be added
- * @param membVAttrsToBeRemoved membership virtual attributes to be removed
- * @param membVAttrsToBeUpdated membership virtual attributes to be added
- * @param enable whether user must be enabled or not
- * @param resource target resource
- * @return account link + prepared attributes
- */
- public static Map.Entry<String, Set<Attribute>> prepareAttributes(
- final AttributableUtil attrUtil, final Subject<?, ?, ?> subject,
- final String password,
- final boolean changePwd,
- final Set<String> vAttrsToBeRemoved,
- final Map<String, AttrMod> vAttrsToBeUpdated,
- final Set<String> membVAttrsToBeRemoved,
- final Map<String, AttrMod> membVAttrsToBeUpdated,
- final Boolean enable,
- final ExternalResource resource) {
-
- LOG.debug("Preparing resource attributes for {} on resource {} with attributes {}",
- subject, resource, subject.getPlainAttrs());
-
- final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
- final VirAttrCache virAttrCache = context.getBean(VirAttrCache.class);
- final PasswordGenerator passwordGenerator = context.getBean(PasswordGenerator.class);
-
- Set<Attribute> attributes = new HashSet<>();
- String accountId = null;
-
- for (MappingItem mapping : attrUtil.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
- LOG.debug("Processing schema {}", mapping.getIntAttrName());
-
- try {
- if ((attrUtil.getType() == AttributableType.USER
- && mapping.getIntMappingType() == IntMappingType.UserVirtualSchema)
- || (attrUtil.getType() == AttributableType.GROUP
- && mapping.getIntMappingType() == IntMappingType.GroupVirtualSchema)) {
-
- LOG.debug("Expire entry cache {}-{}", subject.getKey(), mapping.getIntAttrName());
- virAttrCache.expire(attrUtil.getType(), subject.getKey(), mapping.getIntAttrName());
- }
-
- // SYNCOPE-458 expire cache also for membership virtual schemas
- if (attrUtil.getType() == AttributableType.USER && mapping.getIntMappingType()
- == IntMappingType.MembershipVirtualSchema && (subject instanceof User)) {
-
- final User user = (User) subject;
- for (Membership membership : user.getMemberships()) {
- LOG.debug("Expire entry cache {}-{} for membership {}", subject.getKey(),
- mapping.getIntAttrName(), membership);
- virAttrCache.expire(AttributableType.MEMBERSHIP, membership.getKey(),
- mapping.getIntAttrName());
- }
- }
-
- Map.Entry<String, Attribute> preparedAttr = prepareAttr(
- resource, mapping, subject, password, passwordGenerator, vAttrsToBeRemoved, vAttrsToBeUpdated,
- membVAttrsToBeRemoved, membVAttrsToBeUpdated);
-
- if (preparedAttr != null && preparedAttr.getKey() != null) {
- accountId = preparedAttr.getKey();
- }
-
- if (preparedAttr != null && preparedAttr.getValue() != null) {
- Attribute alreadyAdded = AttributeUtil.find(preparedAttr.getValue().getName(), attributes);
-
- if (alreadyAdded == null) {
- attributes.add(preparedAttr.getValue());
- } else {
- attributes.remove(alreadyAdded);
-
- Set<Object> values = new HashSet<>(alreadyAdded.getValue());
- values.addAll(preparedAttr.getValue().getValue());
-
- attributes.add(AttributeBuilder.build(preparedAttr.getValue().getName(), values));
- }
- }
- } catch (Exception e) {
- LOG.debug("Attribute '{}' processing failed", mapping.getIntAttrName(), e);
- }
- }
-
- final Attribute accountIdExtAttr =
- AttributeUtil.find(attrUtil.getAccountIdItem(resource).getExtAttrName(), attributes);
- if (accountIdExtAttr != null) {
- attributes.remove(accountIdExtAttr);
- attributes.add(AttributeBuilder.build(attrUtil.getAccountIdItem(resource).getExtAttrName(), accountId));
- }
- attributes.add(MappingUtil.evaluateNAME(subject, resource, accountId));
-
- if (enable != null) {
- attributes.add(AttributeBuilder.buildEnabled(enable));
- }
- if (!changePwd) {
- Attribute pwdAttr = AttributeUtil.find(OperationalAttributes.PASSWORD_NAME, attributes);
- if (pwdAttr != null) {
- attributes.remove(pwdAttr);
- }
- }
-
- return new AbstractMap.SimpleEntry<>(accountId, attributes);
- }
-
- /**
- * Prepare an attribute to be sent to a connector instance.
- *
- * @param resource target resource
- * @param mapItem mapping item for the given attribute
- * @param subject given user
- * @param password clear-text password
- * @param passwordGenerator password generator
- * @param vAttrsToBeRemoved virtual attributes to be removed
- * @param vAttrsToBeUpdated virtual attributes to be added
- * @return account link + prepared attribute
- */
- @SuppressWarnings("unchecked")
- private static Map.Entry<String, Attribute> prepareAttr(
- final ExternalResource resource, final MappingItem mapItem,
- final Subject<?, ?, ?> subject, final String password, final PasswordGenerator passwordGenerator,
- final Set<String> vAttrsToBeRemoved, final Map<String, AttrMod> vAttrsToBeUpdated,
- final Set<String> membVAttrsToBeRemoved, final Map<String, AttrMod> membVAttrsToBeUpdated) {
-
- final List<Attributable<?, ?, ?>> attributables = new ArrayList<>();
-
- final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
- final AttributableUtilFactory attrUtilFactory = context.getBean(AttributableUtilFactory.class);
- final ConnObjectUtil connObjectUtil = context.getBean(ConnObjectUtil.class);
-
- switch (mapItem.getIntMappingType().getAttributableType()) {
- case USER:
- if (subject instanceof User) {
- attributables.add(subject);
- }
- break;
-
- case GROUP:
- if (subject instanceof User) {
- for (Group group : ((User) subject).getGroups()) {
- connObjectUtil.retrieveVirAttrValues(group, attrUtilFactory.getInstance(group));
- attributables.add(group);
- }
- }
- if (subject instanceof Group) {
- attributables.add(subject);
- }
- break;
-
- case MEMBERSHIP:
- if (subject instanceof User) {
- attributables.addAll(((User) subject).getMemberships());
- }
- break;
-
- default:
- }
-
- List<PlainAttrValue> values = getIntValues(
- resource, mapItem, attributables, vAttrsToBeRemoved, vAttrsToBeUpdated, membVAttrsToBeRemoved,
- membVAttrsToBeUpdated);
-
- PlainSchema schema = null;
- boolean readOnlyVirSchema = false;
- AttrSchemaType schemaType;
- final Map.Entry<String, Attribute> result;
-
- switch (mapItem.getIntMappingType()) {
- case UserPlainSchema:
- case GroupPlainSchema:
- case MembershipPlainSchema:
- final PlainSchemaDAO plainSchemaDAO = context.getBean(PlainSchemaDAO.class);
- schema = plainSchemaDAO.find(mapItem.getIntAttrName(),
- MappingUtil.getIntMappingTypeClass(mapItem.getIntMappingType()));
- schemaType = schema == null ? AttrSchemaType.String : schema.getType();
- break;
-
- case UserVirtualSchema:
- case GroupVirtualSchema:
- case MembershipVirtualSchema:
- VirSchemaDAO virSchemaDAO = context.getBean(VirSchemaDAO.class);
- VirSchema virSchema = virSchemaDAO.find(mapItem.getIntAttrName(),
- MappingUtil.getIntMappingTypeClass(mapItem.getIntMappingType()));
- readOnlyVirSchema = (virSchema != null && virSchema.isReadonly());
- schemaType = AttrSchemaType.String;
- break;
-
- default:
- schemaType = AttrSchemaType.String;
- }
-
- final String extAttrName = mapItem.getExtAttrName();
-
- LOG.debug("Define mapping for: "
- + "\n* ExtAttrName " + extAttrName
- + "\n* is accountId " + mapItem.isAccountid()
- + "\n* is password " + (mapItem.isPassword() || mapItem.getIntMappingType() == IntMappingType.Password)
- + "\n* mandatory condition " + mapItem.getMandatoryCondition()
- + "\n* Schema " + mapItem.getIntAttrName()
- + "\n* IntMappingType " + mapItem.getIntMappingType().toString()
- + "\n* ClassType " + schemaType.getType().getName()
- + "\n* Values " + values);
-
- if (readOnlyVirSchema) {
- result = null;
- } else {
- final List<Object> objValues = new ArrayList<>();
-
- for (PlainAttrValue value : values) {
- if (FrameworkUtil.isSupportedAttributeType(schemaType.getType())) {
- objValues.add(value.getValue());
- } else {
- objValues.add(value.getValueAsString());
- }
- }
-
- if (mapItem.isAccountid()) {
- result = new AbstractMap.SimpleEntry<>(objValues.iterator().next().toString(), null);
- } else if (mapItem.isPassword() && subject instanceof User) {
- String passwordAttrValue = password;
- if (StringUtils.isBlank(passwordAttrValue)) {
- User user = (User) subject;
- if (user.canDecodePassword()) {
- try {
- passwordAttrValue = ENCRYPTOR.decode(user.getPassword(), user.getCipherAlgorithm());
- } catch (Exception e) {
- LOG.error("Could not decode password for {}", user, e);
- }
- } else if (resource.isRandomPwdIfNotProvided()) {
- try {
- passwordAttrValue = passwordGenerator.generate(user);
- } catch (InvalidPasswordPolicySpecException e) {
- LOG.error("Could not generate policy-compliant random password for {}", user, e);
- }
- }
- }
-
- if (passwordAttrValue == null) {
- result = null;
- } else {
- result = new AbstractMap.SimpleEntry<>(
- null,
- AttributeBuilder.buildPassword(passwordAttrValue.toCharArray()));
- }
- } else {
- if ((schema != null && schema.isMultivalue()) || attrUtilFactory.getInstance(subject).getType()
- != mapItem.getIntMappingType().getAttributableType()) {
-
- result = new AbstractMap.SimpleEntry<>(
- null,
- AttributeBuilder.build(extAttrName, objValues));
- } else {
- result = new AbstractMap.SimpleEntry<>(
- null, objValues.isEmpty()
- ? AttributeBuilder.build(extAttrName)
- : AttributeBuilder.build(extAttrName, objValues.iterator().next()));
- }
- }
- }
-
- return result;
- }
-
- /**
- * Build __NAME__ for propagation. First look if there ia a defined accountLink for the given resource (and in this
- * case evaluate as JEXL); otherwise, take given accountId.
- *
- * @param subject given user / group
- * @param resource target resource
- * @param accountId accountId
- * @return the value to be propagated as __NAME__
- */
- public static Name evaluateNAME(final Subject<?, ?, ?> subject,
- final ExternalResource resource, final String accountId) {
-
- final AttributableUtilFactory attrUtilFactory =
- ApplicationContextProvider.getApplicationContext().getBean(AttributableUtilFactory.class);
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(subject);
-
- if (StringUtils.isBlank(accountId)) {
- // LOG error but avoid to throw exception: leave it to the external resource
- LOG.error("Missing accountId for '{}': ", resource.getKey());
- }
-
- // Evaluate AccountLink expression
- String evalAccountLink = null;
- if (StringUtils.isNotBlank(attrUtil.getAccountLink(resource))) {
- final JexlContext jexlContext = new MapContext();
- JexlUtil.addFieldsToContext(subject, jexlContext);
- JexlUtil.addAttrsToContext(subject.getPlainAttrs(), jexlContext);
- JexlUtil.addDerAttrsToContext(subject.getDerAttrs(), subject.getPlainAttrs(), jexlContext);
- evalAccountLink = JexlUtil.evaluate(attrUtil.getAccountLink(resource), jexlContext);
- }
-
- // If AccountLink evaluates to an empty string, just use the provided AccountId as Name(),
- // otherwise evaluated AccountLink expression is taken as Name().
- Name name;
- if (StringUtils.isBlank(evalAccountLink)) {
- // add AccountId as __NAME__ attribute ...
- LOG.debug("Add AccountId [{}] as __NAME__", accountId);
- name = new Name(accountId);
- } else {
- LOG.debug("Add AccountLink [{}] as __NAME__", evalAccountLink);
- name = new Name(evalAccountLink);
-
- // AccountId not propagated: it will be used to set the value for __UID__ attribute
- LOG.debug("AccountId will be used just as __UID__ attribute");
- }
-
- return name;
- }
-
- private static String getGroupOwnerValue(
- final ExternalResource resource, final Subject<?, ?, ?> subject) {
-
- AttributableUtilFactory attrUtilFactory =
- ApplicationContextProvider.getApplicationContext().getBean(AttributableUtilFactory.class);
-
- Map.Entry<String, Attribute> preparedAttr = prepareAttr(
- resource, attrUtilFactory.getInstance(subject).getAccountIdItem(resource), subject, null, null,
- Collections.<String>emptySet(), Collections.<String, AttrMod>emptyMap(),
- Collections.<String>emptySet(), Collections.<String, AttrMod>emptyMap());
- String accountId = preparedAttr.getKey();
-
- final Name groupOwnerName = evaluateNAME(subject, resource, accountId);
- return groupOwnerName.getNameValue();
- }
-
- /**
- * Get attribute values.
- *
- * @param resource target resource
- * @param mappingItem mapping item
- * @param attributables list of attributables
- * @param vAttrsToBeRemoved virtual attributes to be removed
- * @param vAttrsToBeUpdated virtual attributes to be added
- * @param membVAttrsToBeRemoved membership virtual attributes to be removed
- * @param membVAttrsToBeUpdated membership virtual attributes to be added
- * @return attribute values.
- */
- public static List<PlainAttrValue> getIntValues(final ExternalResource resource,
- final MappingItem mappingItem, final List<Attributable<?, ?, ?>> attributables,
- final Set<String> vAttrsToBeRemoved, final Map<String, AttrMod> vAttrsToBeUpdated,
- final Set<String> membVAttrsToBeRemoved, final Map<String, AttrMod> membVAttrsToBeUpdated) {
-
- LOG.debug("Get attributes for '{}' and mapping type '{}'", attributables, mappingItem.getIntMappingType());
-
- final EntityFactory entityFactory =
- ApplicationContextProvider.getApplicationContext().getBean(EntityFactory.class);
- List<PlainAttrValue> values = new ArrayList<>();
- PlainAttrValue attrValue;
- switch (mappingItem.getIntMappingType()) {
- case UserPlainSchema:
- case GroupPlainSchema:
- case MembershipPlainSchema:
- for (Attributable<?, ?, ?> attributable : attributables) {
- final PlainAttr attr = attributable.getPlainAttr(mappingItem.getIntAttrName());
- if (attr != null) {
- if (attr.getUniqueValue() != null) {
- values.add(attr.getUniqueValue());
- } else if (attr.getValues() != null) {
- values.addAll(attr.getValues());
- }
- }
-
- LOG.debug("Retrieved attribute {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- attr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
- }
-
- break;
-
- case UserVirtualSchema:
- case GroupVirtualSchema:
- for (Attributable<?, ?, ?> attributable : attributables) {
- VirAttr virAttr = attributable.getVirAttr(mappingItem.getIntAttrName());
- if (virAttr != null) {
- if (vAttrsToBeRemoved != null && vAttrsToBeUpdated != null) {
- if (vAttrsToBeUpdated.containsKey(mappingItem.getIntAttrName())) {
- virAttr.getValues().clear();
- virAttr.getValues().addAll(
- vAttrsToBeUpdated.get(mappingItem.getIntAttrName()).getValuesToBeAdded());
- } else if (vAttrsToBeRemoved.contains(mappingItem.getIntAttrName())) {
- virAttr.getValues().clear();
- } else {
- throw new IllegalArgumentException("Don't need to update virtual attribute '"
- + mappingItem.getIntAttrName() + "'");
- }
- }
- if (virAttr.getValues() != null) {
- for (String value : virAttr.getValues()) {
- attrValue = entityFactory.newEntity(UPlainAttrValue.class);
- attrValue.setStringValue(value);
- values.add(attrValue);
- }
- }
- }
-
- LOG.debug("Retrieved {} virtual attribute {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- attributable.getClass().getSimpleName(),
- virAttr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
- }
- break;
-
- case MembershipVirtualSchema:
- for (Attributable<?, ?, ?> attributable : attributables) {
- VirAttr virAttr = attributable.getVirAttr(mappingItem.getIntAttrName());
- if (virAttr != null) {
- if (membVAttrsToBeRemoved != null && membVAttrsToBeUpdated != null) {
- if (membVAttrsToBeUpdated.containsKey(mappingItem.getIntAttrName())) {
- virAttr.getValues().clear();
- virAttr.getValues().addAll(
- membVAttrsToBeUpdated.get(mappingItem.getIntAttrName()).getValuesToBeAdded());
- } else if (membVAttrsToBeRemoved.contains(mappingItem.getIntAttrName())) {
- virAttr.getValues().clear();
- } else {
- throw new IllegalArgumentException("Don't need to update membership virtual attribute '"
- + mappingItem.getIntAttrName() + "'");
- }
- }
- if (virAttr.getValues() != null) {
- for (String value : virAttr.getValues()) {
- attrValue = entityFactory.newEntity(UPlainAttrValue.class);
- attrValue.setStringValue(value);
- values.add(attrValue);
- }
- }
- }
-
- LOG.debug("Retrieved {} virtual attribute {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- attributable.getClass().getSimpleName(),
- virAttr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
- }
- break;
-
- case UserDerivedSchema:
- case GroupDerivedSchema:
- case MembershipDerivedSchema:
- for (Attributable<?, ?, ?> attributable : attributables) {
- DerAttr derAttr = attributable.getDerAttr(mappingItem.getIntAttrName());
- if (derAttr != null) {
- attrValue = attributable instanceof Group
- ? entityFactory.newEntity(GPlainAttrValue.class)
- : entityFactory.newEntity(UPlainAttrValue.class);
- attrValue.setStringValue(derAttr.getValue(attributable.getPlainAttrs()));
- values.add(attrValue);
- }
-
- LOG.debug("Retrieved attribute {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- derAttr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
- }
- break;
-
- case UserId:
- case GroupId:
- case MembershipId:
- for (Attributable<?, ?, ?> attributable : attributables) {
- attrValue = entityFactory.newEntity(UPlainAttrValue.class);
- attrValue.setStringValue(attributable.getKey().toString());
- values.add(attrValue);
- }
- break;
-
- case Username:
- for (Attributable<?, ?, ?> attributable : attributables) {
- if (attributable instanceof User) {
- attrValue = entityFactory.newEntity(UPlainAttrValue.class);
- attrValue.setStringValue(((User) attributable).getUsername());
- values.add(attrValue);
- }
- }
- break;
-
- case GroupName:
- for (Attributable<?, ?, ?> attributable : attributables) {
- if (attributable instanceof Group) {
- attrValue = entityFactory.newEntity(GPlainAttrValue.class);
- attrValue.setStringValue(((Group) attributable).getName());
- values.add(attrValue);
- }
- }
- break;
-
- case GroupOwnerSchema:
- for (Attributable<?, ?, ?> attributable : attributables) {
- if (attributable instanceof Group) {
- Group group = (Group) attributable;
- String groupOwnerValue = null;
- if (group.getUserOwner() != null && resource.getUmapping() != null) {
- groupOwnerValue = getGroupOwnerValue(resource, group.getUserOwner());
- }
- if (group.getGroupOwner() != null && resource.getGmapping() != null) {
- groupOwnerValue = getGroupOwnerValue(resource, group.getGroupOwner());
- }
-
- if (StringUtils.isNotBlank(groupOwnerValue)) {
- attrValue = entityFactory.newEntity(GPlainAttrValue.class);
- attrValue.setStringValue(groupOwnerValue);
- values.add(attrValue);
- }
- }
- }
- break;
-
- default:
- }
-
- LOG.debug("Retrieved values '{}'", values);
-
- return values;
- }
-
- /**
- * Get accountId internal value.
- *
- * @param attributable attributable
- * @param accountIdItem accountId mapping item
- * @param resource external resource
- * @return accountId internal value
- */
- public static String getAccountIdValue(final Attributable<?, ?, ?> attributable,
- final ExternalResource resource, final MappingItem accountIdItem) {
-
- List<PlainAttrValue> values = getIntValues(resource, accountIdItem,
- Collections.<Attributable<?, ?, ?>>singletonList(attributable), null, null, null, null);
- return values == null || values.isEmpty()
- ? null
- : values.get(0).getValueAsString();
- }
-
- /**
- * For given source mapping type, return the corresponding Class object.
- *
- * @param intMappingType source mapping type
- * @return corresponding Class object, if any (can be null)
- */
- @SuppressWarnings("rawtypes")
- public static Class getIntMappingTypeClass(final IntMappingType intMappingType) {
- Class result;
-
- switch (intMappingType) {
- case UserPlainSchema:
- result = UPlainSchema.class;
- break;
-
- case GroupPlainSchema:
- result = GPlainSchema.class;
- break;
-
- case MembershipPlainSchema:
- result = MPlainSchema.class;
- break;
-
- case UserDerivedSchema:
- result = UDerSchema.class;
- break;
-
- case GroupDerivedSchema:
- result = GDerSchema.class;
- break;
-
- case MembershipDerivedSchema:
- result = MDerSchema.class;
- break;
-
- case UserVirtualSchema:
- result = UVirSchema.class;
- break;
-
- case GroupVirtualSchema:
- result = GVirSchema.class;
- break;
-
- case MembershipVirtualSchema:
- result = MVirSchema.class;
- break;
-
- default:
- result = null;
- }
-
- return result;
- }
-
- /**
- * Private default constructor, for static-only classes.
- */
- private MappingUtil() {
- }
-}
[38/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
index 7b1ece2..0aca43b 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
@@ -59,23 +59,12 @@ public class GroupDeleteProcessor implements Processor {
@Override
public void process(final Exchange exchange) throws Exception {
- final List<Group> toBeDeprovisioned = new ArrayList<>();
-
Long subjectKey = exchange.getIn().getBody(Long.class);
- final Group syncopeGroup = groupDAO.find(subjectKey);
-
- if (syncopeGroup != null) {
- toBeDeprovisioned.add(syncopeGroup);
-
- final List<Group> descendants = groupDAO.findDescendants(toBeDeprovisioned.get(0));
- if (descendants != null) {
- toBeDeprovisioned.addAll(descendants);
- }
- }
+ Group group = groupDAO.find(subjectKey);
final List<PropagationTask> tasks = new ArrayList<>();
- for (Group group : toBeDeprovisioned) {
+ if (group != null) {
// Generate propagation tasks for deleting users from group resources, if they are on those resources only
// because of the reason being deleted (see SYNCOPE-357)
for (Map.Entry<Long, PropagationByResource> entry
@@ -83,11 +72,11 @@ public class GroupDeleteProcessor implements Processor {
WorkflowResult<Long> wfResult =
new WorkflowResult<>(entry.getKey(), entry.getValue(), Collections.<String>emptySet());
- tasks.addAll(propagationManager.getUserDeleteTaskIds(wfResult));
+ tasks.addAll(propagationManager.getUserDeleteTasks(wfResult));
}
// Generate propagation tasks for deleting this group from resources
- tasks.addAll(propagationManager.getGroupDeleteTaskIds(group.getKey()));
+ tasks.addAll(propagationManager.getGroupDeleteTasks(group.getKey()));
}
PropagationReporter propagationReporter =
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
index 7953703..f27a113 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
@@ -18,11 +18,12 @@
*/
package org.apache.syncope.core.provisioning.camel.processor;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.group.Group;
@@ -58,11 +59,10 @@ public class GroupDeprovisionProcessor implements Processor {
Group group = groupDAO.authFetch(groupKey);
- Set<String> noPropResourceName = group.getResourceNames();
- noPropResourceName.removeAll(resources);
+ Collection<String> noPropResourceNames = CollectionUtils.removeAll(group.getResourceNames(), resources);
List<PropagationTask> tasks =
- propagationManager.getGroupDeleteTaskIds(groupKey, new HashSet<>(resources), noPropResourceName);
+ propagationManager.getGroupDeleteTasks(groupKey, new HashSet<>(resources), noPropResourceNames);
PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
index a4c073a..fc18e83 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
@@ -18,11 +18,11 @@
*/
package org.apache.syncope.core.provisioning.camel.processor;
-import java.util.AbstractMap;
import java.util.List;
import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.syncope.common.lib.mod.GroupMod;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
@@ -52,10 +52,10 @@ public class GroupUpdateProcessor implements Processor {
public void process(final Exchange exchange) {
WorkflowResult<Long> updated = (WorkflowResult) exchange.getIn().getBody();
GroupMod subjectMod = exchange.getProperty("subjectMod", GroupMod.class);
- Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
+ Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
- List<PropagationTask> tasks = propagationManager.getGroupUpdateTaskIds(updated,
- subjectMod.getVirAttrsToRemove(), subjectMod.getVirAttrsToUpdate(), excludedResource);
+ List<PropagationTask> tasks = propagationManager.getGroupUpdateTasks(updated,
+ subjectMod.getVirAttrsToRemove(), subjectMod.getVirAttrsToUpdate(), excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
@@ -65,7 +65,7 @@ public class GroupUpdateProcessor implements Processor {
propagationReporter.onPrimaryResourceFailure(tasks);
}
- exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(updated.getResult(), propagationReporter.getStatuses()));
+ exchange.getOut().setBody(new ImmutablePair<>(updated.getResult(), propagationReporter.getStatuses()));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java
index 6b63a85..903f882 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java
@@ -48,7 +48,7 @@ public class UserConfirmPwdResetProcessor implements Processor {
public void process(final Exchange exchange) {
User user = exchange.getProperty("user", User.class);
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(user, null, null);
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(user, null, null);
PropagationReporter propReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java
index 34d9a9e..9f6804e 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java
@@ -18,12 +18,12 @@
*/
package org.apache.syncope.core.provisioning.camel.processor;
-import java.util.AbstractMap;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
@@ -53,12 +53,18 @@ public class UserCreateProcessor implements Processor {
public void process(final Exchange exchange) {
if ((exchange.getIn().getBody() instanceof WorkflowResult)) {
- WorkflowResult<Map.Entry<Long, Boolean>> created = (WorkflowResult) exchange.getIn().getBody();
+ WorkflowResult<Pair<Long, Boolean>> created = (WorkflowResult) exchange.getIn().getBody();
UserTO actual = exchange.getProperty("actual", UserTO.class);
- Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
+ Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
- List<PropagationTask> tasks = propagationManager.getUserCreateTaskIds(
- created, actual.getPassword(), actual.getVirAttrs(), excludedResource, actual.getMemberships());
+ List<PropagationTask> tasks = propagationManager.getUserCreateTasks(
+ created.getResult().getKey(),
+ created.getResult().getValue(),
+ created.getPropByRes(),
+ actual.getPassword(),
+ actual.getVirAttrs(),
+ actual.getMemberships(),
+ excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
@@ -69,7 +75,7 @@ public class UserCreateProcessor implements Processor {
}
exchange.getOut().setBody(
- new AbstractMap.SimpleEntry<>(created.getResult().getKey(), propagationReporter.getStatuses()));
+ new ImmutablePair<>(created.getResult().getKey(), propagationReporter.getStatuses()));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java
index 45474a2..8d94d76 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java
@@ -55,7 +55,7 @@ public class UserDeleteProcessor implements Processor {
// information could only be available after uwfAdapter.delete(), which
// will also effectively remove user from db, thus making virtually
// impossible by NotificationManager to fetch required user information
- List<PropagationTask> tasks = propagationManager.getUserDeleteTaskIds(userKey, excludedResource);
+ List<PropagationTask> tasks = propagationManager.getUserDeleteTasks(userKey, excludedResource);
PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java
index 66cc795..e59bec6 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java
@@ -18,11 +18,12 @@
*/
package org.apache.syncope.core.provisioning.camel.processor;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
@@ -56,14 +57,13 @@ public class UserDeprovisionProcessor implements Processor {
@SuppressWarnings("unchecked")
List<String> resources = exchange.getProperty("resources", List.class);
- final User user = userDAO.authFetch(userKey);
+ User user = userDAO.authFetch(userKey);
- final Set<String> noPropResourceName = user.getResourceNames();
- noPropResourceName.removeAll(resources);
+ Collection<String> noPropResourceNames = CollectionUtils.removeAll(user.getResourceNames(), resources);
- final List<PropagationTask> tasks =
- propagationManager.getUserDeleteTaskIds(userKey, new HashSet<>(resources), noPropResourceName);
- final PropagationReporter propagationReporter =
+ List<PropagationTask> tasks =
+ propagationManager.getUserDeleteTasks(userKey, new HashSet<>(resources), noPropResourceNames);
+ PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
taskExecutor.execute(tasks, propagationReporter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserInnerSuspendProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserInnerSuspendProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserInnerSuspendProcessor.java
index c4d648f..be3e6ac 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserInnerSuspendProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserInnerSuspendProcessor.java
@@ -18,11 +18,11 @@
*/
package org.apache.syncope.core.provisioning.camel.processor;
-import java.util.AbstractMap.SimpleEntry;
import java.util.List;
-import java.util.Map;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
@@ -40,9 +40,9 @@ public class UserInnerSuspendProcessor implements Processor {
@Autowired
protected PropagationTaskExecutor taskExecutor;
- @SuppressWarnings("unchecked")
@Override
public void process(final Exchange exchange) {
+ @SuppressWarnings("unchecked")
WorkflowResult<Long> updated = (WorkflowResult) exchange.getIn().getBody();
Boolean propagate = exchange.getProperty("propagate", Boolean.class);
@@ -50,9 +50,9 @@ public class UserInnerSuspendProcessor implements Processor {
UserMod userMod = new UserMod();
userMod.setKey(updated.getResult());
- final List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
- new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new SimpleEntry<>(userMod, Boolean.FALSE),
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(
+ new WorkflowResult<Pair<UserMod, Boolean>>(
+ new ImmutablePair<>(userMod, Boolean.FALSE),
updated.getPropByRes(), updated.getPerformedTasks()));
taskExecutor.execute(tasks);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java
index ba6edfb..cf9d709 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java
@@ -26,16 +26,12 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserSetStatusInSyncProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(UserSetStatusInSyncProcessor.class);
-
@Autowired
protected UserDAO userDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java
index 5c0366c..0df97b8 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java
@@ -18,12 +18,12 @@
*/
package org.apache.syncope.core.provisioning.camel.processor;
-import java.util.AbstractMap;
-import java.util.HashSet;
+import java.util.Collection;
import java.util.List;
-import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
@@ -57,10 +57,10 @@ public class UserStatusPropagationProcessor implements Processor {
User user = exchange.getProperty("user", User.class);
StatusMod statusMod = exchange.getProperty("statusMod", StatusMod.class);
- Set<String> resourcesToBeExcluded = new HashSet<>(user.getResourceNames());
- resourcesToBeExcluded.removeAll(statusMod.getResourceNames());
+ Collection<String> resourcesToBeExcluded =
+ CollectionUtils.removeAll(user.getResourceNames(), statusMod.getResourceNames());
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(
user, statusMod.getType() != StatusMod.ModType.SUSPEND, resourcesToBeExcluded);
PropagationReporter propReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
@@ -71,6 +71,6 @@ public class UserStatusPropagationProcessor implements Processor {
propReporter.onPrimaryResourceFailure(tasks);
}
- exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(updated.getResult(), propReporter.getStatuses()));
+ exchange.getOut().setBody(new ImmutablePair<>(updated.getResult(), propReporter.getStatuses()));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java
index b7bfcf0..829999f 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java
@@ -18,12 +18,12 @@
*/
package org.apache.syncope.core.provisioning.camel.processor;
-import java.util.AbstractMap;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
@@ -51,14 +51,14 @@ public class UserUpdateInSyncProcessor implements Processor {
@SuppressWarnings("unchecked")
@Override
public void process(final Exchange exchange) {
- WorkflowResult<Map.Entry<UserMod, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody();
- Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
+ WorkflowResult<Pair<UserMod, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody();
+ Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
PropagationReporter propagationReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(updated, updated.getResult().getKey().
- getPassword() != null, excludedResource);
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(updated, updated.getResult().getKey().
+ getPassword() != null, excludedResources);
try {
taskExecutor.execute(tasks, propagationReporter);
@@ -67,7 +67,7 @@ public class UserUpdateInSyncProcessor implements Processor {
propagationReporter.onPrimaryResourceFailure(tasks);
}
- exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(
+ exchange.getOut().setBody(new ImmutablePair<>(
updated.getResult().getKey().getKey(), propagationReporter.getStatuses()));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
index 1ff28c8..84f8a2d 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
@@ -18,12 +18,12 @@
*/
package org.apache.syncope.core.provisioning.camel.processor;
-import java.util.AbstractMap;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.types.PropagationByResource;
@@ -57,11 +57,11 @@ public class UserUpdateProcessor implements Processor {
@Override
@SuppressWarnings("unchecked")
public void process(final Exchange exchange) {
- WorkflowResult<Map.Entry<UserMod, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody();
+ WorkflowResult<Pair<UserMod, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody();
UserMod actual = exchange.getProperty("actual", UserMod.class);
boolean removeMemberships = exchange.getProperty("removeMemberships", boolean.class);
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(updated);
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(updated);
if (tasks.isEmpty()) {
// SYNCOPE-459: take care of user virtual attributes ...
final PropagationByResource propByResVirAttr = virtAttrHandler.fillVirtual(
@@ -84,7 +84,7 @@ public class UserUpdateProcessor implements Processor {
}
}
tasks.addAll(!propByResVirAttr.isEmpty() || addOrUpdateMemberships || removeMemberships
- ? propagationManager.getUserUpdateTaskIds(updated, false, null)
+ ? propagationManager.getUserUpdateTasks(updated, false, null)
: Collections.<PropagationTask>emptyList());
}
@@ -99,7 +99,7 @@ public class UserUpdateProcessor implements Processor {
}
}
- exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(
+ exchange.getOut().setBody(new ImmutablePair<>(
updated.getResult().getKey().getKey(), propagationReporter.getStatuses()));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/resources/provisioning.properties b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
index 40dd3ea..32fa5af 100644
--- a/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
+++ b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
@@ -17,3 +17,4 @@
camel.directory=${conf.directory}
userProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelGroupProvisioningManager
+virAttrCache=org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java
index 2103059..9cdfa5d 100644
--- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java
+++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.fit.core.reference;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.syncope.common.lib.mod.AbstractSubjectMod;
import org.apache.syncope.common.lib.mod.AttrMod;
import org.apache.syncope.common.lib.to.AbstractSubjectTO;
@@ -42,8 +43,9 @@ public class TestSyncActions extends DefaultSyncActions {
AttrTO attrTO = null;
for (int i = 0; i < subject.getPlainAttrs().size(); i++) {
- if ("fullname".equals(subject.getPlainAttrs().get(i).getSchema())) {
- attrTO = subject.getPlainAttrs().get(i);
+ AttrTO _attrTO = CollectionUtils.get(subject.getPlainAttrs(), i);
+ if ("fullname".equals(_attrTO.getSchema())) {
+ attrTO = _attrTO;
}
}
if (attrTO == null) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/main/resources/all/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/all/provisioning.properties b/fit/core-reference/src/main/resources/all/provisioning.properties
index 40dd3ea..32fa5af 100644
--- a/fit/core-reference/src/main/resources/all/provisioning.properties
+++ b/fit/core-reference/src/main/resources/all/provisioning.properties
@@ -17,3 +17,4 @@
camel.directory=${conf.directory}
userProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelGroupProvisioningManager
+virAttrCache=org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/log4j2.xml b/fit/core-reference/src/main/resources/log4j2.xml
index 1bff199..46d15f5 100644
--- a/fit/core-reference/src/main/resources/log4j2.xml
+++ b/fit/core-reference/src/main/resources/log4j2.xml
@@ -116,6 +116,9 @@ under the License.
<asyncLogger name="org.apache.syncope.core.provisioning" additivity="false" level="INFO">
<appender-ref ref="main"/>
</asyncLogger>
+ <asyncLogger name="org.apache.syncope.core.logic" additivity="false" level="INFO">
+ <appender-ref ref="main"/>
+ </asyncLogger>
<asyncLogger name="org.springframework" additivity="false" level="INFO">
<appender-ref ref="main"/>
</asyncLogger>
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/provisioning.properties b/fit/core-reference/src/main/resources/provisioning.properties
index 4b87d44..9c0abff 100644
--- a/fit/core-reference/src/main/resources/provisioning.properties
+++ b/fit/core-reference/src/main/resources/provisioning.properties
@@ -16,3 +16,4 @@
# under the License.
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
+virAttrCache=org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
index cd8ce6f..07882b4 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
@@ -43,6 +43,7 @@ import org.apache.syncope.common.lib.to.AbstractSchemaTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.RoleTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.ConnConfProperty;
@@ -51,7 +52,6 @@ import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.CamelRouteService;
import org.apache.syncope.common.rest.api.service.ConfigurationService;
import org.apache.syncope.common.rest.api.service.ConnectorService;
-import org.apache.syncope.common.rest.api.service.EntitlementService;
import org.apache.syncope.common.rest.api.service.LoggerService;
import org.apache.syncope.common.rest.api.service.NotificationService;
import org.apache.syncope.common.rest.api.service.PolicyService;
@@ -162,8 +162,6 @@ public abstract class AbstractITCase {
protected static ResourceService resourceService;
- protected static EntitlementService entitlementService;
-
protected static ConfigurationService configurationService;
protected static ConnectorService connectorService;
@@ -227,7 +225,6 @@ public abstract class AbstractITCase {
userWorkflowService = adminClient.getService(UserWorkflowService.class);
groupService = adminClient.getService(GroupService.class);
resourceService = adminClient.getService(ResourceService.class);
- entitlementService = adminClient.getService(EntitlementService.class);
configurationService = adminClient.getService(ConfigurationService.class);
connectorService = adminClient.getService(ConnectorService.class);
loggerService = adminClient.getService(LoggerService.class);
@@ -309,8 +306,19 @@ public abstract class AbstractITCase {
return (T) getObject(response.getLocation(), SchemaService.class, schemaTO.getClass());
}
- protected GroupTO createGroup(final GroupTO newGroupTO) {
- Response response = groupService.create(newGroupTO);
+ protected RoleTO createRole(final RoleTO roleTO) {
+ Response response = roleService.create(roleTO);
+ if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
+ Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
+ if (ex != null) {
+ throw (RuntimeException) ex;
+ }
+ }
+ return getObject(response.getLocation(), RoleService.class, RoleTO.class);
+ }
+
+ protected GroupTO createGroup(final GroupTO groupTO) {
+ Response response = groupService.create(groupTO);
if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
if (ex != null) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
index ef99feb..79503a3 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
@@ -25,22 +25,22 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.security.AccessControlException;
-import java.util.HashSet;
-import java.util.List;
+import java.util.Collections;
import java.util.Map;
import java.util.Set;
-import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
-import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.RoleTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO;
import org.apache.syncope.common.lib.to.WorkflowFormTO;
@@ -48,14 +48,12 @@ import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.lib.wrap.EntitlementTO;
import org.apache.syncope.common.lib.wrap.ResourceName;
import org.apache.syncope.common.rest.api.CollectionWrapper;
-import org.apache.syncope.common.rest.api.service.EntitlementService;
import org.apache.syncope.common.rest.api.service.SchemaService;
-import org.apache.syncope.common.rest.api.service.UserSelfService;
import org.apache.syncope.common.rest.api.service.UserService;
import org.apache.syncope.core.misc.security.Encryptor;
import org.junit.Assume;
@@ -67,16 +65,16 @@ import org.springframework.jdbc.core.JdbcTemplate;
@FixMethodOrder(MethodSorters.JVM)
public class AuthenticationITCase extends AbstractITCase {
- private int getFailedLogins(UserService testUserService, long userId) {
- UserTO readUserTO = testUserService.read(userId);
+ private int getFailedLogins(final UserService userService, final long userId) {
+ UserTO readUserTO = userService.read(userId);
assertNotNull(readUserTO);
assertNotNull(readUserTO.getFailedLogins());
return readUserTO.getFailedLogins();
}
- private void assertReadFails(UserService userService, long id) {
+ private void assertReadFails(final SyncopeClient client) {
try {
- userService.read(id);
+ client.self();
fail("access should not work");
} catch (Exception e) {
assertNotNull(e);
@@ -84,29 +82,44 @@ public class AuthenticationITCase extends AbstractITCase {
}
@Test
- public void testAdminEntitlements() {
- // 1. as anonymous, read all available entitlements
- List<EntitlementTO> allEntitlements = entitlementService.getAllEntitlements();
- assertNotNull(allEntitlements);
- assertFalse(allEntitlements.isEmpty());
-
- // 2. as admin, read own entitlements
- List<EntitlementTO> adminEntitlements = entitlementService.getOwnEntitlements();
+ public void testReadEntitlements() {
+ // 1. as anonymous (not allowed)
+ try {
+ clientFactory.createAnonymous().self();
+ fail();
+ } catch (AccessControlException e) {
+ assertNotNull(e);
+ }
- assertEquals(new HashSet<String>(CollectionWrapper.unwrap(allEntitlements)),
- new HashSet<String>(CollectionWrapper.unwrap(adminEntitlements)));
+ // 2. as authenticated anonymous (used by admin console)
+ Pair<Map<Entitlement, Set<String>>, UserTO> self = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).self();
+ assertEquals(1, self.getKey().size());
+ assertTrue(self.getKey().keySet().contains(Entitlement.ANONYMOUS));
+ assertEquals(ANONYMOUS_UNAME, self.getValue().getUsername());
+
+ // 3. as admin
+ self = adminClient.self();
+ assertEquals(Entitlement.values().length - 1, self.getKey().size());
+ assertFalse(self.getKey().keySet().contains(Entitlement.ANONYMOUS));
+ assertEquals(ADMIN_UNAME, self.getValue().getUsername());
+
+ // 4. as user
+ self = clientFactory.create("verdi", ADMIN_PWD).self();
+ assertFalse(self.getKey().isEmpty());
+ assertFalse(self.getKey().keySet().contains(Entitlement.ANONYMOUS));
+ assertEquals("verdi", self.getValue().getUsername());
}
@Test
public void testUserSchemaAuthorization() {
- // 0. create a group that can only read schemas
- GroupTO authGroupTO = new GroupTO();
- authGroupTO.setName("authGroup" + getUUIDString());
- authGroupTO.setParent(8L);
- authGroupTO.getEntitlements().add("SCHEMA_READ");
+ // 0. create a role that can only read schemas
+ RoleTO roleTO = new RoleTO();
+ roleTO.setName("authRole" + getUUIDString());
+ roleTO.getEntitlements().add(Entitlement.SCHEMA_READ);
+ roleTO.getRealms().add("/odd");
- authGroupTO = createGroup(authGroupTO);
- assertNotNull(authGroupTO);
+ roleTO = createRole(roleTO);
+ assertNotNull(roleTO);
String schemaName = "authTestSchema" + getUUIDString();
@@ -119,16 +132,9 @@ public class AuthenticationITCase extends AbstractITCase {
PlainSchemaTO newPlainSchemaTO = createSchema(AttributableType.USER, SchemaType.PLAIN, schemaTO);
assertEquals(schemaTO, newPlainSchemaTO);
- // 2. create an user with the group created above (as admin)
+ // 2. create an user with the role created above (as admin)
UserTO userTO = UserITCase.getUniqueSampleTO("auth@test.org");
-
- MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(authGroupTO.getKey());
- AttrTO testAttrTO = new AttrTO();
- testAttrTO.setSchema("testAttribute");
- testAttrTO.getValues().add("a value");
- membershipTO.getPlainAttrs().add(testAttrTO);
- userTO.getMemberships().add(membershipTO);
+ userTO.getRoles().add(roleTO.getKey());
userTO = createUser(userTO);
assertNotNull(userTO);
@@ -138,19 +144,15 @@ public class AuthenticationITCase extends AbstractITCase {
assertNotNull(schemaTO);
// 4. read the schema created above (as user) - success
- SchemaService schemaService2 = clientFactory.create(userTO.getUsername(), "password123").getService(
- SchemaService.class);
-
+ SchemaService schemaService2 = clientFactory.create(userTO.getUsername(), "password123").
+ getService(SchemaService.class);
schemaTO = schemaService2.read(AttributableType.USER, SchemaType.PLAIN, schemaName);
assertNotNull(schemaTO);
// 5. update the schema create above (as user) - failure
try {
schemaService2.update(AttributableType.GROUP, SchemaType.PLAIN, schemaName, schemaTO);
- fail("Schemaupdate as user schould not work");
- } catch (SyncopeClientException e) {
- assertNotNull(e);
- assertEquals(Response.Status.UNAUTHORIZED, e.getType().getResponseStatus());
+ fail("Schemaupdate as user should not work");
} catch (AccessControlException e) {
// CXF Service will throw this exception
assertNotNull(e);
@@ -162,14 +164,7 @@ public class AuthenticationITCase extends AbstractITCase {
@Test
public void testUserRead() {
UserTO userTO = UserITCase.getUniqueSampleTO("testuserread@test.org");
-
- MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7L);
- AttrTO testAttrTO = new AttrTO();
- testAttrTO.setSchema("testAttribute");
- testAttrTO.getValues().add("a value");
- membershipTO.getPlainAttrs().add(testAttrTO);
- userTO.getMemberships().add(membershipTO);
+ userTO.getRoles().add(2L);
userTO = createUser(userTO);
assertNotNull(userTO);
@@ -190,20 +185,13 @@ public class AuthenticationITCase extends AbstractITCase {
exception = e;
}
assertNotNull(exception);
- assertEquals(ClientExceptionType.UnauthorizedGroup, exception.getType());
+ assertEquals(ClientExceptionType.Unauthorized, exception.getType());
}
@Test
public void testUserSearch() {
UserTO userTO = UserITCase.getUniqueSampleTO("testusersearch@test.org");
-
- MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7L);
- AttrTO testAttrTO = new AttrTO();
- testAttrTO.setSchema("testAttribute");
- testAttrTO.getValues().add("a value");
- membershipTO.getPlainAttrs().add(testAttrTO);
- userTO.getMemberships().add(membershipTO);
+ userTO.getRoles().add(2L);
userTO = createUser(userTO);
assertNotNull(userTO);
@@ -212,93 +200,80 @@ public class AuthenticationITCase extends AbstractITCase {
getService(UserService.class);
PagedResult<UserTO> matchedUsers = userService2.search(
+ Collections.singletonList("/"),
SyncopeClient.getUserSearchConditionBuilder().isNotNull("loginDate").query());
assertNotNull(matchedUsers);
assertFalse(matchedUsers.getResult().isEmpty());
- Set<Long> userIds = new HashSet<Long>(matchedUsers.getResult().size());
- for (UserTO user : matchedUsers.getResult()) {
- userIds.add(user.getKey());
- }
- assertTrue(userIds.contains(1L));
+ assertTrue(CollectionUtils.exists(matchedUsers.getResult(), new Predicate<UserTO>() {
+
+ @Override
+ public boolean evaluate(final UserTO user) {
+ return user.getKey() == 1;
+ }
+ }));
UserService userService3 = clientFactory.create("verdi", "password").getService(UserService.class);
matchedUsers = userService3.search(
+ Collections.singletonList("/even/two"),
SyncopeClient.getUserSearchConditionBuilder().isNotNull("loginDate").query());
assertNotNull(matchedUsers);
+ assertFalse(CollectionUtils.exists(matchedUsers.getResult(), new Predicate<UserTO>() {
- userIds = new HashSet<>(matchedUsers.getResult().size());
-
- for (UserTO user : matchedUsers.getResult()) {
- userIds.add(user.getKey());
- }
- assertFalse(userIds.contains(1L));
+ @Override
+ public boolean evaluate(final UserTO user) {
+ return user.getKey() == 1;
+ }
+ }));
}
@Test
public void checkFailedLogins() {
UserTO userTO = UserITCase.getUniqueSampleTO("checkFailedLogin@syncope.apache.org");
-
- MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7L);
- AttrTO testAttrTO = new AttrTO();
- testAttrTO.setSchema("testAttribute");
- testAttrTO.getValues().add("a value");
- membershipTO.getPlainAttrs().add(testAttrTO);
- userTO.getMemberships().add(membershipTO);
+ userTO.getRoles().add(2L);
userTO = createUser(userTO);
assertNotNull(userTO);
long userId = userTO.getKey();
- UserService userService2 = clientFactory.create(userTO.getUsername(), "password123").getService(
- UserService.class);
+ UserService userService2 = clientFactory.create(userTO.getUsername(), "password123").
+ getService(UserService.class);
assertEquals(0, getFailedLogins(userService2, userId));
// authentications failed ...
- UserService userService3 = clientFactory.create(userTO.getUsername(), "wrongpwd1").getService(
- UserService.class);
- assertReadFails(userService3, userId);
- assertReadFails(userService3, userId);
+ SyncopeClient badPwdClient = clientFactory.create(userTO.getUsername(), "wrongpwd1");
+ assertReadFails(badPwdClient);
+ assertReadFails(badPwdClient);
assertEquals(2, getFailedLogins(userService, userId));
- UserService userService4 = clientFactory.create(userTO.getUsername(), "password123").getService(
- UserService.class);
+ UserService userService4 = clientFactory.create(userTO.getUsername(), "password123").
+ getService(UserService.class);
assertEquals(0, getFailedLogins(userService4, userId));
}
@Test
public void checkUserSuspension() {
UserTO userTO = UserITCase.getUniqueSampleTO("checkSuspension@syncope.apache.org");
-
- MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7L);
- AttrTO testAttrTO = new AttrTO();
- testAttrTO.setSchema("testAttribute");
- testAttrTO.getValues().add("a value");
- membershipTO.getPlainAttrs().add(testAttrTO);
- userTO.getMemberships().add(membershipTO);
+ userTO.setRealm("/odd");
+ userTO.getRoles().add(2L);
userTO = createUser(userTO);
long userId = userTO.getKey();
assertNotNull(userTO);
- UserService userService2 = clientFactory.create(userTO.getUsername(), "password123").
- getService(UserService.class);
- assertEquals(0, getFailedLogins(userService2, userId));
+ assertEquals(0, getFailedLogins(userService, userId));
// authentications failed ...
- UserService userService3 = clientFactory.create(userTO.getUsername(), "wrongpwd1").
- getService(UserService.class);
- assertReadFails(userService3, userId);
- assertReadFails(userService3, userId);
- assertReadFails(userService3, userId);
+ SyncopeClient badPwdClient = clientFactory.create(userTO.getUsername(), "wrongpwd1");
+ assertReadFails(badPwdClient);
+ assertReadFails(badPwdClient);
+ assertReadFails(badPwdClient);
assertEquals(3, getFailedLogins(userService, userId));
// last authentication before suspension
- assertReadFails(userService3, userId);
+ assertReadFails(badPwdClient);
userTO = userService.read(userTO.getKey());
assertNotNull(userTO);
@@ -307,8 +282,8 @@ public class AuthenticationITCase extends AbstractITCase {
assertEquals("suspended", userTO.getStatus());
// Access with correct credentials should fail as user is suspended
- userService2 = clientFactory.create(userTO.getUsername(), "password123").getService(UserService.class);
- assertReadFails(userService2, userId);
+ SyncopeClient goodPwdClient = clientFactory.create(userTO.getUsername(), "password123");
+ assertReadFails(goodPwdClient);
StatusMod reactivate = new StatusMod();
reactivate.setType(StatusMod.ModType.REACTIVATE);
@@ -316,52 +291,7 @@ public class AuthenticationITCase extends AbstractITCase {
assertNotNull(userTO);
assertEquals("active", userTO.getStatus());
- userService2 = clientFactory.create(userTO.getUsername(), "password123").getService(UserService.class);
- assertEquals(0, getFailedLogins(userService2, userId));
- }
-
- @Test
- public void issueSYNCOPE48() {
- // Parent group, able to create users with group 1
- GroupTO parentGroup = new GroupTO();
- parentGroup.setName("parentAdminGroup" + getUUIDString());
- parentGroup.getEntitlements().add("USER_CREATE");
- parentGroup.getEntitlements().add("GROUP_1");
- parentGroup.setParent(1L);
- parentGroup = createGroup(parentGroup);
- assertNotNull(parentGroup);
-
- // Child group, with no entitlements
- GroupTO childGroup = new GroupTO();
- childGroup.setName("childAdminGroup");
- childGroup.setParent(parentGroup.getKey());
-
- childGroup = createGroup(childGroup);
- assertNotNull(childGroup);
-
- // User with child group, created by admin
- UserTO group1Admin = UserITCase.getUniqueSampleTO("syncope48admin@apache.org");
- group1Admin.setPassword("password");
- MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(childGroup.getKey());
- group1Admin.getMemberships().add(membershipTO);
-
- group1Admin = createUser(group1Admin);
- assertNotNull(group1Admin);
-
- UserService userService2 = clientFactory.create(group1Admin.getUsername(), "password").getService(
- UserService.class);
-
- // User with group 1, created by user with child group created above
- UserTO group1User = UserITCase.getUniqueSampleTO("syncope48user@apache.org");
- membershipTO = new MembershipTO();
- membershipTO.setGroupId(1L);
- group1User.getMemberships().add(membershipTO);
-
- Response response = userService2.create(group1User, true);
- assertNotNull(response);
- group1User = response.readEntity(UserTO.class);
- assertNotNull(group1User);
+ assertEquals(0, goodPwdClient.self().getValue().getFailedLogins(), 0);
}
@Test
@@ -371,7 +301,7 @@ public class AuthenticationITCase extends AbstractITCase {
// 1. create user with group 9 (users with group 9 are defined in workflow as subject to approval)
UserTO userTO = UserITCase.getUniqueSampleTO("createWithReject@syncope.apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(9L);
+ membershipTO.setGroupKey(9L);
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
@@ -379,10 +309,8 @@ public class AuthenticationITCase extends AbstractITCase {
assertEquals("createApproval", userTO.getStatus());
// 2. try to authenticate: fail
- EntitlementService myEntitlementService = clientFactory.create(userTO.getUsername(), "password123").
- getService(EntitlementService.class);
try {
- myEntitlementService.getOwnEntitlements();
+ clientFactory.create(userTO.getUsername(), "password123").self();
fail();
} catch (AccessControlException e) {
assertNotNull(e);
@@ -400,14 +328,19 @@ public class AuthenticationITCase extends AbstractITCase {
assertEquals("active", userTO.getStatus());
// 4. try to authenticate again: success
- assertNotNull(myEntitlementService.getOwnEntitlements());
+ Pair<Map<Entitlement, Set<String>>, UserTO> self =
+ clientFactory.create(userTO.getUsername(), "password123").self();
+ assertNotNull(self);
+ assertNotNull(self.getKey());
+ assertNotNull(self.getValue());
}
@Test
public void issueSYNCOPE164() throws Exception {
// 1. create user with db resource
UserTO user = UserITCase.getUniqueSampleTO("syncope164@syncope.apache.org");
- user.setPassword("password1");
+ user.setRealm("/even/two");
+ user.setPassword("password123");
user.getResources().add(RESOURCE_NAME_TESTDB);
user = createUser(user);
assertNotNull(user);
@@ -421,7 +354,7 @@ public class AuthenticationITCase extends AbstractITCase {
// 3. change password on Syncope
UserMod userMod = new UserMod();
userMod.setKey(user.getKey());
- userMod.setPassword("password2");
+ userMod.setPassword("password234");
user = updateUser(userMod);
assertNotNull(user);
@@ -429,12 +362,13 @@ public class AuthenticationITCase extends AbstractITCase {
final JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
String value = jdbcTemplate.queryForObject(
"SELECT PASSWORD FROM test WHERE ID=?", String.class, user.getUsername());
- assertEquals(Encryptor.getInstance().encode("password1", CipherAlgorithm.SHA1), value.toUpperCase());
+ assertEquals(Encryptor.getInstance().encode("password123", CipherAlgorithm.SHA1), value.toUpperCase());
// 5. successfully authenticate with old (on db resource) and new (on internal storage) password values
- user = clientFactory.create(user.getUsername(), "password1").getService(UserSelfService.class).read();
- assertNotNull(user);
- user = clientFactory.create(user.getUsername(), "password2").getService(UserSelfService.class).read();
- assertNotNull(user);
+ Pair<Map<Entitlement, Set<String>>, UserTO> self =
+ clientFactory.create(user.getUsername(), "password123").self();
+ assertNotNull(self);
+ self = clientFactory.create(user.getUsername(), "password234").self();
+ assertNotNull(self);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
index 35f270c..4681834 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
@@ -22,6 +22,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.CamelRouteTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.to.UserTO;
@@ -61,11 +63,11 @@ public class CamelRouteITCase extends AbstractITCase {
}
}
- private CamelRouteTO doUpdate(final String key, String content) {
+ private CamelRouteTO doUpdate(final String key, final String content) {
CamelRouteTO route = camelRouteService.read(key);
route.setContent(content);
camelRouteService.update(route.getKey(), route);
- //getting new route definition
+ // getting new route definition
return camelRouteService.read(key);
}
@@ -108,45 +110,49 @@ public class CamelRouteITCase extends AbstractITCase {
Assume.assumeTrue(CamelDetector.isCamelEnabledForUsers(syncopeService));
CamelRouteTO oldRoute = camelRouteService.read("createUser");
- //updating route content including new attribute management
- String routeContent = "<route id=\"createUser\">\n"
- + " <from uri=\"direct:createUser\"/>\n"
- + " <setProperty propertyName=\"actual\">\n"
- + " <simple>${body}</simple>\n"
- + " </setProperty>\n"
- + " <setBody>\n"
- + " <groovy>\n"
- + " request.body.getPlainAttrs().get(3).getValues().set(0,\"true\")\n"
+ // updating route content including new attribute management
+
+ String routeContent = ""
+ + " <route id=\"createUser\">\n"
+ + " <from uri=\"direct:createUser\"/>\n"
+ + " <setProperty propertyName=\"actual\">\n"
+ + " <simple>${body}</simple>\n"
+ + " </setProperty>\n"
+ + " <setBody>\n"
+ + " <groovy>\n"
+ + " org.apache.commons.collections4."
+ + "CollectionUtils.get(request.body.getPlainAttrs(), 3).getValues().set(0,\"true\")\n"
+ " return request.body\n"
- + " </groovy>\n"
- + " </setBody>\n"
- + " <doTry>\n"
+ + " </groovy>\n"
+ + " </setBody>\n"
+ + " <doTry>\n"
+ " <bean ref=\"uwfAdapter\" method=\"create(${body},${property.disablePwdPolicyCheck},\n"
- + " ${property.enabled},${property.storePassword})\"/>\n"
- + " <process ref=\"userCreateProcessor\" />\n"
+ + " ${property.enabled},${property.storePassword})\"/>\n"
+ + " <process ref=\"userCreateProcessor\"/>\n"
+ " <to uri=\"direct:createPort\"/>\n"
+ " <doCatch> \n"
- + " <exception>java.lang.RuntimeException</exception>\n"
- + " <handled>\n"
- + " <constant>false</constant>\n"
- + " </handled>\n"
- + " <to uri=\"direct:createPort\"/>\n"
+ + " <exception>java.lang.RuntimeException</exception>\n"
+ + " <handled>\n"
+ + " <constant>false</constant>\n"
+ + " </handled>\n"
+ + " <to uri=\"direct:createPort\"/>\n"
+ " </doCatch>\n"
- + " </doTry>\n"
- + "</route>";
+ + " </doTry>\n"
+ + " </route> ";
try {
doUpdate("createUser", routeContent);
- //creating new schema attribute for user
+ // creating new schema attribute for user
PlainSchemaTO schemaTO = new PlainSchemaTO();
schemaTO.setKey("camelAttribute");
schemaTO.setType(AttrSchemaType.String);
createSchema(AttributableType.USER, SchemaType.PLAIN, schemaTO);
UserTO userTO = new UserTO();
+ userTO.setRealm(SyncopeConstants.ROOT_REALM);
String userId = getUUIDString() + "camelUser@syncope.apache.org";
userTO.setUsername(userId);
- userTO.setPassword("password");
+ userTO.setPassword("password123");
userTO.getPlainAttrs().add(attrTO("userId", userId));
userTO.getPlainAttrs().add(attrTO("fullname", userId));
userTO.getPlainAttrs().add(attrTO("surname", userId));
@@ -154,7 +160,7 @@ public class CamelRouteITCase extends AbstractITCase {
userTO = createUser(userTO);
assertNotNull(userTO);
- assertEquals("true", userTO.getPlainAttrs().get(3).getValues().get(0));
+ assertEquals("true", CollectionUtils.get(userTO.getPlainAttrs(), 3).getValues().get(0));
} finally {
doUpdate(oldRoute.getKey(), oldRoute.getContent());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
index 3277305..5dd5ce8 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
@@ -57,12 +57,12 @@ public class ConfigurationITCase extends AbstractITCase {
@Test
public void create() {
PlainSchemaTO testKey = new PlainSchemaTO();
- testKey.setKey("testKey");
+ testKey.setKey("testKey" + getUUIDString());
testKey.setType(AttrSchemaType.String);
createSchema(AttributableType.CONFIGURATION, SchemaType.PLAIN, testKey);
AttrTO conf = new AttrTO();
- conf.setSchema("testKey");
+ conf.setSchema(testKey.getKey());
conf.getValues().add("testValue");
configurationService.set(conf.getSchema(), conf);
@@ -201,6 +201,7 @@ public class ConfigurationITCase extends AbstractITCase {
createSchema(AttributableType.GROUP, SchemaType.PLAIN, groupKey);
GroupTO groupTO = new GroupTO();
+ groupTO.setRealm("/");
groupTO.setName("aGroup" + getUUIDString());
groupTO.getMPlainAttrTemplates().add(membershipKey.getKey());
groupTO.getGPlainAttrTemplates().add(groupKey.getKey());
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
index de54fd5..4fdad8d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
@@ -295,7 +295,7 @@ public class ConnectorITCase extends AbstractITCase {
ResourceTO resourceTO = resources.get(0);
// Make it new.
- resourceTO.setKey("newAbout103");
+ resourceTO.setKey("newAbout103" + getUUIDString());
// Make it new.
connInstanceTO.setKey(0);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
index ce2cbd5..7fac061 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
@@ -28,6 +28,7 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.InputStream;
import java.security.AccessControlException;
+import java.util.Collections;
import java.util.List;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
@@ -62,7 +63,6 @@ import org.apache.syncope.common.rest.api.CollectionWrapper;
import org.apache.syncope.common.rest.api.Preference;
import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.GroupService;
-import org.identityconnectors.framework.common.objects.Name;
import org.junit.FixMethodOrder;
import org.junit.Ignore;
import org.junit.Test;
@@ -73,23 +73,14 @@ public class GroupITCase extends AbstractITCase {
private GroupTO buildBasicGroupTO(final String name) {
GroupTO groupTO = new GroupTO();
+ groupTO.setRealm("/");
groupTO.setName(name + getUUIDString());
- groupTO.setParent(8L);
return groupTO;
}
private GroupTO buildGroupTO(final String name) {
GroupTO groupTO = buildBasicGroupTO(name);
- // verify inheritance password and account policies
- groupTO.setInheritAccountPolicy(false);
- // not inherited so setter execution shouldn't be ignored
- groupTO.setAccountPolicy(6L);
-
- groupTO.setInheritPasswordPolicy(true);
- // inherited so setter execution should be ignored
- groupTO.setPasswordPolicy(2L);
-
groupTO.getGPlainAttrTemplates().add("icon");
groupTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
@@ -98,19 +89,6 @@ public class GroupITCase extends AbstractITCase {
}
@Test
- public void createWithException() {
- GroupTO newGroupTO = new GroupTO();
- newGroupTO.getPlainAttrs().add(attrTO("attr1", "value1"));
-
- try {
- createGroup(newGroupTO);
- fail();
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.InvalidGroup, e.getType());
- }
- }
-
- @Test
@Ignore
public void create() {
GroupTO groupTO = buildGroupTO("lastGroup");
@@ -126,12 +104,6 @@ public class GroupITCase extends AbstractITCase {
assertFalse(groupTO.getVirAttrMap().get("rvirtualdata").getValues().isEmpty());
assertEquals("rvirtualvalue", groupTO.getVirAttrMap().get("rvirtualdata").getValues().get(0));
- assertNotNull(groupTO.getAccountPolicy());
- assertEquals(6L, (long) groupTO.getAccountPolicy());
-
- assertNotNull(groupTO.getPasswordPolicy());
- assertEquals(4L, (long) groupTO.getPasswordPolicy());
-
assertTrue(groupTO.getResources().contains(RESOURCE_NAME_LDAP));
ConnObjectTO connObjectTO =
@@ -148,22 +120,6 @@ public class GroupITCase extends AbstractITCase {
}
@Test
- public void createWithPasswordPolicy() {
- GroupTO groupTO = new GroupTO();
- groupTO.setName("groupWithPassword" + getUUIDString());
- groupTO.setParent(8L);
- groupTO.setPasswordPolicy(4L);
-
- GroupTO actual = createGroup(groupTO);
- assertNotNull(actual);
-
- actual = groupService.read(actual.getKey());
- assertNotNull(actual);
- assertNotNull(actual.getPasswordPolicy());
- assertEquals(4L, (long) actual.getPasswordPolicy());
- }
-
- @Test
public void delete() {
try {
groupService.delete(0L);
@@ -173,7 +129,7 @@ public class GroupITCase extends AbstractITCase {
GroupTO groupTO = new GroupTO();
groupTO.setName("toBeDeleted" + getUUIDString());
- groupTO.setParent(8L);
+ groupTO.setRealm("/even");
groupTO.getResources().add(RESOURCE_NAME_LDAP);
@@ -192,7 +148,7 @@ public class GroupITCase extends AbstractITCase {
@Test
public void list() {
- PagedResult<GroupTO> groupTOs = groupService.list();
+ PagedResult<GroupTO> groupTOs = groupService.list(Collections.singletonList("/"));
assertNotNull(groupTOs);
assertTrue(groupTOs.getResult().size() >= 8);
for (GroupTO groupTO : groupTOs.getResult()) {
@@ -201,14 +157,6 @@ public class GroupITCase extends AbstractITCase {
}
@Test
- public void parent() {
- GroupTO groupTO = groupService.parent(7L);
-
- assertNotNull(groupTO);
- assertEquals(groupTO.getKey(), 6L);
- }
-
- @Test
public void read() {
GroupTO groupTO = groupService.read(1L);
@@ -228,16 +176,17 @@ public class GroupITCase extends AbstractITCase {
GroupService groupService2 = clientFactory.create("rossini", ADMIN_PWD).getService(GroupService.class);
try {
- groupService2.readSelf(3L);
+ groupService2.read(3L);
fail();
} catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.UnauthorizedGroup, e.getType());
+ assertEquals(ClientExceptionType.Unauthorized, e.getType());
}
- GroupTO groupTO = groupService2.readSelf(1L);
- assertNotNull(groupTO);
- assertNotNull(groupTO.getPlainAttrs());
- assertFalse(groupTO.getPlainAttrs().isEmpty());
+ List<GroupTO> groups = groupService2.own();
+ assertNotNull(groups);
+ assertFalse(groups.isEmpty());
+ assertNotNull(groups.get(0).getPlainAttrs());
+ assertFalse(groups.get(0).getPlainAttrs().isEmpty());
}
@Test
@@ -248,12 +197,6 @@ public class GroupITCase extends AbstractITCase {
assertEquals(1, groupTO.getPlainAttrs().size());
- assertNotNull(groupTO.getAccountPolicy());
- assertEquals(6L, (long) groupTO.getAccountPolicy());
-
- assertNotNull(groupTO.getPasswordPolicy());
- assertEquals(4L, (long) groupTO.getPasswordPolicy());
-
GroupMod groupMod = new GroupMod();
groupMod.setKey(groupTO.getKey());
String modName = "finalGroup" + getUUIDString();
@@ -267,13 +210,6 @@ public class GroupITCase extends AbstractITCase {
assertEquals(modName, groupTO.getName());
assertEquals(2, groupTO.getPlainAttrs().size());
-
- // changes ignored because not requested (null ReferenceMod)
- assertNotNull(groupTO.getAccountPolicy());
- assertEquals(6L, (long) groupTO.getAccountPolicy());
-
- // password policy null because not inherited
- assertNull(groupTO.getPasswordPolicy());
}
@Test
@@ -319,7 +255,7 @@ public class GroupITCase extends AbstractITCase {
@Test
public void updateAsGroupOwner() {
// 1. read group as admin
- GroupTO groupTO = groupService.read(7L);
+ GroupTO groupTO = groupService.read(6L);
// issue SYNCOPE-15
assertNotNull(groupTO.getCreationDate());
@@ -330,9 +266,9 @@ public class GroupITCase extends AbstractITCase {
// 2. prepare update
GroupMod groupMod = new GroupMod();
groupMod.setKey(groupTO.getKey());
- groupMod.setName("Managing Director");
+ groupMod.setName("Director");
- // 3. try to update as verdi, not owner of group 7 - fail
+ // 3. try to update as verdi, not owner of group 6 - fail
GroupService groupService2 = clientFactory.create("verdi", ADMIN_PWD).getService(GroupService.class);
try {
@@ -344,11 +280,11 @@ public class GroupITCase extends AbstractITCase {
assertNotNull(e);
}
- // 4. update as puccini, owner of group 7 because owner of group 6 with inheritance - success
+ // 4. update as puccini, owner of group 6 - success
GroupService groupService3 = clientFactory.create("puccini", ADMIN_PWD).getService(GroupService.class);
groupTO = groupService3.update(groupMod.getKey(), groupMod).readEntity(GroupTO.class);
- assertEquals("Managing Director", groupTO.getName());
+ assertEquals("Director", groupTO.getName());
// issue SYNCOPE-15
assertNotNull(groupTO.getCreationDate());
@@ -358,20 +294,17 @@ public class GroupITCase extends AbstractITCase {
assertTrue(groupTO.getCreationDate().before(groupTO.getLastChangeDate()));
}
- /**
- * Group rename used to fail in case of parent null.
- */
@Test
public void issue178() {
GroupTO groupTO = new GroupTO();
String groupName = "torename" + getUUIDString();
groupTO.setName(groupName);
+ groupTO.setRealm("/");
GroupTO actual = createGroup(groupTO);
assertNotNull(actual);
assertEquals(groupName, actual.getName());
- assertEquals(0L, actual.getParent());
GroupMod groupMod = new GroupMod();
groupMod.setKey(actual.getKey());
@@ -381,38 +314,6 @@ public class GroupITCase extends AbstractITCase {
actual = updateGroup(groupMod);
assertNotNull(actual);
assertEquals(renamedGroup, actual.getName());
- assertEquals(0L, actual.getParent());
- }
-
- @Test
- public void issueSYNCOPE228() {
- GroupTO groupTO = buildGroupTO("issueSYNCOPE228");
- groupTO.getEntitlements().add("USER_READ");
- groupTO.getEntitlements().add("SCHEMA_READ");
-
- groupTO = createGroup(groupTO);
- assertNotNull(groupTO);
- assertNotNull(groupTO.getEntitlements());
- assertFalse(groupTO.getEntitlements().isEmpty());
-
- List<String> entitlements = groupTO.getEntitlements();
-
- GroupMod groupMod = new GroupMod();
- groupMod.setKey(groupTO.getKey());
- groupMod.setInheritDerAttrs(Boolean.TRUE);
-
- groupTO = updateGroup(groupMod);
- assertNotNull(groupTO);
- assertEquals(entitlements, groupTO.getEntitlements());
-
- groupMod = new GroupMod();
- groupMod.setKey(groupTO.getKey());
- groupMod.setModEntitlements(true);
- groupMod.getEntitlements().clear();
-
- groupTO = updateGroup(groupMod);
- assertNotNull(groupTO);
- assertTrue(groupTO.getEntitlements().isEmpty());
}
@Test
@@ -610,7 +511,7 @@ public class GroupITCase extends AbstractITCase {
public void createWithMandatorySchemaNotTemplate() {
// 1. create a group mandatory schema
PlainSchemaTO badge = new PlainSchemaTO();
- badge.setKey("badge");
+ badge.setKey("badge" + getUUIDString());
badge.setMandatoryCondition("true");
schemaService.create(AttributableType.GROUP, SchemaType.PLAIN, badge);
@@ -625,8 +526,8 @@ public class GroupITCase extends AbstractITCase {
// failure since no values are provided and it is mandatory
GroupMod groupMod = new GroupMod();
groupMod.setKey(groupTO.getKey());
- groupMod.setModRAttrTemplates(true);
- groupMod.getRPlainAttrTemplates().add("badge");
+ groupMod.setModGAttrTemplates(true);
+ groupMod.getGPlainAttrTemplates().add(badge.getKey());
try {
updateGroup(groupMod);
@@ -647,14 +548,14 @@ public class GroupITCase extends AbstractITCase {
public void anonymous() {
GroupService unauthenticated = clientFactory.createAnonymous().getService(GroupService.class);
try {
- unauthenticated.list();
+ unauthenticated.list(Collections.singletonList("/"));
fail();
} catch (AccessControlException e) {
assertNotNull(e);
}
GroupService anonymous = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(GroupService.class);
- assertFalse(anonymous.list().getResult().isEmpty());
+ assertFalse(anonymous.list(Collections.singletonList("/")).getResult().isEmpty());
}
@Test
@@ -687,122 +588,6 @@ public class GroupITCase extends AbstractITCase {
}
@Test
- public void issueSYNCOPE455() {
- final String parentName = "issueSYNCOPE455-PGroup";
- final String childName = "issueSYNCOPE455-CGroup";
-
- // 1. create parent group
- GroupTO parent = buildBasicGroupTO(parentName);
- parent.getResources().add(RESOURCE_NAME_LDAP);
-
- parent = createGroup(parent);
- assertTrue(parent.getResources().contains(RESOURCE_NAME_LDAP));
-
- final ConnObjectTO parentRemoteObject =
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, parent.getKey());
- assertNotNull(parentRemoteObject);
- assertNotNull(getLdapRemoteObject(parentRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
-
- // 2. create child group
- GroupTO child = buildBasicGroupTO(childName);
- child.getResources().add(RESOURCE_NAME_LDAP);
- child.setParent(parent.getKey());
-
- child = createGroup(child);
- assertTrue(child.getResources().contains(RESOURCE_NAME_LDAP));
-
- final ConnObjectTO childRemoteObject =
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, child.getKey());
- assertNotNull(childRemoteObject);
- assertNotNull(getLdapRemoteObject(childRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
-
- // 3. remove parent group
- groupService.delete(parent.getKey());
-
- // 4. asserts for issue 455
- try {
- groupService.read(parent.getKey());
- fail();
- } catch (SyncopeClientException scce) {
- assertNotNull(scce);
- }
-
- try {
- groupService.read(child.getKey());
- fail();
- } catch (SyncopeClientException scce) {
- assertNotNull(scce);
- }
-
- assertNull(getLdapRemoteObject(parentRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
- assertNull(getLdapRemoteObject(childRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
- }
-
- @Test
- public void issueSYNCOPE543() {
- final String ancestorName = "issueSYNCOPE543-AGroup";
- final String parentName = "issueSYNCOPE543-PGroup";
- final String childName = "issueSYNCOPE543-CGroup";
-
- // 1. create ancestor group
- GroupTO ancestor = buildBasicGroupTO(ancestorName);
- ancestor.setParent(0L);
- ancestor.getGPlainAttrTemplates().add("icon");
- ancestor.getPlainAttrs().add(attrTO("icon", "ancestorIcon"));
- ancestor = createGroup(ancestor);
- assertEquals("ancestorIcon", ancestor.getPlainAttrMap().get("icon").getValues().get(0));
-
- // 2. create parent group
- GroupTO parent = buildBasicGroupTO(parentName);
- parent.setParent(ancestor.getKey());
- parent.getGPlainAttrTemplates().add("icon");
- parent.getPlainAttrs().add(attrTO("icon", "parentIcon"));
- parent = createGroup(parent);
- assertEquals("parentIcon", parent.getPlainAttrMap().get("icon").getValues().get(0));
-
- // 3. create child group
- GroupTO child = buildBasicGroupTO(childName);
- child.setParent(parent.getKey());
- child.getGPlainAttrTemplates().add("icon");
- child.getPlainAttrs().add(attrTO("icon", "childIcon"));
- child = createGroup(child);
- assertEquals("childIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
-
- final GroupMod groupChildMod = new GroupMod();
- groupChildMod.setKey(child.getKey());
- groupChildMod.setInheritPlainAttrs(Boolean.TRUE);
- updateGroup(groupChildMod);
-
- child = groupService.read(child.getKey());
- assertNotNull(child);
- assertNotNull(child.getPlainAttrMap().get("icon").getValues());
- assertEquals("parentIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
-
- final GroupMod groupParentMod = new GroupMod();
- groupParentMod.setKey(parent.getKey());
- groupParentMod.setInheritPlainAttrs(Boolean.TRUE);
- updateGroup(groupParentMod);
-
- child = groupService.read(child.getKey());
- assertNotNull(child);
- assertNotNull(child.getPlainAttrMap().get("icon").getValues());
- assertEquals("ancestorIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
-
- parent = groupService.read(parent.getKey());
- assertNotNull(parent);
- assertNotNull(parent.getPlainAttrMap().get("icon").getValues());
- assertEquals("ancestorIcon", parent.getPlainAttrMap().get("icon").getValues().get(0));
-
- groupParentMod.setInheritPlainAttrs(Boolean.FALSE);
- updateGroup(groupParentMod);
-
- child = groupService.read(child.getKey());
- assertNotNull(child);
- assertNotNull(child.getPlainAttrMap().get("icon").getValues());
- assertEquals("parentIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
- }
-
- @Test
public void issueSYNCOPE632() {
GroupTO groupTO = null;
try {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
index 955a216..18abb97 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
@@ -155,7 +155,7 @@ public class NotificationITCase extends AbstractITCase {
NotificationTO notificationTO = buildNotificationTO();
notificationTO.getStaticRecipients().add("syncope446@syncope.apache.org");
notificationTO.setGroupAbout(
- SyncopeClient.getGroupSearchConditionBuilder().hasEntitlements("GROUP_READ").query());
+ SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("citizen").query());
NotificationTO actual = null;
try {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
index 1fb1a93..b3ca9ab 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
@@ -130,7 +130,7 @@ public class NotificationTaskITCase extends AbstractTaskITCase {
// 2. create user
UserTO userTO = UserITCase.getUniqueSampleTO("syncope@syncope.apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setGroupId(7);
+ membershipTO.setGroupKey(7);
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
index 1968206..5f317ed 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
@@ -233,7 +233,7 @@ public class PlainSchemaITCase extends AbstractITCase {
UserTO newUserTO = SerializationUtils.clone(userTO);
MembershipTO membership = new MembershipTO();
- membership.setGroupId(2L);
+ membership.setGroupKey(2L);
newUserTO.getMemberships().add(membership);
UserMod userMod = AttributableOperations.diff(newUserTO, userTO);
[55/57] syncope git commit: [SYNCOPE-119] Merge from master
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtils.java
----------------------------------------------------------------------
diff --cc core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtils.java
index a635207,0000000..2fe1ae9
mode 100644,000000..100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtils.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtils.java
@@@ -1,879 -1,0 +1,862 @@@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.to.ConfTO;
+import org.apache.syncope.common.lib.to.MembershipTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.Attributable;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.DerAttr;
+import org.apache.syncope.core.persistence.api.entity.DerSchema;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPAConf;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
- import org.apache.syncope.core.misc.spring.BeanUtils;
- import org.identityconnectors.framework.common.objects.Uid;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class JPAAttributableUtils implements AttributableUtils {
+
+ /**
+ * Logger.
+ */
+ private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(AttributableUtils.class);
+
+ private final AttributableType type;
+
+ protected JPAAttributableUtils(final AttributableType type) {
+ this.type = type;
+ }
+
+ @Override
+ public AttributableType getType() {
+ return type;
+ }
+
+ @Override
+ public <T extends Attributable<?, ?, ?>> Class<T> attributableClass() {
+ Class result;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGroup.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMembership.class;
+ break;
+
+ case CONFIGURATION:
+ result = JPAConf.class;
+ break;
+
+ case USER:
+ default:
+ result = JPAUser.class;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainSchema> Class<T> plainSchemaClass() {
+ Class result;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGPlainSchema.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMPlainSchema.class;
+ break;
+
+ case CONFIGURATION:
+ result = JPACPlainSchema.class;
+ break;
+
+ case USER:
+ default:
+ result = JPAUPlainSchema.class;
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainSchema> T newPlainSchema() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUPlainSchema();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGPlainSchema();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMPlainSchema();
+ break;
+
+ case CONFIGURATION:
+ result = (T) new JPACPlainSchema();
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttr> Class<T> plainAttrClass() {
+ Class result = null;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGPlainAttr.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMPlainAttr.class;
+ break;
+
+ case CONFIGURATION:
+ result = JPACPlainAttr.class;
+ break;
+
+ case USER:
+ default:
+ result = JPAUPlainAttr.class;
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttr> T newPlainAttr() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUPlainAttr();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGPlainAttr();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMPlainAttr();
+ break;
+
+ case CONFIGURATION:
+ result = (T) new JPACPlainAttr();
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttrValue> Class<T> plainAttrValueClass() {
+ Class result;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGPlainAttrValue.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMPlainAttrValue.class;
+ break;
+
+ case CONFIGURATION:
+ result = JPACPlainAttrValue.class;
+ break;
+
+ case USER:
+ default:
+ result = JPAUPlainAttrValue.class;
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttrValue> T newPlainAttrValue() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUPlainAttrValue();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGPlainAttrValue();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMPlainAttrValue();
+ break;
+
+ case CONFIGURATION:
+ result = (T) new JPACPlainAttrValue();
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttrValue> Class<T> plainAttrUniqueValueClass() {
+ Class result;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGPlainAttrUniqueValue.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMPlainAttrUniqueValue.class;
+ break;
+
+ case CONFIGURATION:
+ result = JPACPlainAttrUniqueValue.class;
+ break;
+
+ case USER:
+ default:
+ result = JPAUPlainAttrUniqueValue.class;
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttrValue> T newPlainAttrUniqueValue() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUPlainAttrUniqueValue();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGPlainAttrUniqueValue();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMPlainAttrUniqueValue();
+ break;
+
+ case CONFIGURATION:
+ result = (T) new JPACPlainAttrUniqueValue();
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AttrTemplate<PlainSchema>> Class<T> plainAttrTemplateClass() {
+ Class result;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGPlainAttrTemplate.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMPlainAttrTemplate.class;
+ break;
+
+ case USER:
+ case CONFIGURATION:
+ default:
+ result = null;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends DerSchema> Class<T> derSchemaClass() {
+ Class result;
+
+ switch (type) {
+ case USER:
+ result = JPAUDerSchema.class;
+ break;
+
+ case GROUP:
+ result = JPAGDerSchema.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMDerSchema.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ result = null;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends DerSchema> T newDerSchema() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUDerSchema();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGDerSchema();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMDerSchema();
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends DerAttr> Class<T> derAttrClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ result = JPAUDerAttr.class;
+ break;
+
+ case GROUP:
+ result = JPAGDerAttr.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMDerAttr.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends DerAttr> T newDerAttr() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUDerAttr();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGDerAttr();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMDerAttr();
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AttrTemplate<DerSchema>> Class<T> derAttrTemplateClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ break;
+
+ case GROUP:
+ result = JPAGDerAttrTemplate.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMDerAttrTemplate.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends VirSchema> Class<T> virSchemaClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ result = JPAUVirSchema.class;
+ break;
+
+ case GROUP:
+ result = JPAGVirSchema.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMVirSchema.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends VirSchema> T newVirSchema() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUVirSchema();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGVirSchema();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMVirSchema();
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends VirAttr> Class<T> virAttrClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ result = JPAUVirAttr.class;
+ break;
+
+ case GROUP:
+ result = JPAGVirAttr.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMVirAttr.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends VirAttr> T newVirAttr() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUVirAttr();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGVirAttr();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMVirAttr();
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AttrTemplate<VirSchema>> Class<T> virAttrTemplateClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ break;
+
+ case GROUP:
+ result = JPAGVirAttrTemplate.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMVirAttrTemplate.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends MappingItem> T getAccountIdItem(final ExternalResource resource) {
+ T result = null;
+
+ if (resource != null) {
+ switch (type) {
+ case GROUP:
+ if (resource.getGmapping() != null) {
+ result = (T) resource.getGmapping().getAccountIdItem();
+ }
+ break;
+
+ case MEMBERSHIP:
+ case USER:
+ if (resource.getUmapping() != null) {
+ result = (T) resource.getUmapping().getAccountIdItem();
+ }
+ break;
+
+ default:
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public String getAccountLink(final ExternalResource resource) {
+ String result = null;
+
+ if (resource != null) {
+ switch (type) {
+ case USER:
+ if (resource.getUmapping() != null) {
+ result = resource.getUmapping().getAccountLink();
+ }
+ break;
+
+ case GROUP:
+ if (resource.getGmapping() != null) {
+ result = resource.getGmapping().getAccountLink();
+ }
+ break;
+
+ case MEMBERSHIP:
+ case CONFIGURATION:
+ default:
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends MappingItem> List<T> getMappingItems(
+ final ExternalResource resource, final MappingPurpose purpose) {
+
+ List<T> items = Collections.<T>emptyList();
+
+ if (resource != null) {
+ switch (type) {
+ case GROUP:
+ if (resource.getGmapping() != null) {
+ items = (List<T>) resource.getGmapping().getItems();
+ }
+ break;
+
+ case MEMBERSHIP:
+ case USER:
+ if (resource.getUmapping() != null) {
+ items = (List<T>) resource.getUmapping().getItems();
+ }
+ break;
+
+ default:
+ }
+ }
+
+ final List<T> result = new ArrayList<>();
+
+ switch (purpose) {
+ case SYNCHRONIZATION:
+ for (T item : items) {
+ if (MappingPurpose.PROPAGATION != item.getPurpose()
+ && MappingPurpose.NONE != item.getPurpose()) {
+
+ result.add(item);
+ }
+ }
+ break;
+
+ case PROPAGATION:
+ for (T item : items) {
+ if (MappingPurpose.SYNCHRONIZATION != item.getPurpose()
+ && MappingPurpose.NONE != item.getPurpose()) {
+
+ result.add(item);
+ }
+ }
+ break;
+
+ case BOTH:
+ for (T item : items) {
+ if (MappingPurpose.NONE != item.getPurpose()) {
+ result.add(item);
+ }
+ }
+ break;
+
+ case NONE:
+ for (T item : items) {
+ if (MappingPurpose.NONE == item.getPurpose()) {
+ result.add(item);
+ }
+ }
+ break;
+ default:
+ LOG.error("You requested not existing purpose {}", purpose);
+ }
+
+ return result;
+ }
+
+ @Override
- public <T extends MappingItem> List<T> getUidToMappingItems(
- final ExternalResource resource, final MappingPurpose purpose) {
-
- List<T> items = getMappingItems(resource, purpose);
-
- MappingItem uidItem = type == AttributableType.USER ? new JPAUMappingItem() : new JPAGMappingItem();
- BeanUtils.copyProperties(getAccountIdItem(resource), uidItem);
- uidItem.setExtAttrName(Uid.NAME);
- uidItem.setAccountid(false);
- items.add((T) uidItem);
-
- return items;
- }
-
- @Override
+ public IntMappingType plainIntMappingType() {
+ IntMappingType result = null;
+
+ switch (type) {
+ case GROUP:
+ result = IntMappingType.GroupPlainSchema;
+ break;
+
+ case MEMBERSHIP:
+ result = IntMappingType.MembershipPlainSchema;
+ break;
+
+ case USER:
+ result = IntMappingType.UserPlainSchema;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public IntMappingType derIntMappingType() {
+ IntMappingType result = null;
+
+ switch (type) {
+ case GROUP:
+ result = IntMappingType.GroupDerivedSchema;
+ break;
+
+ case MEMBERSHIP:
+ result = IntMappingType.MembershipDerivedSchema;
+ break;
+
+ case USER:
+ result = IntMappingType.UserDerivedSchema;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public IntMappingType virIntMappingType() {
+ IntMappingType result = null;
+
+ switch (type) {
+ case GROUP:
+ result = IntMappingType.GroupVirtualSchema;
+ break;
+
+ case MEMBERSHIP:
+ result = IntMappingType.MembershipVirtualSchema;
+ break;
+
+ case USER:
+ result = IntMappingType.UserVirtualSchema;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends MappingItem> Class<T> mappingItemClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ result = JPAUMappingItem.class;
+ break;
+
+ case GROUP:
+ result = JPAGMappingItem.class;
+ break;
+
+ case MEMBERSHIP:
+ result = AbstractMappingItem.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AbstractAttributableTO> T newAttributableTO() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new UserTO();
+ break;
+ case GROUP:
+ result = (T) new GroupTO();
+ break;
+ case MEMBERSHIP:
+ result = (T) new MembershipTO();
+ break;
+ case CONFIGURATION:
+ result = (T) new ConfTO();
+ break;
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AbstractSubjectTO> T newSubjectTO() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new UserTO();
+ break;
+ case GROUP:
+ result = (T) new GroupTO();
+ break;
+ case MEMBERSHIP:
+ case CONFIGURATION:
+ default:
+ break;
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
----------------------------------------------------------------------
diff --cc core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
index 2d8a85b,304fde0..4267815
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/PolicyTest.java
@@@ -29,7 -29,7 +29,6 @@@ import org.apache.syncope.common.lib.ty
import org.apache.syncope.common.lib.types.SyncPolicySpec;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
--import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Policy;
import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
@@@ -76,22 -86,22 +75,9 @@@ public class PolicyTest extends Abstrac
policyDAO.save(policy);
}
-- @Test(expected = InvalidEntityException.class)
-- public void saveSecondPasswordPolicy() {
-- PasswordPolicySpec passwordPolicy = new PasswordPolicySpec();
-- passwordPolicy.setMaxLength(8);
-- passwordPolicy.setMinLength(6);
--
- PasswordPolicy policy = entityFactory.newEntity(PasswordPolicy.class);
- PasswordPolicy policy = entityFactory.newPolicy(PasswordPolicy.class, true);
-- policy.setSpecification(passwordPolicy);
-- policy.setDescription("global password policy");
--
-- policyDAO.save(policy);
-- }
--
@Test
public void create() {
- SyncPolicy policy = entityFactory.newPolicy(SyncPolicy.class, false);
+ SyncPolicy policy = entityFactory.newEntity(SyncPolicy.class);
final String syncURuleName = "net.tirasa.sync.correlation.TirasaURule";
final String syncRRuleName = "net.tirasa.sync.correlation.TirasaRRule";
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
----------------------------------------------------------------------
diff --cc core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
index 811d808,0000000..e5e55fe
mode 100644,000000..100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/RealmTest.java
@@@ -1,178 -1,0 +1,178 @@@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.types.EntityViolationType;
+import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
+import org.apache.syncope.core.persistence.api.dao.MalformedPathException;
+import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.jpa.AbstractTest;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class RealmTest extends AbstractTest {
+
+ @Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
+ private PolicyDAO policyDAO;
+
+ @Test
+ public void getRoot() {
+ assertNotNull(realmDAO.getRoot());
+ }
+
+ @Test
+ public void find() {
+ Realm realm = realmDAO.find(1L);
+ assertNotNull(realm);
+ assertEquals(SyncopeConstants.ROOT_REALM, realm.getName());
+ assertEquals(SyncopeConstants.ROOT_REALM, realm.getFullPath());
+
+ realm = realmDAO.find(3L);
+ assertNotNull(realm);
+ assertEquals("even", realm.getName());
+ assertEquals("/even", realm.getFullPath());
+ assertEquals(1, realm.getParent().getKey(), 0);
+ assertEquals(realmDAO.getRoot(), realm.getParent());
+
+ realm = realmDAO.find("/even/two");
+ assertNotNull(realm);
+ assertEquals(4, realm.getKey(), 0);
+ assertEquals("two", realm.getName());
+ assertEquals("/even/two", realm.getFullPath());
+ }
+
+ @Test(expected = MalformedPathException.class)
+ public void findInvalidPath() {
+ realmDAO.find("even/two");
+ }
+
+ @Test
+ public void findChildren() {
+ List<Realm> children = realmDAO.findChildren(realmDAO.find(SyncopeConstants.ROOT_REALM));
+ assertEquals(2, children.size());
+ assertTrue(children.contains(realmDAO.find("/odd")));
+ assertTrue(children.contains(realmDAO.find("/even")));
+
+ children = realmDAO.findChildren(realmDAO.find("/odd"));
+ assertTrue(children.isEmpty());
+ }
+
+ @Test
+ public void findDescendants() {
+ assertTrue(CollectionUtils.disjunction(realmDAO.findAll(), realmDAO.findDescendants(realmDAO.getRoot())).
+ isEmpty());
+ }
+
+ @Test
+ public void findAll() {
+ List<Realm> list = realmDAO.findAll();
+ assertNotNull(list);
+ assertFalse(list.isEmpty());
+ for (Realm realm : list) {
+ assertNotNull(realm);
+ }
+ }
+
+ @Test
+ public void save() {
+ Realm realm = entityFactory.newEntity(Realm.class);
+ realm.setName("last");
+ realm.setParent(realmDAO.find("/even/two"));
+ assertNull(realm.getKey());
+
+ Realm actual = realmDAO.save(realm);
+ assertNotNull(actual.getKey());
+ assertEquals("last", actual.getName());
+ assertEquals("/even/two/last", actual.getFullPath());
+ assertEquals(realmDAO.find("/even/two"), actual.getParent());
- assertNull(realm.getAccountPolicy());
- assertNull(realm.getPasswordPolicy());
++ assertEquals(5L, realm.getAccountPolicy().getKey(), 0);
++ assertEquals(2L, realm.getPasswordPolicy().getKey(), 0);
+
+ realm = actual;
+ realm.setAccountPolicy((AccountPolicy) policyDAO.find(6L));
+ realm.setPasswordPolicy((PasswordPolicy) policyDAO.find(4L));
+
+ actual = realmDAO.save(realm);
- assertNotNull(actual.getAccountPolicy());
- assertNotNull(actual.getPasswordPolicy());
++ assertEquals(6L, actual.getAccountPolicy().getKey(), 0);
++ assertEquals(4L, actual.getPasswordPolicy().getKey(), 0);
+ }
+
+ @Test
+ public void saveInvalidName() {
+ Realm realm = entityFactory.newEntity(Realm.class);
+ realm.setName(" a name");
+ realm.setParent(realmDAO.getRoot());
+
+ try {
+ realmDAO.save(realm);
+ fail();
+ } catch (InvalidEntityException e) {
+ assertTrue(e.hasViolation(EntityViolationType.InvalidRealm));
+ }
+ }
+
+ @Test
+ public void saveNullParent() {
+ Realm realm = entityFactory.newEntity(Realm.class);
+ realm.setName("name");
+ realm.setParent(null);
+
+ try {
+ realmDAO.save(realm);
+ fail();
+ } catch (InvalidEntityException e) {
+ assertTrue(e.hasViolation(EntityViolationType.InvalidRealm));
+ }
+ }
+
+ @Test
+ public void delete() {
+ Realm realm = entityFactory.newEntity(Realm.class);
+ realm.setName("name");
+ realm.setParent(realmDAO.getRoot());
+
+ Realm actual = realmDAO.save(realm);
+ assertNotNull(actual);
+
+ Long key = actual.getKey();
+ assertNotNull(realmDAO.find(key));
+
+ realmDAO.delete(key);
+ assertNull(realmDAO.find(key));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
----------------------------------------------------------------------
diff --cc core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
index 29fbc4c,38be1ac..d606dac
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/entity/UserTest.java
@@@ -185,10 -189,9 +185,10 @@@ public class UserTest extends AbstractT
public void issue237() {
User user = entityFactory.newEntity(User.class);
user.setUsername("username");
+ user.setRealm(realmDAO.find("/even/two"));
user.setCreationDate(new Date());
-- user.setPassword("password", CipherAlgorithm.AES);
++ user.setPassword("password123", CipherAlgorithm.AES);
User actual = userDAO.save(user);
assertNotNull(actual);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
----------------------------------------------------------------------
diff --cc core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
index ab71890,c10481f..92b93a2
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
@@@ -50,9 -52,12 +53,13 @@@ import org.apache.syncope.core.persiste
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.workflow.api.WorkflowException;
import org.identityconnectors.framework.common.exceptions.ConfigurationException;
+import org.identityconnectors.framework.common.exceptions.ConnectorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+ import org.springframework.beans.factory.annotation.Autowired;
+ import org.springframework.context.annotation.Configuration;
+ import org.springframework.context.annotation.PropertySource;
+ import org.springframework.core.env.Environment;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.security.access.AccessDeniedException;
@@@ -67,6 -74,17 +76,19 @@@ public class RestServiceExceptionMappe
private final ValidationExceptionMapper validationEM = new ValidationExceptionMapper();
+ @Autowired
+ private Environment env;
+
- private static final Map<String, String> exceptionCodeMap;
++ private static final Map<String, String> EXCEPTION_CODE_MAP = new HashMap<String, String>() {
+
- static {
- exceptionCodeMap = new HashMap<>();
- exceptionCodeMap.put("23000", "UniqueConstraintViolation");
- exceptionCodeMap.put("23505", "UniqueConstraintViolation");
- }
++ private static final long serialVersionUID = -7688359318035249200L;
++
++ {
++ put("23000", "UniqueConstraintViolation");
++ put("23505", "UniqueConstraintViolation");
++ }
++ };
+
@Override
public Response toResponse(final Exception ex) {
LOG.error("Exception thrown by REST method: " + ex.getMessage(), ex);
@@@ -90,14 -108,12 +112,14 @@@
} else if (ex instanceof AccessDeniedException) {
builder = Response.status(Response.Status.UNAUTHORIZED).
header(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM_UNAUTHORIZED);
- } else if (ex instanceof UnauthorizedRoleException) {
- builder = builder(Response.Status.UNAUTHORIZED, ClientExceptionType.UnauthorizedRole, getExMessage(ex));
+ } else if (ex instanceof UnauthorizedException) {
+ builder = builder(ClientExceptionType.Unauthorized, getExMessage(ex));
} else if (ex instanceof EntityExistsException || ex instanceof DuplicateException) {
- builder = builder(ClientExceptionType.EntityExists, getExMessage(ex));
- } else if (ex instanceof DataIntegrityViolationException) {
- builder = builder(ClientExceptionType.DataIntegrityViolation, getExMessage(ex));
- builder = builder(Response.Status.CONFLICT, ClientExceptionType.EntityExists, getJPAMessage(ex));
++ builder = builder(ClientExceptionType.EntityExists, getJPAMessage(ex));
+ } else if (ex instanceof DataIntegrityViolationException || ex instanceof JpaSystemException) {
- builder = builder(Response.Status.CONFLICT, ClientExceptionType.DataIntegrityViolation, getJPAMessage(ex));
++ builder = builder(ClientExceptionType.DataIntegrityViolation, getJPAMessage(ex));
+ } else if (ex instanceof ConnectorException) {
- builder = builder(ClientExceptionType.ConnectorException, getExMessage(ex));
++ builder = builder(ClientExceptionType.ConnectorException, getExMessage(ex));
} else {
builder = processNotFoundExceptions(ex);
if (builder == null) {
@@@ -288,4 -301,18 +309,18 @@@
private String getExMessage(final Throwable ex) {
return (ex.getCause() == null) ? ex.getMessage() : ex.getCause().getMessage();
}
+
+ private String getJPAMessage(final Throwable ex) {
+ Throwable throwable = ExceptionUtils.getRootCause(ex);
+ String message = null;
+ if (throwable instanceof SQLException) {
+ String SQLState = ((SQLException) throwable).getSQLState();
- String messageKey = exceptionCodeMap.get(SQLState);
++ String messageKey = EXCEPTION_CODE_MAP.get(SQLState);
+ if (messageKey != null) {
+ message = env.getProperty("errMessage." + messageKey);
+ }
+ }
+
+ return message == null ? getExMessage(ex) : message;
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ExceptionMapperITCase.java
----------------------------------------------------------------------
diff --cc fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ExceptionMapperITCase.java
index 0000000,3b48ad6..6a42f5a
mode 000000,100644..100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ExceptionMapperITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ExceptionMapperITCase.java
@@@ -1,0 -1,139 +1,143 @@@
+ /*
+ * 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.fit.core.reference;
+
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.fail;
+
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.util.Properties;
+ import org.apache.commons.io.IOUtils;
+ import org.apache.syncope.common.lib.SyncopeClientCompositeException;
++import org.apache.syncope.common.lib.SyncopeConstants;
+ import org.apache.syncope.common.lib.to.PlainSchemaTO;
+ import org.apache.syncope.common.lib.to.RoleTO;
+ import org.apache.syncope.common.lib.to.UserTO;
+ import org.apache.syncope.common.lib.types.AttrSchemaType;
+ import org.apache.syncope.common.lib.types.AttributableType;
+ import org.apache.syncope.common.lib.types.SchemaType;
-import org.junit.Assert;
+ import org.junit.BeforeClass;
+ import org.junit.FixMethodOrder;
+ import org.junit.Test;
+ import org.junit.runners.MethodSorters;
+
+ @FixMethodOrder(MethodSorters.JVM)
+ public class ExceptionMapperITCase extends AbstractITCase {
+
- private static final Properties props = new Properties();
++ private static final Properties ERROR_MESSAGES = new Properties();
+
+ @BeforeClass
+ public static void setUpErrorMessages() throws IOException {
+ InputStream propStream = null;
+ try {
+ propStream = ExceptionMapperITCase.class.getResourceAsStream("/errorMessages.properties");
- props.load(propStream);
++ ERROR_MESSAGES.load(propStream);
+ } catch (Exception e) {
+ LOG.error("Could not load /errorMessages.properties", e);
+ } finally {
+ IOUtils.closeQuietly(propStream);
+ }
+ }
+
+ @Test
+ public void uniqueSchemaConstraint() {
+ // 1. create an user schema with unique constraint
+ PlainSchemaTO schemaTO = new PlainSchemaTO();
- String schema_UID = getUUIDString();
- schemaTO.setKey("unique" + schema_UID);
++ String schemaUID = getUUIDString();
++ schemaTO.setKey("unique" + schemaUID);
+ schemaTO.setType(AttrSchemaType.String);
+ schemaTO.setUniqueConstraint(true);
+ createSchema(AttributableType.USER, SchemaType.PLAIN, schemaTO);
+
+ // 2. create an user with mandatory attributes and unique
- UserTO userTO_1 = new UserTO();
- String userId_1 = getUUIDString() + "issue654_1@syncope.apache.org";
- userTO_1.setUsername(userId_1);
- userTO_1.setPassword("password");
-
- userTO_1.getPlainAttrs().add(attrTO("userId", userId_1));
- userTO_1.getPlainAttrs().add(attrTO("fullname", userId_1));
- userTO_1.getPlainAttrs().add(attrTO("surname", userId_1));
- userTO_1.getPlainAttrs().add(attrTO("unique" + schema_UID, "unique" + schema_UID));
-
- createUser(userTO_1);
-
- // 3. create an other user with mandatory attributes and unique with the same value of userTO_1
- UserTO userTO_2 = new UserTO();
- String userId_2 = getUUIDString() + "issue654_2@syncope.apache.org";
- userTO_2.setUsername(userId_2);
- userTO_2.setPassword("password");
-
- userTO_2.getPlainAttrs().add(attrTO("userId", userId_2));
- userTO_2.getPlainAttrs().add(attrTO("fullname", userId_2));
- userTO_2.getPlainAttrs().add(attrTO("surname", userId_2));
- userTO_2.getPlainAttrs().add(attrTO("unique" + schema_UID, "unique" + schema_UID));
++ UserTO userTO1 = new UserTO();
++ userTO1.setRealm(SyncopeConstants.ROOT_REALM);
++ String userId1 = getUUIDString() + "issue654_1@syncope.apache.org";
++ userTO1.setUsername(userId1);
++ userTO1.setPassword("password123");
++
++ userTO1.getPlainAttrs().add(attrTO("userId", userId1));
++ userTO1.getPlainAttrs().add(attrTO("fullname", userId1));
++ userTO1.getPlainAttrs().add(attrTO("surname", userId1));
++ userTO1.getPlainAttrs().add(attrTO("unique" + schemaUID, "unique" + schemaUID));
++
++ createUser(userTO1);
++
++ // 3. create an other user with mandatory attributes and unique with the same value of userTO1
++ UserTO userTO2 = new UserTO();
++ userTO2.setRealm(SyncopeConstants.ROOT_REALM);
++ String userId2 = getUUIDString() + "issue654_2@syncope.apache.org";
++ userTO2.setUsername(userId2);
++ userTO2.setPassword("password123");
++
++ userTO2.getPlainAttrs().add(attrTO("userId", userId2));
++ userTO2.getPlainAttrs().add(attrTO("fullname", userId2));
++ userTO2.getPlainAttrs().add(attrTO("surname", userId2));
++ userTO2.getPlainAttrs().add(attrTO("unique" + schemaUID, "unique" + schemaUID));
+
+ try {
- createUser(userTO_2);
++ createUser(userTO2);
++ fail();
+ } catch (Exception e) {
- String message = props.getProperty("errMessage.UniqueConstraintViolation");
- Assert.assertEquals(e.getMessage(), "DataIntegrityViolation [" + message + "]");
++ String message = ERROR_MESSAGES.getProperty("errMessage.UniqueConstraintViolation");
++ assertEquals(e.getMessage(), "DataIntegrityViolation [" + message + "]");
+ }
+ }
+
+ @Test
+ public void sameRoleName() {
- //Create the first role
- RoleTO roleTO_1 = new RoleTO();
- String role_UUID = getUUIDString();
- roleTO_1.setName("child1" + role_UUID);
- roleTO_1.setParent(1L);
- createRole(roleTO_1);
- //Create the second role, with the same parent and the same role of roleTO_1
- RoleTO roleTO_2 = new RoleTO();
- roleTO_2.setName("child1" + role_UUID);
- roleTO_2.setParent(1L);
++ // Create the first role
++ RoleTO roleTO1 = new RoleTO();
++ String roleUUID = getUUIDString();
++ roleTO1.setName("child1" + roleUUID);
++ createRole(roleTO1);
++
++ // Create the second role, with the same parent and the same role of roleTO1
++ RoleTO roleTO2 = new RoleTO();
++ roleTO2.setName("child1" + roleUUID);
+ try {
- createRole(roleTO_2);
++ createRole(roleTO2);
++ fail();
+ } catch (Exception e) {
- String message = props.getProperty("errMessage.UniqueConstraintViolation");
- Assert.assertEquals(e.getMessage(), "DataIntegrityViolation [" + message + "]");
++ String message = ERROR_MESSAGES.getProperty("errMessage.UniqueConstraintViolation");
++ assertEquals(e.getMessage(), "DataIntegrityViolation [" + message + "]");
+ }
+ }
+
+ @Test
+ public void headersMultiValue() {
+ UserTO userTO = new UserTO();
++ userTO.setRealm(SyncopeConstants.ROOT_REALM);
+ String userId = getUUIDString() + "issue654@syncope.apache.org";
+ userTO.setUsername(userId);
- userTO.setPassword("password");
++ userTO.setPassword("password123");
+
+ userTO.getPlainAttrs().add(attrTO("userId", "issue654"));
+ userTO.getPlainAttrs().add(attrTO("fullname", userId));
+ userTO.getPlainAttrs().add(attrTO("surname", userId));
+
+ try {
+ createUser(userTO);
+ fail();
+ } catch (SyncopeClientCompositeException e) {
+ assertEquals(2, e.getExceptions().size());
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
----------------------------------------------------------------------
diff --cc fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
index c922413,6e8f213..f0e9920
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
@@@ -30,8 -29,7 +30,10 @@@ import java.util.HashSet
import java.util.List;
import java.util.Set;
import javax.ws.rs.core.Response;
++import org.apache.commons.collections4.CollectionUtils;
++import org.apache.commons.collections4.Predicate;
import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.mod.StatusMod;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.AbstractTaskTO;
@@@ -183,7 -179,15 +185,15 @@@ public class SyncTaskITCase extends Abs
assertTrue(userTO.getMemberships().get(0).getPlainAttrMap().containsKey("subscriptionDate"));
// Unmatching --> Assign (link)
+ // SYNCOPE-658
assertTrue(userTO.getResources().contains(RESOURCE_NAME_CSV));
- int counter = 0;
- for (AttrTO attributeTO : userTO.getDerAttrs()) {
- if ("csvuserid".equals(attributeTO.getSchema())) {
- counter++;
++ assertEquals(1, CollectionUtils.countMatches(userTO.getDerAttrs(), new Predicate<AttrTO>() {
++
++ @Override
++ public boolean evaluate(final AttrTO attributeTO) {
++ return "csvuserid".equals(attributeTO.getSchema());
+ }
- }
- assertEquals(1, counter);
++ }));
userTO = readUser("test8");
assertNotNull(userTO);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/pom.xml
----------------------------------------------------------------------
diff --cc pom.xml
index cc4ee0a,b57900f..0c34a76
--- a/pom.xml
+++ b/pom.xml
@@@ -357,10 -357,9 +357,10 @@@ under the License
<commons-codec.version>1.10</commons-codec.version>
<commons-jexl.version>2.1.1</commons-jexl.version>
<commons-lang.version>3.4</commons-lang.version>
- <commons.logging.version>1.1.3</commons.logging.version>
+ <commons-collection.version>4.0</commons-collection.version>
+ <commons-logging.version>1.1.3</commons-logging.version>
- <h2.version>1.4.186</h2.version>
+ <h2.version>1.4.187</h2.version>
<junit.version>4.12</junit.version>
<selenium.version>2.45.0</selenium.version>
[26/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/NotificationModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/NotificationModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/NotificationModalPage.java
index d4917f3..98d8862 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/NotificationModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/NotificationModalPage.java
@@ -25,7 +25,7 @@ import java.util.EnumSet;
import java.util.List;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.panels.LoggerCategoryPanel;
-import org.apache.syncope.client.console.panels.RoleSearchPanel;
+import org.apache.syncope.client.console.panels.GroupSearchPanel;
import org.apache.syncope.client.console.panels.UserSearchPanel;
import org.apache.syncope.client.console.rest.LoggerRestClient;
import org.apache.syncope.client.console.rest.NotificationRestClient;
@@ -108,26 +108,26 @@ class NotificationModalPage extends BaseModalPage {
form.add(aboutContainer);
final AjaxCheckBoxPanel checkAbout = new AjaxCheckBoxPanel("checkAbout", "checkAbout", new Model<Boolean>(
- notificationTO.getUserAbout() == null && notificationTO.getRoleAbout() == null));
+ notificationTO.getUserAbout() == null && notificationTO.getGroupAbout() == null));
aboutContainer.add(checkAbout);
final AjaxCheckBoxPanel checkUserAbout = new AjaxCheckBoxPanel("checkUserAbout", "checkUserAbout",
new Model<Boolean>(notificationTO.getUserAbout() != null));
aboutContainer.add(checkUserAbout);
- final AjaxCheckBoxPanel checkRoleAbout = new AjaxCheckBoxPanel("checkRoleAbout", "checkRoleAbout",
- new Model<Boolean>(notificationTO.getRoleAbout() != null));
- aboutContainer.add(checkRoleAbout);
+ final AjaxCheckBoxPanel checkGroupAbout = new AjaxCheckBoxPanel("checkGroupAbout", "checkGroupAbout",
+ new Model<Boolean>(notificationTO.getGroupAbout() != null));
+ aboutContainer.add(checkGroupAbout);
final UserSearchPanel userAbout =
new UserSearchPanel.Builder("userAbout").fiql(notificationTO.getUserAbout()).build();
aboutContainer.add(userAbout);
userAbout.setEnabled(checkUserAbout.getModelObject());
- final RoleSearchPanel roleAbout =
- new RoleSearchPanel.Builder("roleAbout").fiql(notificationTO.getRoleAbout()).build();
- aboutContainer.add(roleAbout);
- roleAbout.setEnabled(checkRoleAbout.getModelObject());
+ final GroupSearchPanel groupAbout =
+ new GroupSearchPanel.Builder("groupAbout").fiql(notificationTO.getGroupAbout()).build();
+ aboutContainer.add(groupAbout);
+ groupAbout.setEnabled(checkGroupAbout.getModelObject());
checkAbout.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
@@ -137,9 +137,9 @@ class NotificationModalPage extends BaseModalPage {
protected void onUpdate(final AjaxRequestTarget target) {
if (checkAbout.getModelObject()) {
checkUserAbout.setModelObject(Boolean.FALSE);
- checkRoleAbout.setModelObject(Boolean.FALSE);
+ checkGroupAbout.setModelObject(Boolean.FALSE);
userAbout.setEnabled(Boolean.FALSE);
- roleAbout.setEnabled(Boolean.FALSE);
+ groupAbout.setEnabled(Boolean.FALSE);
} else {
checkAbout.setModelObject(Boolean.TRUE);
}
@@ -155,8 +155,8 @@ class NotificationModalPage extends BaseModalPage {
protected void onUpdate(final AjaxRequestTarget target) {
if (checkUserAbout.getModelObject()) {
checkAbout.setModelObject(!checkUserAbout.getModelObject());
- checkRoleAbout.setModelObject(!checkUserAbout.getModelObject());
- roleAbout.setEnabled(Boolean.FALSE);
+ checkGroupAbout.setModelObject(!checkUserAbout.getModelObject());
+ groupAbout.setEnabled(Boolean.FALSE);
} else {
checkUserAbout.setModelObject(Boolean.TRUE);
}
@@ -165,20 +165,20 @@ class NotificationModalPage extends BaseModalPage {
}
});
- checkRoleAbout.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+ checkGroupAbout.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- if (checkRoleAbout.getModelObject()) {
+ if (checkGroupAbout.getModelObject()) {
checkAbout.setModelObject(Boolean.FALSE);
checkUserAbout.setModelObject(Boolean.FALSE);
userAbout.setEnabled(Boolean.FALSE);
} else {
- checkRoleAbout.setModelObject(Boolean.TRUE);
+ checkGroupAbout.setModelObject(Boolean.TRUE);
}
- roleAbout.setEnabled(Boolean.TRUE);
+ groupAbout.setEnabled(Boolean.TRUE);
target.add(aboutContainer);
}
});
@@ -353,9 +353,9 @@ class NotificationModalPage extends BaseModalPage {
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
notificationTO.setUserAbout(
!checkAbout.getModelObject() && checkUserAbout.getModelObject() ? userAbout.buildFIQL() : null);
- notificationTO.setRoleAbout(
+ notificationTO.setGroupAbout(
!checkAbout.getModelObject()
- && checkRoleAbout.getModelObject() ? roleAbout.buildFIQL() : null);
+ && checkGroupAbout.getModelObject() ? groupAbout.buildFIQL() : null);
notificationTO.setRecipients(checkRecipients.getModelObject() ? recipients.buildFIQL() : null);
notificationTO.getStaticRecipients().removeAll(Collections.singleton(null));
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/PolicyModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/PolicyModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/PolicyModalPage.java
index efa61c1..8daecb7 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/PolicyModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/PolicyModalPage.java
@@ -36,7 +36,7 @@ import org.apache.syncope.common.lib.to.AbstractPolicyTO;
import org.apache.syncope.common.lib.to.AccountPolicyTO;
import org.apache.syncope.common.lib.to.PasswordPolicyTO;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.SyncPolicyTO;
import org.apache.syncope.common.lib.types.AccountPolicySpec;
import org.apache.syncope.common.lib.types.PasswordPolicySpec;
@@ -235,10 +235,10 @@ public class PolicyModalPage<T extends AbstractPolicyTO> extends BaseModalPage {
new AjaxFallbackDefaultDataTable<>("resources", resColumns, resDataProvider, 10);
form.add(resources);
- List<IColumn<RoleTO, String>> roleColumns = new ArrayList<>();
- roleColumns.add(new PropertyColumn<RoleTO, String>(new ResourceModel("key", "key"), "key", "key"));
- roleColumns.add(new PropertyColumn<RoleTO, String>(new ResourceModel("name", "name"), "name", "name"));
- roleColumns.add(new AbstractColumn<RoleTO, String>(new StringResourceModel("actions", this, null, "")) {
+ List<IColumn<GroupTO, String>> groupColumns = new ArrayList<>();
+ groupColumns.add(new PropertyColumn<GroupTO, String>(new ResourceModel("key", "key"), "key", "key"));
+ groupColumns.add(new PropertyColumn<GroupTO, String>(new ResourceModel("name", "name"), "name", "name"));
+ groupColumns.add(new AbstractColumn<GroupTO, String>(new StringResourceModel("actions", this, null, "")) {
private static final long serialVersionUID = 2054811145491901166L;
@@ -248,10 +248,10 @@ public class PolicyModalPage<T extends AbstractPolicyTO> extends BaseModalPage {
}
@Override
- public void populateItem(final Item<ICellPopulator<RoleTO>> cellItem, final String componentId,
- final IModel<RoleTO> model) {
+ public void populateItem(final Item<ICellPopulator<GroupTO>> cellItem, final String componentId,
+ final IModel<GroupTO> model) {
- final RoleTO role = model.getObject();
+ final GroupTO group = model.getObject();
final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference());
panel.add(new ActionLink() {
@@ -266,52 +266,51 @@ public class PolicyModalPage<T extends AbstractPolicyTO> extends BaseModalPage {
@Override
public Page createPage() {
- return new RoleModalPage(PolicyModalPage.this.getPageReference(), mwindow, role);
+ return new GroupModalPage(PolicyModalPage.this.getPageReference(), mwindow, group);
}
});
mwindow.show(target);
}
- }, ActionLink.ActionType.EDIT, "Roles");
+ }, ActionLink.ActionType.EDIT, "Groups");
cellItem.add(panel);
}
});
- ISortableDataProvider<RoleTO, String> roleDataProvider = new SortableDataProvider<RoleTO, String>() {
+ ISortableDataProvider<GroupTO, String> groupDataProvider = new SortableDataProvider<GroupTO, String>() {
private static final long serialVersionUID = 8263758912838836438L;
@Override
- public Iterator<? extends RoleTO> iterator(final long first, final long count) {
- List<RoleTO> roles = new ArrayList<>();
+ public Iterator<? extends GroupTO> iterator(final long first, final long count) {
+ List<GroupTO> groups = new ArrayList<>();
if (policyTO.getKey() > 0) {
- for (Long roleId : policyRestClient.getPolicy(policyTO.getKey()).
- getUsedByRoles().subList((int) first, (int) first + (int) count)) {
+ for (Long groupId : policyRestClient.getPolicy(policyTO.getKey()).getUsedByGroups().
+ subList((int) first, (int) first + (int) count)) {
- roles.add(roleRestClient.read(roleId));
+ groups.add(groupRestClient.read(groupId));
}
}
- return roles.iterator();
+ return groups.iterator();
}
@Override
public long size() {
return policyTO.getKey() == 0
? 0
- : policyRestClient.getPolicy(policyTO.getKey()).
- getUsedByRoles().size();
+ : policyRestClient.getPolicy(policyTO.getKey()).getUsedByGroups().size();
}
@Override
- public IModel<RoleTO> model(final RoleTO object) {
+ public IModel<GroupTO> model(final GroupTO object) {
return new Model<>(object);
}
};
- final AjaxFallbackDefaultDataTable<RoleTO, String> roles =
- new AjaxFallbackDefaultDataTable<>("roles", roleColumns, roleDataProvider, 10);
- form.add(roles);
+ final AjaxFallbackDefaultDataTable<GroupTO, String> groups =
+ new AjaxFallbackDefaultDataTable<>("groups", groupColumns, groupDataProvider, 10);
+ form.add(groups);
mwindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
@@ -320,7 +319,7 @@ public class PolicyModalPage<T extends AbstractPolicyTO> extends BaseModalPage {
@Override
public void onClose(final AjaxRequestTarget target) {
target.add(resources);
- target.add(roles);
+ target.add(groups);
if (isModalResult()) {
info(getString(Constants.OPERATION_SUCCEEDED));
feedbackPanel.refresh(target);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
index dc3ee88..6418d61 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
@@ -35,7 +35,7 @@ import org.apache.syncope.common.lib.to.AbstractAttributableTO;
import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
import org.apache.syncope.common.lib.wrap.AbstractWrappable;
@@ -83,7 +83,7 @@ public class ProvisioningModalPage<T extends AbstractAttributableTO> extends Abs
this.resourceTO = resourceTO;
this.typeRef = typeRef;
- statusUtils = new StatusUtils((UserTO.class.isAssignableFrom(typeRef) ? userRestClient : roleRestClient));
+ statusUtils = new StatusUtils((UserTO.class.isAssignableFrom(typeRef) ? userRestClient : groupRestClient));
add(new Label("displayName", StringUtils.EMPTY));
@@ -199,7 +199,7 @@ public class ProvisioningModalPage<T extends AbstractAttributableTO> extends Abs
if (UserTO.class.isAssignableFrom(typeRef)) {
subjects.addAll((List<T>) userRestClient.search(fiql, 1, ROWS_PER_PAGE, new SortParam<>("key", true)));
} else {
- subjects.addAll((List<T>) roleRestClient.search(fiql, 1, ROWS_PER_PAGE, new SortParam<>("key", true)));
+ subjects.addAll((List<T>) groupRestClient.search(fiql, 1, ROWS_PER_PAGE, new SortParam<>("key", true)));
}
final List<ConnObjectWrapper> connObjects = statusUtils.getConnectorObjects(
@@ -209,11 +209,10 @@ public class ProvisioningModalPage<T extends AbstractAttributableTO> extends Abs
final LinkedHashMap<String, StatusBean> initialStatusBeanMap = new LinkedHashMap<>(connObjects.size());
for (ConnObjectWrapper entry : connObjects) {
- final StatusBean statusBean = statusUtils.getStatusBean(
- entry.getAttributable(),
+ final StatusBean statusBean = statusUtils.getStatusBean(entry.getAttributable(),
entry.getResourceName(),
entry.getConnObjectTO(),
- RoleTO.class.isAssignableFrom(typeRef));
+ GroupTO.class.isAssignableFrom(typeRef));
initialStatusBeanMap.put(entry.getResourceName(), statusBean);
statusBeans.add(statusBean);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/PushTaskModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/PushTaskModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/PushTaskModalPage.java
index a799b15..51852be 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/PushTaskModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/PushTaskModalPage.java
@@ -20,7 +20,7 @@ package org.apache.syncope.client.console.pages;
import java.util.List;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.panels.RoleSearchPanel;
+import org.apache.syncope.client.console.panels.GroupSearchPanel;
import org.apache.syncope.client.console.panels.UserSearchPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.common.lib.to.PushTaskTO;
@@ -44,11 +44,11 @@ public class PushTaskModalPage extends AbstractSyncTaskModalPage {
private final UserSearchPanel userFilter;
- private final RoleSearchPanel roleFilter;
+ private final GroupSearchPanel groupFilter;
private final AjaxCheckBoxPanel checkUserFilter;
- private final AjaxCheckBoxPanel checkRoleFilter;
+ private final AjaxCheckBoxPanel checkGroupFilter;
@Override
protected List<String> getSyncActions() {
@@ -75,21 +75,21 @@ public class PushTaskModalPage extends AbstractSyncTaskModalPage {
filterContainer.setOutputMarkupId(true);
checkUserFilter = new AjaxCheckBoxPanel("checkUserFilter", "checkUserFilter",
- new Model<Boolean>(taskTO.getUserFilter() != null));
+ new Model<>(taskTO.getUserFilter() != null));
filterContainer.add(checkUserFilter);
- checkRoleFilter = new AjaxCheckBoxPanel("checkRoleFilter", "checkRoleFilter",
- new Model<Boolean>(taskTO.getRoleFilter() != null));
- filterContainer.add(checkRoleFilter);
+ checkGroupFilter = new AjaxCheckBoxPanel("checkGroupFilter", "checkGroupFilter",
+ new Model<>(taskTO.getGroupFilter() != null));
+ filterContainer.add(checkGroupFilter);
userFilter = new UserSearchPanel.Builder("userFilter").fiql(taskTO.getUserFilter()).build();
userFilter.setEnabled(checkUserFilter.getModelObject());
filterContainer.add(userFilter);
- roleFilter = new RoleSearchPanel.Builder("roleFilter").fiql(taskTO.getRoleFilter()).build();
- roleFilter.setEnabled(checkRoleFilter.getModelObject());
- filterContainer.add(roleFilter);
+ groupFilter = new GroupSearchPanel.Builder("groupFilter").fiql(taskTO.getGroupFilter()).build();
+ groupFilter.setEnabled(checkGroupFilter.getModelObject());
+ filterContainer.add(groupFilter);
checkUserFilter.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
@@ -102,13 +102,13 @@ public class PushTaskModalPage extends AbstractSyncTaskModalPage {
}
});
- checkRoleFilter.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+ checkGroupFilter.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- roleFilter.setEnabled(checkRoleFilter.getModelObject());
+ groupFilter.setEnabled(checkGroupFilter.getModelObject());
target.add(filterContainer);
}
});
@@ -129,7 +129,7 @@ public class PushTaskModalPage extends AbstractSyncTaskModalPage {
private void setFilters(final PushTaskTO pushTaskTO) {
// set user filter if enabled
pushTaskTO.setUserFilter(checkUserFilter.getModelObject() ? userFilter.buildFIQL() : null);
- // set role filter if enabled
- pushTaskTO.setRoleFilter(checkRoleFilter.getModelObject() ? roleFilter.buildFIQL() : null);
+ // set group filter if enabled
+ pushTaskTO.setGroupFilter(checkGroupFilter.getModelObject() ? groupFilter.buildFIQL() : null);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/ReportletConfModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ReportletConfModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ReportletConfModalPage.java
index e7155ca..36560b0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ReportletConfModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ReportletConfModalPage.java
@@ -27,7 +27,7 @@ import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.panels.RoleSearchPanel;
+import org.apache.syncope.client.console.panels.GroupSearchPanel;
import org.apache.syncope.client.console.panels.UserSearchPanel;
import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxButton;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
@@ -278,8 +278,8 @@ public class ReportletConfModalPage extends BaseModalPage {
fiql((String) wrapper.getPropertyValue(fieldName)).required(false).build();
// This is needed in order to manually update this.reportletConf with search panel selections
panel.setDefaultModel(new Model<String>(fieldName));
- } else if (String.class.equals(field.getType()) && annotation != null && annotation.roleSearch()) {
- panel = new RoleSearchPanel.Builder("value").
+ } else if (String.class.equals(field.getType()) && annotation != null && annotation.groupSearch()) {
+ panel = new GroupSearchPanel.Builder("value").
fiql((String) wrapper.getPropertyValue(fieldName)).required(false).build();
// This is needed in order to manually update this.reportletConf with search panel selections
panel.setDefaultModel(new Model<String>(fieldName));
@@ -305,16 +305,16 @@ public class ReportletConfModalPage extends BaseModalPage {
choices = schemaRestClient.getVirSchemaNames(AttributableType.USER);
break;
- case RolePlainSchema:
- choices = schemaRestClient.getPlainSchemaNames(AttributableType.ROLE);
+ case GroupPlainSchema:
+ choices = schemaRestClient.getPlainSchemaNames(AttributableType.GROUP);
break;
- case RoleDerivedSchema:
- choices = schemaRestClient.getDerSchemaNames(AttributableType.ROLE);
+ case GroupDerivedSchema:
+ choices = schemaRestClient.getDerSchemaNames(AttributableType.GROUP);
break;
- case RoleVirtualSchema:
- choices = schemaRestClient.getVirSchemaNames(AttributableType.ROLE);
+ case GroupVirtualSchema:
+ choices = schemaRestClient.getVirSchemaNames(AttributableType.GROUP);
break;
case MembershipPlainSchema:
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/ResourceModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ResourceModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ResourceModalPage.java
index d6f69cf..0becc1a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ResourceModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ResourceModalPage.java
@@ -76,7 +76,7 @@ public class ResourceModalPage extends BaseModalPage {
// Resource mapping panels
//--------------------------------
form.add(new ResourceMappingPanel("umapping", resourceTO, AttributableType.USER));
- form.add(new ResourceMappingPanel("rmapping", resourceTO, AttributableType.ROLE));
+ form.add(new ResourceMappingPanel("gmapping", resourceTO, AttributableType.GROUP));
//--------------------------------
//--------------------------------
@@ -116,11 +116,11 @@ public class ResourceModalPage extends BaseModalPage {
accountIdError = uAccountIdCount != 1;
}
- if (resourceTO.getRmapping() == null || resourceTO.getRmapping().getItems().isEmpty()) {
- resourceTO.setRmapping(null);
+ if (resourceTO.getGmapping() == null || resourceTO.getGmapping().getItems().isEmpty()) {
+ resourceTO.setGmapping(null);
} else {
int rAccountIdCount = 0;
- for (MappingItemTO item : resourceTO.getRmapping().getItems()) {
+ for (MappingItemTO item : resourceTO.getGmapping().getItems()) {
if (item.isAccountid()) {
rAccountIdCount++;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/Resources.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Resources.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Resources.java
index 0fabe59..542cc82 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Resources.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Resources.java
@@ -36,7 +36,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.LinkPanel;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
@@ -305,13 +305,13 @@ public class Resources extends BasePage {
@Override
public Page createPage() {
return new ProvisioningModalPage<>(
- getPageReference(), statusmodal, model.getObject(), RoleTO.class);
+ getPageReference(), statusmodal, model.getObject(), GroupTO.class);
}
});
statusmodal.show(target);
}
- }, ActionLink.ActionType.MANAGE_ROLES, "Resources");
+ }, ActionLink.ActionType.MANAGE_GROUPS, "Resources");
panel.add(new ActionLink() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModalPage.java
index b6ecb9e..e5017e3 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModalPage.java
@@ -35,7 +35,7 @@ import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.PropagationStatus;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.wicket.Component;
@@ -56,7 +56,7 @@ import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.request.resource.ContextRelativeResource;
/**
- * Show user or role status after performing a successful operation.
+ * Show user or group status after performing a successful operation.
*/
public class ResultStatusModalPage extends BaseModalPage {
@@ -133,8 +133,8 @@ public class ResultStatusModalPage extends BaseModalPage {
fragment.add(new Label("info",
((subject instanceof UserTO) && ((UserTO) subject).getUsername() != null)
? ((UserTO) subject).getUsername()
- : ((subject instanceof RoleTO) && ((RoleTO) subject).getName() != null)
- ? ((RoleTO) subject).getName()
+ : ((subject instanceof GroupTO) && ((GroupTO) subject).getName() != null)
+ ? ((GroupTO) subject).getName()
: String.valueOf(subject.getKey())));
final ListView<PropagationStatus> propRes = new ListView<PropagationStatus>("resources",
@@ -376,8 +376,7 @@ public class ResultStatusModalPage extends BaseModalPage {
private Fragment getStatusIcon(final String id, final String resourceName, final ConnObjectTO objectTO) {
final Image image;
final String alt, title;
- switch (statusUtils.getStatusBean(
- subject, resourceName, objectTO, this.subject instanceof RoleTO).getStatus()) {
+ switch (statusUtils.getStatusBean(subject, resourceName, objectTO, this.subject instanceof GroupTO).getStatus()) {
case ACTIVE:
image = new Image("status",
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleModalPage.java
deleted file mode 100644
index 3cb9148..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleModalPage.java
+++ /dev/null
@@ -1,162 +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.pages;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.SerializationUtils;
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.Mode;
-import org.apache.syncope.client.console.panels.RolePanel;
-import org.apache.syncope.common.lib.AttributableOperations;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.ResourceModel;
-
-/**
- * Modal window with Role form.
- */
-public class RoleModalPage extends BaseModalPage {
-
- private static final long serialVersionUID = -1732493223434085205L;
-
- protected final PageReference pageRef;
-
- protected final ModalWindow window;
-
- protected final Mode mode;
-
- protected final boolean createFlag;
-
- protected final RolePanel rolePanel;
-
- protected RoleTO originalRoleTO;
-
- public RoleModalPage(final PageReference pageRef, final ModalWindow window, final RoleTO roleTO) {
- this(pageRef, window, roleTO, Mode.ADMIN);
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public RoleModalPage(final PageReference pageRef, final ModalWindow window, final RoleTO roleTO, final Mode mode) {
- super();
-
- this.pageRef = pageRef;
- this.window = window;
- this.mode = mode;
-
- this.createFlag = roleTO.getKey() == 0;
- if (!createFlag) {
- originalRoleTO = SerializationUtils.clone(roleTO);
- }
-
- final Form<RoleTO> form = new Form<RoleTO>("roleForm");
- form.setMultiPart(true);
-
- add(new Label("displayName", roleTO.getKey() == 0 ? "" : roleTO.getDisplayName()));
-
- form.setModel(new CompoundPropertyModel<RoleTO>(roleTO));
-
- this.rolePanel = new RolePanel.Builder("rolePanel").form(form).roleTO(roleTO).
- roleModalPageMode(mode).pageRef(getPageReference()).build();
- form.add(rolePanel);
-
- final AjaxButton submit = new IndicatingAjaxButton(SUBMIT, new ResourceModel(SUBMIT)) {
-
- private static final long serialVersionUID = -958724007591692537L;
-
- @Override
- protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- try {
- submitAction(target, form);
-
- if (pageRef.getPage() instanceof BasePage) {
- ((BasePage) pageRef.getPage()).setModalResult(true);
- }
-
- closeAction(target, form);
- } catch (Exception e) {
- error(getString(Constants.ERROR) + ": " + e.getMessage());
- feedbackPanel.refresh(target);
- }
- }
-
- @Override
- protected void onError(final AjaxRequestTarget target, final Form<?> form) {
- feedbackPanel.refresh(target);
- }
- };
- form.add(submit);
- form.setDefaultButton(submit);
-
- final AjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) {
-
- private static final long serialVersionUID = -958724007591692537L;
-
- @Override
- protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- closeAction(target, form);
- }
- };
- cancel.setDefaultFormProcessing(false);
- form.add(cancel);
-
- MetaDataRoleAuthorizationStrategy.authorize(submit, ENABLE, xmlRolesReader.getEntitlement("Roles",
- createFlag
- ? "create"
- : "update"));
-
- add(form);
- }
-
- protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
- final RoleTO roleTO = (RoleTO) form.getDefaultModelObject();
- final List<String> entitlementList = new ArrayList<String>(rolePanel.getSelectedEntitlements());
- roleTO.getEntitlements().clear();
- roleTO.getEntitlements().addAll(entitlementList);
-
- RoleTO result;
- if (createFlag) {
- result = roleRestClient.create(roleTO);
- } else {
- RoleMod roleMod = AttributableOperations.diff(roleTO, originalRoleTO);
-
- // update role just if it is changed
- if (roleMod.isEmpty()) {
- result = roleTO;
- } else {
- result = roleRestClient.update(originalRoleTO.getETagValue(), roleMod);
- }
- }
-
- setResponsePage(new ResultStatusModalPage.Builder(window, result).build());
- }
-
- protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
- window.close(target);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleSelectModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleSelectModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleSelectModalPage.java
deleted file mode 100644
index 26b1aea..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleSelectModalPage.java
+++ /dev/null
@@ -1,105 +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.pages;
-
-import java.lang.reflect.Constructor;
-import javax.swing.tree.DefaultMutableTreeNode;
-import org.apache.syncope.client.console.commons.RoleTreeBuilder;
-import org.apache.syncope.client.console.wicket.markup.html.tree.DefaultMutableTreeNodeExpansion;
-import org.apache.syncope.client.console.wicket.markup.html.tree.DefaultMutableTreeNodeExpansionModel;
-import org.apache.syncope.client.console.wicket.markup.html.tree.TreeRoleProvider;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.wicket.Component;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.extensions.markup.html.repeater.tree.DefaultNestedTree;
-import org.apache.wicket.extensions.markup.html.repeater.tree.ITreeProvider;
-import org.apache.wicket.extensions.markup.html.repeater.tree.NestedTree;
-import org.apache.wicket.extensions.markup.html.repeater.tree.content.Folder;
-import org.apache.wicket.extensions.markup.html.repeater.tree.theme.WindowsTheme;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-public class RoleSelectModalPage extends BaseModalPage {
-
- private static final long serialVersionUID = 2106489458494696439L;
-
- @SpringBean
- private RoleTreeBuilder roleTreeBuilder;
-
- private final NestedTree<DefaultMutableTreeNode> tree;
-
- public RoleSelectModalPage(final PageReference pageRef, final ModalWindow window, final Class<?> payloadClass) {
- super();
-
- final ITreeProvider<DefaultMutableTreeNode> treeProvider = new TreeRoleProvider(roleTreeBuilder, true);
- final DefaultMutableTreeNodeExpansionModel treeModel = new DefaultMutableTreeNodeExpansionModel();
-
- tree = new DefaultNestedTree<DefaultMutableTreeNode>("treeTable", treeProvider, treeModel) {
-
- private static final long serialVersionUID = 7137658050662575546L;
-
- @Override
- protected Component newContentComponent(final String id, final IModel<DefaultMutableTreeNode> node) {
- final DefaultMutableTreeNode treeNode = node.getObject();
- final RoleTO roleTO = (RoleTO) treeNode.getUserObject();
-
- return new Folder<DefaultMutableTreeNode>(id, RoleSelectModalPage.this.tree, node) {
-
- private static final long serialVersionUID = 9046323319920426493L;
-
- @Override
- protected boolean isClickable() {
- return true;
- }
-
- @Override
- protected IModel<?> newLabelModel(final IModel<DefaultMutableTreeNode> model) {
- return new Model<>(roleTO.getDisplayName());
- }
-
- @Override
- protected void onClick(final AjaxRequestTarget target) {
- super.onClick(target);
-
- try {
- Constructor<?> constructor = payloadClass.getConstructor(Long.class);
- Object payload = constructor.newInstance(roleTO.getKey());
-
- send(pageRef.getPage(), Broadcast.BREADTH, payload);
- } catch (Exception e) {
- LOG.error("Could not send role select event", e);
- }
-
- window.close(target);
- }
- };
- }
- };
- tree.add(new WindowsTheme());
- tree.setOutputMarkupId(true);
-
- DefaultMutableTreeNodeExpansion.get().expandAll();
-
- this.add(tree);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleTemplateModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleTemplateModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleTemplateModalPage.java
deleted file mode 100644
index 6639517..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/RoleTemplateModalPage.java
+++ /dev/null
@@ -1,50 +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.pages;
-
-import org.apache.syncope.client.console.commons.Mode;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.to.SyncTaskTO;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.form.Form;
-
-public class RoleTemplateModalPage extends RoleModalPage {
-
- private static final long serialVersionUID = -3849135555203409845L;
-
- private final SyncTaskTO syncTaskTO;
-
- public RoleTemplateModalPage(final PageReference callerPageRef, final ModalWindow window,
- final SyncTaskTO syncTaskTO) {
-
- super(callerPageRef, window, syncTaskTO.getRoleTemplate() == null
- ? new RoleTO()
- : syncTaskTO.getRoleTemplate(), Mode.TEMPLATE);
-
- this.syncTaskTO = syncTaskTO;
- }
-
- @Override
- protected void submitAction(final AjaxRequestTarget target, final Form form) {
- syncTaskTO.setRoleTemplate((RoleTO) form.getModelObject());
- taskRestClient.updateSyncTask(syncTaskTO);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/Roles.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Roles.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Roles.java
deleted file mode 100644
index 8310792..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Roles.java
+++ /dev/null
@@ -1,186 +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.pages;
-
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.panels.AbstractSearchResultPanel;
-import org.apache.syncope.client.console.panels.RoleSearchPanel;
-import org.apache.syncope.client.console.panels.RoleSearchResultPanel;
-import org.apache.syncope.client.console.panels.RoleSummaryPanel;
-import org.apache.syncope.client.console.rest.RoleRestClient;
-import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxButton;
-import org.apache.syncope.client.console.wicket.markup.html.tree.TreeRolePanel;
-import org.apache.wicket.Session;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.ResourceModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-/**
- * Roles WebPage.
- */
-public class Roles extends BasePage {
-
- private static final long serialVersionUID = -2147758241610831969L;
-
- private static final int WIN_HEIGHT = 500;
-
- private static final int WIN_WIDTH = 800;
-
- @SpringBean
- private RoleRestClient restClient;
-
- private final ModalWindow editRoleWin;
-
- private final WebMarkupContainer roleTabsContainer;
-
- public Roles(final PageParameters parameters) {
- super(parameters);
-
- roleTabsContainer = new WebMarkupContainer("roleTabsContainer");
- roleTabsContainer.setOutputMarkupId(true);
- add(roleTabsContainer);
-
- editRoleWin = new ModalWindow("editRoleWin");
- editRoleWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- editRoleWin.setInitialHeight(WIN_HEIGHT);
- editRoleWin.setInitialWidth(WIN_WIDTH);
- editRoleWin.setCookieName("edit-role-modal");
- add(editRoleWin);
-
- final TreeRolePanel treePanel = new TreeRolePanel("treePanel");
- treePanel.setOutputMarkupId(true);
- roleTabsContainer.add(treePanel);
-
- final RoleSummaryPanel summaryPanel = new RoleSummaryPanel.Builder("summaryPanel")
- .window(editRoleWin).callerPageRef(Roles.this.getPageReference()).build();
- roleTabsContainer.add(summaryPanel);
-
- editRoleWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
-
- private static final long serialVersionUID = 8804221891699487139L;
-
- @Override
- public void onClose(final AjaxRequestTarget target) {
- final RoleSummaryPanel summaryPanel = (RoleSummaryPanel) roleTabsContainer.get("summaryPanel");
-
- final TreeNodeClickUpdate data = new TreeNodeClickUpdate(target,
- summaryPanel == null || summaryPanel.getSelectedNode() == null
- ? 0
- : summaryPanel.getSelectedNode().getKey());
-
- send(getPage(), Broadcast.BREADTH, data);
-
- if (modalResult) {
- getSession().info(getString(Constants.OPERATION_SUCCEEDED));
- feedbackPanel.refresh(target);
- modalResult = false;
- }
-
- }
- });
-
- final AbstractSearchResultPanel searchResult =
- new RoleSearchResultPanel("searchResult", true, null, getPageReference(), restClient);
- add(searchResult);
-
- final Form searchForm = new Form("searchForm");
- add(searchForm);
-
- final RoleSearchPanel searchPanel = new RoleSearchPanel.Builder("searchPanel").build();
- searchForm.add(searchPanel);
-
- searchForm.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), getPageReference()) {
-
- private static final long serialVersionUID = -958724007591692537L;
-
- @Override
- protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
- final String fiql = searchPanel.buildFIQL();
- LOG.debug("Node condition {}", fiql);
-
- doSearch(target, fiql, searchResult);
-
- Session.get().getFeedbackMessages().clear();
- searchPanel.getSearchFeedback().refresh(target);
- }
-
- @Override
- protected void onError(final AjaxRequestTarget target, final Form<?> form) {
- searchPanel.getSearchFeedback().refresh(target);
- }
- });
- }
-
- private void doSearch(final AjaxRequestTarget target, final String fiql,
- final AbstractSearchResultPanel resultsetPanel) {
-
- if (fiql == null) {
- error(getString(Constants.SEARCH_ERROR));
- return;
- }
-
- resultsetPanel.search(fiql, target);
- }
-
- @Override
- public void onEvent(final IEvent<?> event) {
- super.onEvent(event);
-
- if (event.getPayload() instanceof TreeNodeClickUpdate) {
- final TreeNodeClickUpdate update = (TreeNodeClickUpdate) event.getPayload();
-
- final RoleSummaryPanel summaryPanel = new RoleSummaryPanel.Builder("summaryPanel")
- .window(editRoleWin).callerPageRef(Roles.this.getPageReference())
- .selectedNodeId(update.getSelectedNodeId()).build();
-
- roleTabsContainer.addOrReplace(summaryPanel);
- update.getTarget().add(roleTabsContainer);
- }
- }
-
- public static class TreeNodeClickUpdate {
-
- private final AjaxRequestTarget target;
-
- private Long selectedNodeId;
-
- public TreeNodeClickUpdate(final AjaxRequestTarget target, final Long selectedNodeId) {
- this.target = target;
- this.selectedNodeId = selectedNodeId;
- }
-
- public AjaxRequestTarget getTarget() {
- return target;
- }
-
- public Long getSelectedNodeId() {
- return selectedNodeId;
- }
-
- public void setSelectedNodeId(final Long selectedNodeId) {
- this.selectedNodeId = selectedNodeId;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/Schema.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Schema.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Schema.java
index c47edcd..9bfba54 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Schema.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Schema.java
@@ -104,23 +104,23 @@ public class Schema extends BasePage {
put(new SimpleEntry<>(AttributableType.CONFIGURATION, SchemaType.PLAIN),
Constants.PREF_CONF_SCHEMA_PAGINATOR_ROWS);
put(new SimpleEntry<>(AttributableType.USER, SchemaType.PLAIN),
- Constants.PREF_USER_SCHEMA_PAGINATOR_ROWS);
+ Constants.PREF_USER_PLAIN_SCHEMA_PAGINATOR_ROWS);
put(new SimpleEntry<>(AttributableType.USER, SchemaType.DERIVED),
Constants.PREF_USER_DER_SCHEMA_PAGINATOR_ROWS);
put(new SimpleEntry<>(AttributableType.USER, SchemaType.VIRTUAL),
Constants.PREF_USER_VIR_SCHEMA_PAGINATOR_ROWS);
put(new SimpleEntry<>(AttributableType.MEMBERSHIP, SchemaType.PLAIN),
- Constants.PREF_MEMBERSHIP_SCHEMA_PAGINATOR_ROWS);
+ Constants.PREF_MEMBERSHIP_PLAIN_SCHEMA_PAGINATOR_ROWS);
put(new SimpleEntry<>(AttributableType.MEMBERSHIP, SchemaType.DERIVED),
Constants.PREF_MEMBERSHIP_DER_SCHEMA_PAGINATOR_ROWS);
put(new SimpleEntry<>(AttributableType.MEMBERSHIP, SchemaType.VIRTUAL),
Constants.PREF_MEMBERSHIP_VIR_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.ROLE, SchemaType.PLAIN),
- Constants.PREF_ROLE_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.ROLE, SchemaType.DERIVED),
- Constants.PREF_ROLE_DER_SCHEMA_PAGINATOR_ROWS);
- put(new SimpleEntry<>(AttributableType.ROLE, SchemaType.VIRTUAL),
- Constants.PREF_ROLE_VIR_SCHEMA_PAGINATOR_ROWS);
+ put(new SimpleEntry<>(AttributableType.GROUP, SchemaType.PLAIN),
+ Constants.PREF_GROUP_PLAIN_SCHEMA_PAGINATOR_ROWS);
+ put(new SimpleEntry<>(AttributableType.GROUP, SchemaType.DERIVED),
+ Constants.PREF_GROUP_DER_SCHEMA_PAGINATOR_ROWS);
+ put(new SimpleEntry<>(AttributableType.GROUP, SchemaType.VIRTUAL),
+ Constants.PREF_GROUP_VIR_SCHEMA_PAGINATOR_ROWS);
}
};
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/StatusModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/StatusModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/StatusModalPage.java
index 9d0ede2..cab0e04 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/StatusModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/StatusModalPage.java
@@ -36,7 +36,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPan
import org.apache.syncope.common.lib.to.AbstractSubjectTO;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
import org.apache.wicket.PageReference;
@@ -117,10 +117,10 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
this.statusOnly = statusOnly;
this.subjectTO = subjectTO;
- statusUtils = new StatusUtils(subjectTO instanceof UserTO ? userRestClient : roleRestClient);
+ statusUtils = new StatusUtils(subjectTO instanceof UserTO ? userRestClient : groupRestClient);
add(new Label("displayName", subjectTO.getKey() + " "
- + (subjectTO instanceof UserTO ? ((UserTO) subjectTO).getUsername() : ((RoleTO) subjectTO).getName())));
+ + (subjectTO instanceof UserTO ? ((UserTO) subjectTO).getUsername() : ((GroupTO) subjectTO).getName())));
columns = new ArrayList<>();
columns.add(new AbstractColumn<StatusBean, String>(
@@ -194,7 +194,7 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
};
table.setOutputMarkupId(true);
- final String pageId = subjectTO instanceof RoleTO ? "Roles" : "Users";
+ final String pageId = subjectTO instanceof GroupTO ? "Groups" : "Users";
final Fragment pwdMgtFragment = new Fragment("pwdMgtFields", "pwdMgtFragment", this);
addOrReplace(pwdMgtFragment);
@@ -316,7 +316,7 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
subjectTO.getKey(),
new ArrayList<>(table.getModelObject()));
} else {
- roleRestClient.unlink(
+ groupRestClient.unlink(
subjectTO.getETagValue(),
subjectTO.getKey(),
new ArrayList<>(table.getModelObject()));
@@ -345,7 +345,7 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
subjectTO.getKey(),
new ArrayList<>(table.getModelObject()));
} else {
- roleRestClient.link(
+ groupRestClient.link(
subjectTO.getETagValue(),
subjectTO.getKey(),
new ArrayList<>(table.getModelObject()));
@@ -375,7 +375,7 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
subjectTO.getKey(),
new ArrayList<>(table.getModelObject()));
} else {
- bulkActionResult = roleRestClient.deprovision(
+ bulkActionResult = groupRestClient.deprovision(
subjectTO.getETagValue(),
subjectTO.getKey(),
new ArrayList<>(table.getModelObject()));
@@ -403,7 +403,7 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
target, ResourceAssociationActionType.PROVISION, table.getModelObject());
} else {
try {
- final BulkActionResult bulkActionResult = roleRestClient.provision(
+ final BulkActionResult bulkActionResult = groupRestClient.provision(
subjectTO.getETagValue(),
subjectTO.getKey(),
new ArrayList<>(table.getModelObject()));
@@ -433,7 +433,7 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
subjectTO.getKey(),
new ArrayList<>(table.getModelObject()));
} else {
- bulkActionResult = roleRestClient.unassign(
+ bulkActionResult = groupRestClient.unassign(
subjectTO.getETagValue(),
subjectTO.getKey(),
new ArrayList<>(table.getModelObject()));
@@ -460,7 +460,7 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
target, ResourceAssociationActionType.ASSIGN, table.getModelObject());
} else {
try {
- final BulkActionResult bulkActionResult = roleRestClient.assign(
+ final BulkActionResult bulkActionResult = groupRestClient.assign(
subjectTO.getETagValue(),
subjectTO.getKey(),
new ArrayList<>(table.getModelObject()));
@@ -502,11 +502,10 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
final List<StatusBean> statusBeans = new ArrayList<StatusBean>(connObjects.size() + 1);
for (ConnObjectWrapper entry : connObjects) {
- final StatusBean statusBean = statusUtils.getStatusBean(
- subjectTO,
+ final StatusBean statusBean = statusUtils.getStatusBean(subjectTO,
entry.getResourceName(),
entry.getConnObjectTO(),
- subjectTO instanceof RoleTO);
+ subjectTO instanceof GroupTO);
statusBeans.add(statusBean);
resources.remove(entry.getResourceName());
@@ -530,11 +529,10 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
statusBeans.add(syncope);
} else {
for (String resource : resources) {
- final StatusBean statusBean = statusUtils.getStatusBean(
- subjectTO,
+ final StatusBean statusBean = statusUtils.getStatusBean(subjectTO,
resource,
null,
- subjectTO instanceof RoleTO);
+ subjectTO instanceof GroupTO);
statusBean.setLinked(false);
statusBeans.add(statusBean);
@@ -625,11 +623,10 @@ public class StatusModalPage<T extends AbstractSubjectTO> extends AbstractStatus
final List<StatusBean> statusBeans = new ArrayList<StatusBean>(connObjects.size());
for (ConnObjectWrapper entry : connObjects) {
- final StatusBean statusBean = statusUtils.getStatusBean(
- subjectTO,
+ final StatusBean statusBean = statusUtils.getStatusBean(subjectTO,
entry.getResourceName(),
entry.getConnObjectTO(),
- subjectTO instanceof RoleTO);
+ subjectTO instanceof GroupTO);
statusBeans.add(statusBean);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
index 0215538..0835ca2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
@@ -156,7 +156,7 @@ public abstract class UserModalPage extends BaseModalPage {
//--------------------------------
//--------------------------------
- // Roles panel
+ // Groups panel
//--------------------------------
form.add(new MembershipsPanel("memberships", userTO, mode, null, getPageReference()));
//--------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchPanel.java
index d610739..ba4411e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchPanel.java
@@ -31,10 +31,10 @@ import org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser;
import org.apache.syncope.client.console.rest.AuthRestClient;
import org.apache.syncope.client.console.rest.ResourceRestClient;
import org.apache.syncope.client.console.rest.SchemaRestClient;
-import org.apache.syncope.common.lib.search.RoleFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.search.SearchableFields;
import org.apache.syncope.common.lib.search.SpecialAttr;
-import org.apache.syncope.common.lib.search.SyncopeFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.search.SyncopeProperty;
import org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.to.ResourceTO;
@@ -78,7 +78,7 @@ public abstract class AbstractSearchPanel extends Panel {
protected IModel<List<SearchClause.Type>> types;
- protected IModel<List<String>> roleNames;
+ protected IModel<List<String>> groupNames;
protected NotificationPanel searchFeedback;
@@ -136,7 +136,7 @@ public abstract class AbstractSearchPanel extends Panel {
if (StringUtils.isNotBlank(fiql)) {
try {
FiqlParser<SearchBean> fiqlParser = new FiqlParser<>(
- SearchBean.class, SyncopeFiqlSearchConditionBuilder.CONTEXTUAL_PROPERTIES);
+ SearchBean.class, AbstractFiqlSearchConditionBuilder.CONTEXTUAL_PROPERTIES);
List<SearchClause> parsed = getSearchClauses(fiqlParser.parse(fiql));
this.searchClauses.clear();
@@ -147,7 +147,7 @@ public abstract class AbstractSearchPanel extends Panel {
}
searchFormContainer.add(new SearchView("searchView", searchClauses, searchFormContainer, required,
- types, anames, dnames, roleNames, resourceNames, entitlements));
+ types, anames, dnames, groupNames, resourceNames, entitlements));
add(searchFormContainer);
}
@@ -159,7 +159,7 @@ public abstract class AbstractSearchPanel extends Panel {
@Override
protected List<String> load() {
return SearchableFields.get(
- attributableType == AttributableType.USER ? SubjectType.USER : SubjectType.ROLE);
+ attributableType == AttributableType.USER ? SubjectType.USER : SubjectType.GROUP);
}
};
@@ -216,9 +216,9 @@ public abstract class AbstractSearchPanel extends Panel {
String value = sc.getCondition().get(property);
searchClause.setValue(value);
- if (SpecialAttr.ROLES.toString().equals(property)) {
+ if (SpecialAttr.GROUPS.toString().equals(property)) {
searchClause.setType(SearchClause.Type.MEMBERSHIP);
- for (String label : roleNames.getObject()) {
+ for (String label : groupNames.getObject()) {
if (value.equals(label.substring(0, label.indexOf(' ')))) {
searchClause.setProperty(label);
}
@@ -298,7 +298,7 @@ public abstract class AbstractSearchPanel extends Panel {
return clauses;
}
- protected abstract SyncopeFiqlSearchConditionBuilder getSearchConditionBuilder();
+ protected abstract AbstractFiqlSearchConditionBuilder getSearchConditionBuilder();
public String buildFIQL() {
LOG.debug("Generating FIQL from List<SearchClause>: {}", searchClauses);
@@ -307,7 +307,7 @@ public abstract class AbstractSearchPanel extends Panel {
return StringUtils.EMPTY;
}
- SyncopeFiqlSearchConditionBuilder builder = getSearchConditionBuilder();
+ AbstractFiqlSearchConditionBuilder builder = getSearchConditionBuilder();
CompleteCondition prevCondition;
CompleteCondition condition = null;
@@ -317,17 +317,17 @@ public abstract class AbstractSearchPanel extends Panel {
switch (searchClauses.get(i).getType()) {
case ENTITLEMENT:
condition = searchClauses.get(i).getComparator() == SearchClause.Comparator.EQUALS
- ? ((RoleFiqlSearchConditionBuilder) builder).
+ ? ((GroupFiqlSearchConditionBuilder) builder).
hasEntitlements(searchClauses.get(i).getProperty())
- : ((RoleFiqlSearchConditionBuilder) builder).
+ : ((GroupFiqlSearchConditionBuilder) builder).
hasNotEntitlements(searchClauses.get(i).getProperty());
break;
case MEMBERSHIP:
- Long roleId = NumberUtils.toLong(searchClauses.get(i).getProperty().split(" ")[0]);
+ Long groupId = NumberUtils.toLong(searchClauses.get(i).getProperty().split(" ")[0]);
condition = searchClauses.get(i).getComparator() == SearchClause.Comparator.EQUALS
- ? ((UserFiqlSearchConditionBuilder) builder).hasRoles(roleId)
- : ((UserFiqlSearchConditionBuilder) builder).hasNotRoles(roleId);
+ ? ((UserFiqlSearchConditionBuilder) builder).inGroups(groupId)
+ : ((UserFiqlSearchConditionBuilder) builder).notInGroups(groupId);
break;
case RESOURCE:
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/AttrTemplatesPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AttrTemplatesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AttrTemplatesPanel.java
index 1601ca7..98ada28 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AttrTemplatesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AttrTemplatesPanel.java
@@ -25,7 +25,7 @@ import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.SelectChoiceRenderer;
import org.apache.syncope.client.console.rest.SchemaRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.NonI18nPalette;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -41,9 +41,9 @@ public class AttrTemplatesPanel extends Panel {
public enum Type {
- rPlainAttrTemplates,
- rDerAttrTemplates,
- rVirAttrTemplates,
+ gPlainAttrTemplates,
+ gDerAttrTemplates,
+ gVirAttrTemplates,
mPlainAttrTemplates,
mDerAttrTemplates,
mVirAttrTemplates;
@@ -55,7 +55,7 @@ public class AttrTemplatesPanel extends Panel {
@SpringBean
private SchemaRestClient schemaRestClient;
- private final RoleTO roleTO;
+ private final GroupTO groupTO;
private final NonI18nPalette<String> rPlainAttrTemplates;
@@ -63,18 +63,18 @@ public class AttrTemplatesPanel extends Panel {
private final NonI18nPalette<String> rVirAttrTemplates;
- public AttrTemplatesPanel(final String id, final RoleTO roleTO) {
+ public AttrTemplatesPanel(final String id, final GroupTO groupTO) {
super(id);
- this.roleTO = roleTO;
+ this.groupTO = groupTO;
- rPlainAttrTemplates = buildPalette(Type.rPlainAttrTemplates,
- schemaRestClient.getSchemaNames(AttributableType.ROLE, SchemaType.PLAIN));
+ rPlainAttrTemplates = buildPalette(Type.gPlainAttrTemplates,
+ schemaRestClient.getSchemaNames(AttributableType.GROUP, SchemaType.PLAIN));
this.add(rPlainAttrTemplates);
- rDerAttrTemplates = buildPalette(Type.rDerAttrTemplates,
- schemaRestClient.getSchemaNames(AttributableType.ROLE, SchemaType.DERIVED));
+ rDerAttrTemplates = buildPalette(Type.gDerAttrTemplates,
+ schemaRestClient.getSchemaNames(AttributableType.GROUP, SchemaType.DERIVED));
this.add(rDerAttrTemplates);
- rVirAttrTemplates = buildPalette(Type.rVirAttrTemplates,
- schemaRestClient.getSchemaNames(AttributableType.ROLE, SchemaType.VIRTUAL));
+ rVirAttrTemplates = buildPalette(Type.gVirAttrTemplates,
+ schemaRestClient.getSchemaNames(AttributableType.GROUP, SchemaType.VIRTUAL));
this.add(rVirAttrTemplates);
this.add(buildPalette(Type.mPlainAttrTemplates,
@@ -91,7 +91,7 @@ public class AttrTemplatesPanel extends Panel {
}
ListModel<String> availableSchemas = new ListModel<>(allSchemas);
- return new NonI18nPalette<String>(type.name(), new PropertyModel<List<String>>(roleTO, type.name()),
+ return new NonI18nPalette<String>(type.name(), new PropertyModel<List<String>>(groupTO, type.name()),
availableSchemas, new SelectChoiceRenderer<String>(), 8, false, true) {
private static final long serialVersionUID = 2295567122085510330L;
@@ -101,16 +101,16 @@ public class AttrTemplatesPanel extends Panel {
final Recorder<String> recorder = super.newRecorderComponent();
switch (type) {
- case rPlainAttrTemplates:
- case rDerAttrTemplates:
- case rVirAttrTemplates:
+ case gPlainAttrTemplates:
+ case gDerAttrTemplates:
+ case gVirAttrTemplates:
recorder.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(type, target));
+ send(getPage(), Broadcast.BREADTH, new GroupAttrTemplatesChange(type, target));
}
});
break;
@@ -126,15 +126,15 @@ public class AttrTemplatesPanel extends Panel {
public Collection<String> getSelected(final Type type) {
Collection<String> selected;
switch (type) {
- case rPlainAttrTemplates:
+ case gPlainAttrTemplates:
selected = this.rPlainAttrTemplates.getModelCollection();
break;
- case rDerAttrTemplates:
+ case gDerAttrTemplates:
selected = this.rDerAttrTemplates.getModelCollection();
break;
- case rVirAttrTemplates:
+ case gVirAttrTemplates:
selected = this.rVirAttrTemplates.getModelCollection();
break;
@@ -145,13 +145,13 @@ public class AttrTemplatesPanel extends Panel {
return selected;
}
- public static class RoleAttrTemplatesChange {
+ public static class GroupAttrTemplatesChange {
private final Type type;
private final AjaxRequestTarget target;
- public RoleAttrTemplatesChange(final Type type, final AjaxRequestTarget target) {
+ public GroupAttrTemplatesChange(final Type type, final AjaxRequestTarget target) {
this.type = type;
this.target = target;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/DerAttrsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerAttrsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerAttrsPanel.java
index d68038f..c8872b5 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerAttrsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerAttrsPanel.java
@@ -21,14 +21,14 @@ package org.apache.syncope.client.console.panels;
import java.util.ArrayList;
import java.util.List;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.panels.AttrTemplatesPanel.RoleAttrTemplatesChange;
-import org.apache.syncope.client.console.rest.RoleRestClient;
+import org.apache.syncope.client.console.panels.AttrTemplatesPanel.GroupAttrTemplatesChange;
+import org.apache.syncope.client.console.rest.GroupRestClient;
import org.apache.syncope.client.console.rest.SchemaRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDecoratedCheckbox;
import org.apache.syncope.common.lib.to.AbstractAttributableTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.wicket.Component;
@@ -62,7 +62,7 @@ public class DerAttrsPanel extends Panel {
private SchemaRestClient schemaRestClient;
@SpringBean
- private RoleRestClient roleRestClient;
+ private GroupRestClient groupRestClient;
private final AttrTemplatesPanel attrTemplates;
@@ -85,22 +85,22 @@ public class DerAttrsPanel extends Panel {
protected List<String> load() {
List<String> derSchemaNames;
- if (entityTO instanceof RoleTO) {
- final RoleTO roleTO = (RoleTO) entityTO;
+ if (entityTO instanceof GroupTO) {
+ final GroupTO groupTO = (GroupTO) entityTO;
if (attrTemplates == null) {
- derSchemaNames = roleTO.getRDerAttrTemplates();
+ derSchemaNames = groupTO.getGDerAttrTemplates();
} else {
derSchemaNames = new ArrayList<>(
- attrTemplates.getSelected(AttrTemplatesPanel.Type.rDerAttrTemplates));
- if (roleTO.isInheritTemplates() && roleTO.getParent() != 0) {
- derSchemaNames.addAll(roleRestClient.read(roleTO.getParent()).getRDerAttrTemplates());
+ attrTemplates.getSelected(AttrTemplatesPanel.Type.gDerAttrTemplates));
+ if (groupTO.isInheritTemplates() && groupTO.getParent() != 0) {
+ derSchemaNames.addAll(groupRestClient.read(groupTO.getParent()).getGDerAttrTemplates());
}
}
} else if (entityTO instanceof UserTO) {
derSchemaNames = schemaRestClient.getDerSchemaNames(AttributableType.USER);
} else {
- derSchemaNames = roleRestClient.read(((MembershipTO) entityTO).getRoleId()).getMDerAttrTemplates();
+ derSchemaNames = groupRestClient.read(((MembershipTO) entityTO).getGroupId()).getMDerAttrTemplates();
}
return derSchemaNames;
@@ -196,9 +196,9 @@ public class DerAttrsPanel extends Panel {
@Override
public void onEvent(final IEvent<?> event) {
- if ((event.getPayload() instanceof RoleAttrTemplatesChange)) {
- final RoleAttrTemplatesChange update = (RoleAttrTemplatesChange) event.getPayload();
- if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.rDerAttrTemplates) {
+ if ((event.getPayload() instanceof GroupAttrTemplatesChange)) {
+ final GroupAttrTemplatesChange update = (GroupAttrTemplatesChange) event.getPayload();
+ if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.gDerAttrTemplates) {
update.getTarget().add(this);
}
}
[02/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java
deleted file mode 100644
index 5363e4b..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RoleITCase.java
+++ /dev/null
@@ -1,889 +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.fit.core.reference;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.AccessControlException;
-import java.util.List;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.ws.rs.core.Response;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.mod.ReferenceMod;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.BulkActionResult;
-import org.apache.syncope.common.lib.to.ConnObjectTO;
-import org.apache.syncope.common.lib.to.MappingItemTO;
-import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
-import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.common.lib.wrap.ResourceName;
-import org.apache.syncope.common.rest.api.CollectionWrapper;
-import org.apache.syncope.common.rest.api.Preference;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.common.rest.api.service.RoleService;
-import org.identityconnectors.framework.common.objects.Name;
-import org.junit.FixMethodOrder;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.JVM)
-public class RoleITCase extends AbstractITCase {
-
- private RoleTO buildBasicRoleTO(final String name) {
- RoleTO roleTO = new RoleTO();
- roleTO.setName(name + getUUIDString());
- roleTO.setParent(8L);
- return roleTO;
- }
-
- private RoleTO buildRoleTO(final String name) {
- RoleTO roleTO = buildBasicRoleTO(name);
-
- // verify inheritance password and account policies
- roleTO.setInheritAccountPolicy(false);
- // not inherited so setter execution shouldn't be ignored
- roleTO.setAccountPolicy(6L);
-
- roleTO.setInheritPasswordPolicy(true);
- // inherited so setter execution should be ignored
- roleTO.setPasswordPolicy(2L);
-
- roleTO.getRPlainAttrTemplates().add("icon");
- roleTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
-
- roleTO.getResources().add(RESOURCE_NAME_LDAP);
- return roleTO;
- }
-
- @Test
- public void createWithException() {
- RoleTO newRoleTO = new RoleTO();
- newRoleTO.getPlainAttrs().add(attrTO("attr1", "value1"));
-
- try {
- createRole(newRoleTO);
- fail();
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.InvalidRole, e.getType());
- }
- }
-
- @Test
- @Ignore
- public void create() {
- RoleTO roleTO = buildRoleTO("lastRole");
- roleTO.getRVirAttrTemplates().add("rvirtualdata");
- roleTO.getVirAttrs().add(attrTO("rvirtualdata", "rvirtualvalue"));
- roleTO.setRoleOwner(8L);
-
- roleTO = createRole(roleTO);
- assertNotNull(roleTO);
-
- assertNotNull(roleTO.getVirAttrMap());
- assertNotNull(roleTO.getVirAttrMap().get("rvirtualdata").getValues());
- assertFalse(roleTO.getVirAttrMap().get("rvirtualdata").getValues().isEmpty());
- assertEquals("rvirtualvalue", roleTO.getVirAttrMap().get("rvirtualdata").getValues().get(0));
-
- assertNotNull(roleTO.getAccountPolicy());
- assertEquals(6L, (long) roleTO.getAccountPolicy());
-
- assertNotNull(roleTO.getPasswordPolicy());
- assertEquals(4L, (long) roleTO.getPasswordPolicy());
-
- assertTrue(roleTO.getResources().contains(RESOURCE_NAME_LDAP));
-
- ConnObjectTO connObjectTO =
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, roleTO.getKey());
- assertNotNull(connObjectTO);
- assertNotNull(connObjectTO.getPlainAttrMap().get("owner"));
-
- // SYNCOPE-515: remove ownership
- final RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleTO.getKey());
- roleMod.setRoleOwner(new ReferenceMod());
-
- assertNull(updateRole(roleMod).getRoleOwner());
- }
-
- @Test
- public void createWithPasswordPolicy() {
- RoleTO roleTO = new RoleTO();
- roleTO.setName("roleWithPassword" + getUUIDString());
- roleTO.setParent(8L);
- roleTO.setPasswordPolicy(4L);
-
- RoleTO actual = createRole(roleTO);
- assertNotNull(actual);
-
- actual = roleService.read(actual.getKey());
- assertNotNull(actual);
- assertNotNull(actual.getPasswordPolicy());
- assertEquals(4L, (long) actual.getPasswordPolicy());
- }
-
- @Test
- public void delete() {
- try {
- roleService.delete(0L);
- } catch (SyncopeClientException e) {
- assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
- }
-
- RoleTO roleTO = new RoleTO();
- roleTO.setName("toBeDeleted" + getUUIDString());
- roleTO.setParent(8L);
-
- roleTO.getResources().add(RESOURCE_NAME_LDAP);
-
- roleTO = createRole(roleTO);
- assertNotNull(roleTO);
-
- RoleTO deletedRole = deleteRole(roleTO.getKey());
- assertNotNull(deletedRole);
-
- try {
- roleService.read(deletedRole.getKey());
- } catch (SyncopeClientException e) {
- assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
- }
- }
-
- @Test
- public void list() {
- PagedResult<RoleTO> roleTOs = roleService.list();
- assertNotNull(roleTOs);
- assertTrue(roleTOs.getResult().size() >= 8);
- for (RoleTO roleTO : roleTOs.getResult()) {
- assertNotNull(roleTO);
- }
- }
-
- @Test
- public void parent() {
- RoleTO roleTO = roleService.parent(7L);
-
- assertNotNull(roleTO);
- assertEquals(roleTO.getKey(), 6L);
- }
-
- @Test
- public void read() {
- RoleTO roleTO = roleService.read(1L);
-
- assertNotNull(roleTO);
- assertNotNull(roleTO.getPlainAttrs());
- assertFalse(roleTO.getPlainAttrs().isEmpty());
- }
-
- @Test
- public void selfRead() {
- UserTO userTO = userService.read(1L);
- assertNotNull(userTO);
-
- assertTrue(userTO.getMembershipMap().containsKey(1L));
- assertFalse(userTO.getMembershipMap().containsKey(3L));
-
- RoleService roleService2 = clientFactory.create("rossini", ADMIN_PWD).getService(RoleService.class);
-
- try {
- roleService2.readSelf(3L);
- fail();
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.UnauthorizedRole, e.getType());
- }
-
- RoleTO roleTO = roleService2.readSelf(1L);
- assertNotNull(roleTO);
- assertNotNull(roleTO.getPlainAttrs());
- assertFalse(roleTO.getPlainAttrs().isEmpty());
- }
-
- @Test
- public void update() {
- RoleTO roleTO = buildRoleTO("latestRole" + getUUIDString());
- roleTO.getRPlainAttrTemplates().add("show");
- roleTO = createRole(roleTO);
-
- assertEquals(1, roleTO.getPlainAttrs().size());
-
- assertNotNull(roleTO.getAccountPolicy());
- assertEquals(6L, (long) roleTO.getAccountPolicy());
-
- assertNotNull(roleTO.getPasswordPolicy());
- assertEquals(4L, (long) roleTO.getPasswordPolicy());
-
- RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleTO.getKey());
- String modName = "finalRole" + getUUIDString();
- roleMod.setName(modName);
- roleMod.getPlainAttrsToUpdate().add(attrMod("show", "FALSE"));
-
- // change password policy inheritance
- roleMod.setInheritPasswordPolicy(Boolean.FALSE);
-
- roleTO = updateRole(roleMod);
-
- assertEquals(modName, roleTO.getName());
- assertEquals(2, roleTO.getPlainAttrs().size());
-
- // changes ignored because not requested (null ReferenceMod)
- assertNotNull(roleTO.getAccountPolicy());
- assertEquals(6L, (long) roleTO.getAccountPolicy());
-
- // password policy null because not inherited
- assertNull(roleTO.getPasswordPolicy());
- }
-
- @Test
- public void updateRemovingVirAttribute() {
- RoleTO roleTO = buildBasicRoleTO("withvirtual" + getUUIDString());
- roleTO.getRVirAttrTemplates().add("rvirtualdata");
- roleTO.getVirAttrs().add(attrTO("rvirtualdata", null));
-
- roleTO = createRole(roleTO);
-
- assertNotNull(roleTO);
- assertEquals(1, roleTO.getVirAttrs().size());
-
- final RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleTO.getKey());
- roleMod.getVirAttrsToRemove().add("rvirtualdata");
-
- roleTO = updateRole(roleMod);
- assertNotNull(roleTO);
- assertTrue(roleTO.getVirAttrs().isEmpty());
- }
-
- @Test
- public void updateRemovingDerAttribute() {
- RoleTO roleTO = buildBasicRoleTO("withderived" + getUUIDString());
- roleTO.getRDerAttrTemplates().add("rderivedschema");
- roleTO.getDerAttrs().add(attrTO("rderivedschema", null));
-
- roleTO = createRole(roleTO);
-
- assertNotNull(roleTO);
- assertEquals(1, roleTO.getDerAttrs().size());
-
- final RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleTO.getKey());
- roleMod.getDerAttrsToRemove().add("rderivedschema");
-
- roleTO = updateRole(roleMod);
- assertNotNull(roleTO);
- assertTrue(roleTO.getDerAttrs().isEmpty());
- }
-
- @Test
- public void updateAsRoleOwner() {
- // 1. read role as admin
- RoleTO roleTO = roleService.read(7L);
-
- // issue SYNCOPE-15
- assertNotNull(roleTO.getCreationDate());
- assertNotNull(roleTO.getLastChangeDate());
- assertEquals("admin", roleTO.getCreator());
- assertEquals("admin", roleTO.getLastModifier());
-
- // 2. prepare update
- RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleTO.getKey());
- roleMod.setName("Managing Director");
-
- // 3. try to update as verdi, not owner of role 7 - fail
- RoleService roleService2 = clientFactory.create("verdi", ADMIN_PWD).getService(RoleService.class);
-
- try {
- roleService2.update(roleMod.getKey(), roleMod);
- fail();
- } catch (SyncopeClientException e) {
- assertEquals(Response.Status.UNAUTHORIZED, e.getType().getResponseStatus());
- } catch (AccessControlException e) {
- assertNotNull(e);
- }
-
- // 4. update as puccini, owner of role 7 because owner of role 6 with inheritance - success
- RoleService roleService3 = clientFactory.create("puccini", ADMIN_PWD).getService(RoleService.class);
-
- roleTO = roleService3.update(roleMod.getKey(), roleMod).readEntity(RoleTO.class);
- assertEquals("Managing Director", roleTO.getName());
-
- // issue SYNCOPE-15
- assertNotNull(roleTO.getCreationDate());
- assertNotNull(roleTO.getLastChangeDate());
- assertEquals("admin", roleTO.getCreator());
- assertEquals("puccini", roleTO.getLastModifier());
- assertTrue(roleTO.getCreationDate().before(roleTO.getLastChangeDate()));
- }
-
- /**
- * Role rename used to fail in case of parent null.
- *
- * http://code.google.com/p/syncope/issues/detail?id=178
- */
- @Test
- public void issue178() {
- RoleTO roleTO = new RoleTO();
- String roleName = "torename" + getUUIDString();
- roleTO.setName(roleName);
-
- RoleTO actual = createRole(roleTO);
-
- assertNotNull(actual);
- assertEquals(roleName, actual.getName());
- assertEquals(0L, actual.getParent());
-
- RoleMod roleMod = new RoleMod();
- roleMod.setKey(actual.getKey());
- String renamedRole = "renamed" + getUUIDString();
- roleMod.setName(renamedRole);
-
- actual = updateRole(roleMod);
- assertNotNull(actual);
- assertEquals(renamedRole, actual.getName());
- assertEquals(0L, actual.getParent());
- }
-
- @Test
- public void issueSYNCOPE228() {
- RoleTO roleTO = buildRoleTO("issueSYNCOPE228");
- roleTO.getEntitlements().add("USER_READ");
- roleTO.getEntitlements().add("SCHEMA_READ");
-
- roleTO = createRole(roleTO);
- assertNotNull(roleTO);
- assertNotNull(roleTO.getEntitlements());
- assertFalse(roleTO.getEntitlements().isEmpty());
-
- List<String> entitlements = roleTO.getEntitlements();
-
- RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleTO.getKey());
- roleMod.setInheritDerAttrs(Boolean.TRUE);
-
- roleTO = updateRole(roleMod);
- assertNotNull(roleTO);
- assertEquals(entitlements, roleTO.getEntitlements());
-
- roleMod = new RoleMod();
- roleMod.setKey(roleTO.getKey());
- roleMod.setModEntitlements(true);
- roleMod.getEntitlements().clear();
-
- roleTO = updateRole(roleMod);
- assertNotNull(roleTO);
- assertTrue(roleTO.getEntitlements().isEmpty());
- }
-
- @Test
- public void unlink() {
- RoleTO actual = createRole(buildRoleTO("unlink"));
- assertNotNull(actual);
-
- assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-
- assertNotNull(roleService.bulkDeassociation(actual.getKey(),
- ResourceDeassociationActionType.UNLINK,
- CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
- readEntity(BulkActionResult.class));
-
- actual = roleService.read(actual.getKey());
- assertNotNull(actual);
- assertTrue(actual.getResources().isEmpty());
-
- assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
- }
-
- @Test
- public void link() {
- RoleTO roleTO = buildRoleTO("link");
- roleTO.getResources().clear();
-
- RoleTO actual = createRole(roleTO);
- assertNotNull(actual);
-
- try {
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
- fail();
- } catch (Exception e) {
- assertNotNull(e);
- }
-
- assertNotNull(roleService.bulkAssociation(actual.getKey(),
- ResourceAssociationActionType.LINK,
- CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
- readEntity(BulkActionResult.class));
-
- actual = roleService.read(actual.getKey());
- assertFalse(actual.getResources().isEmpty());
-
- try {
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
- fail();
- } catch (Exception e) {
- assertNotNull(e);
- }
- }
-
- @Test
- public void unassign() {
- RoleTO actual = createRole(buildRoleTO("unassign"));
- assertNotNull(actual);
-
- assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-
- assertNotNull(roleService.bulkDeassociation(actual.getKey(),
- ResourceDeassociationActionType.UNASSIGN,
- CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
- readEntity(BulkActionResult.class));
-
- actual = roleService.read(actual.getKey());
- assertNotNull(actual);
- assertTrue(actual.getResources().isEmpty());
-
- try {
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
- fail();
- } catch (Exception e) {
- assertNotNull(e);
- }
- }
-
- @Test
- public void assign() {
- RoleTO roleTO = buildRoleTO("assign");
- roleTO.getResources().clear();
-
- RoleTO actual = createRole(roleTO);
- assertNotNull(actual);
-
- try {
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
- fail();
- } catch (Exception e) {
- assertNotNull(e);
- }
-
- assertNotNull(roleService.bulkAssociation(actual.getKey(),
- ResourceAssociationActionType.ASSIGN,
- CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
- readEntity(BulkActionResult.class));
-
- actual = roleService.read(actual.getKey());
- assertFalse(actual.getResources().isEmpty());
- assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
- }
-
- @Test
- public void deprovision() {
- RoleTO actual = createRole(buildRoleTO("deprovision"));
- assertNotNull(actual);
-
- assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-
- assertNotNull(roleService.bulkDeassociation(actual.getKey(),
- ResourceDeassociationActionType.DEPROVISION,
- CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
- readEntity(BulkActionResult.class));
-
- actual = roleService.read(actual.getKey());
- assertNotNull(actual);
- assertFalse(actual.getResources().isEmpty());
-
- try {
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
- fail();
- } catch (Exception e) {
- assertNotNull(e);
- }
- }
-
- @Test
- public void provision() {
- RoleTO roleTO = buildRoleTO("assign");
- roleTO.getResources().clear();
-
- RoleTO actual = createRole(roleTO);
- assertNotNull(actual);
-
- try {
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
- fail();
- } catch (Exception e) {
- assertNotNull(e);
- }
-
- assertNotNull(roleService.bulkAssociation(actual.getKey(),
- ResourceAssociationActionType.PROVISION,
- CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
- readEntity(BulkActionResult.class));
-
- actual = roleService.read(actual.getKey());
- assertTrue(actual.getResources().isEmpty());
-
- assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
- }
-
- @Test
- public void deprovisionUnlinked() {
- RoleTO roleTO = buildRoleTO("assign");
- roleTO.getResources().clear();
-
- RoleTO actual = createRole(roleTO);
- assertNotNull(actual);
-
- try {
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
- fail();
- } catch (Exception e) {
- assertNotNull(e);
- }
-
- assertNotNull(roleService.bulkAssociation(actual.getKey(),
- ResourceAssociationActionType.PROVISION,
- CollectionWrapper.wrap("resource-ldap", ResourceName.class)).
- readEntity(BulkActionResult.class));
-
- actual = roleService.read(actual.getKey());
- assertTrue(actual.getResources().isEmpty());
-
- assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey()));
-
- assertNotNull(roleService.bulkDeassociation(actual.getKey(),
- ResourceDeassociationActionType.DEPROVISION,
- CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
- readEntity(BulkActionResult.class));
-
- actual = roleService.read(actual.getKey());
- assertNotNull(actual);
- assertTrue(actual.getResources().isEmpty());
-
- try {
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, actual.getKey());
- fail();
- } catch (Exception e) {
- assertNotNull(e);
- }
- }
-
- @Test
- public void createWithMandatorySchemaNotTemplate() {
- // 1. create a role mandatory schema
- PlainSchemaTO badge = new PlainSchemaTO();
- badge.setKey("badge");
- badge.setMandatoryCondition("true");
- schemaService.create(AttributableType.ROLE, SchemaType.PLAIN, badge);
-
- // 2. create a role *without* an attribute for that schema: it works
- RoleTO roleTO = buildRoleTO("lastRole");
- assertFalse(roleTO.getPlainAttrMap().containsKey(badge.getKey()));
- roleTO = createRole(roleTO);
- assertNotNull(roleTO);
- assertFalse(roleTO.getPlainAttrMap().containsKey(badge.getKey()));
-
- // 3. add a template for badge to the role just created -
- // failure since no values are provided and it is mandatory
- RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleTO.getKey());
- roleMod.setModRAttrTemplates(true);
- roleMod.getRPlainAttrTemplates().add("badge");
-
- try {
- updateRole(roleMod);
- fail();
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
- }
-
- // 4. also add an actual attribute for badge - it will work
- roleMod.getPlainAttrsToUpdate().add(attrMod(badge.getKey(), "xxxxxxxxxx"));
-
- roleTO = updateRole(roleMod);
- assertNotNull(roleTO);
- assertTrue(roleTO.getPlainAttrMap().containsKey(badge.getKey()));
- }
-
- @Test
- public void anonymous() {
- RoleService unauthenticated = clientFactory.createAnonymous().getService(RoleService.class);
- try {
- unauthenticated.list();
- fail();
- } catch (AccessControlException e) {
- assertNotNull(e);
- }
-
- RoleService anonymous = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(RoleService.class);
- assertFalse(anonymous.list().getResult().isEmpty());
- }
-
- @Test
- public void noContent() throws IOException {
- SyncopeClient noContentclient = clientFactory.create(ADMIN_UNAME, ADMIN_PWD);
- RoleService noContentService = noContentclient.prefer(RoleService.class, Preference.RETURN_NO_CONTENT);
-
- RoleTO role = buildRoleTO("noContent");
-
- Response response = noContentService.create(role);
- assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
- assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
- assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
-
- role = getObject(response.getLocation(), RoleService.class, RoleTO.class);
- assertNotNull(role);
-
- RoleMod roleMod = new RoleMod();
- roleMod.getPlainAttrsToUpdate().add(attrMod("badge", "xxxxxxxxxx"));
-
- response = noContentService.update(role.getKey(), roleMod);
- assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
- assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
- assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
-
- response = noContentService.delete(role.getKey());
- assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
- assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
- assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
- }
-
- @Test
- public void issueSYNCOPE455() {
- final String parentName = "issueSYNCOPE455-PRole";
- final String childName = "issueSYNCOPE455-CRole";
-
- // 1. create parent role
- RoleTO parent = buildBasicRoleTO(parentName);
- parent.getResources().add(RESOURCE_NAME_LDAP);
-
- parent = createRole(parent);
- assertTrue(parent.getResources().contains(RESOURCE_NAME_LDAP));
-
- final ConnObjectTO parentRemoteObject =
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, parent.getKey());
- assertNotNull(parentRemoteObject);
- assertNotNull(getLdapRemoteObject(parentRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
-
- // 2. create child role
- RoleTO child = buildBasicRoleTO(childName);
- child.getResources().add(RESOURCE_NAME_LDAP);
- child.setParent(parent.getKey());
-
- child = createRole(child);
- assertTrue(child.getResources().contains(RESOURCE_NAME_LDAP));
-
- final ConnObjectTO childRemoteObject =
- resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, child.getKey());
- assertNotNull(childRemoteObject);
- assertNotNull(getLdapRemoteObject(childRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
-
- // 3. remove parent role
- roleService.delete(parent.getKey());
-
- // 4. asserts for issue 455
- try {
- roleService.read(parent.getKey());
- fail();
- } catch (SyncopeClientException scce) {
- assertNotNull(scce);
- }
-
- try {
- roleService.read(child.getKey());
- fail();
- } catch (SyncopeClientException scce) {
- assertNotNull(scce);
- }
-
- assertNull(getLdapRemoteObject(parentRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
- assertNull(getLdapRemoteObject(childRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
- }
-
- @Test
- public void issueSYNCOPE543() {
- final String ancestorName = "issueSYNCOPE543-ARole";
- final String parentName = "issueSYNCOPE543-PRole";
- final String childName = "issueSYNCOPE543-CRole";
-
- // 1. create ancestor role
- RoleTO ancestor = buildBasicRoleTO(ancestorName);
- ancestor.setParent(0L);
- ancestor.getRPlainAttrTemplates().add("icon");
- ancestor.getPlainAttrs().add(attrTO("icon", "ancestorIcon"));
- ancestor = createRole(ancestor);
- assertEquals("ancestorIcon", ancestor.getPlainAttrMap().get("icon").getValues().get(0));
-
- // 2. create parent role
- RoleTO parent = buildBasicRoleTO(parentName);
- parent.setParent(ancestor.getKey());
- parent.getRPlainAttrTemplates().add("icon");
- parent.getPlainAttrs().add(attrTO("icon", "parentIcon"));
- parent = createRole(parent);
- assertEquals("parentIcon", parent.getPlainAttrMap().get("icon").getValues().get(0));
-
- // 3. create child role
- RoleTO child = buildBasicRoleTO(childName);
- child.setParent(parent.getKey());
- child.getRPlainAttrTemplates().add("icon");
- child.getPlainAttrs().add(attrTO("icon", "childIcon"));
- child = createRole(child);
- assertEquals("childIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
-
- final RoleMod roleChildMod = new RoleMod();
- roleChildMod.setKey(child.getKey());
- roleChildMod.setInheritPlainAttrs(Boolean.TRUE);
- updateRole(roleChildMod);
-
- child = roleService.read(child.getKey());
- assertNotNull(child);
- assertNotNull(child.getPlainAttrMap().get("icon").getValues());
- assertEquals("parentIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
-
- final RoleMod roleParentMod = new RoleMod();
- roleParentMod.setKey(parent.getKey());
- roleParentMod.setInheritPlainAttrs(Boolean.TRUE);
- updateRole(roleParentMod);
-
- child = roleService.read(child.getKey());
- assertNotNull(child);
- assertNotNull(child.getPlainAttrMap().get("icon").getValues());
- assertEquals("ancestorIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
-
- parent = roleService.read(parent.getKey());
- assertNotNull(parent);
- assertNotNull(parent.getPlainAttrMap().get("icon").getValues());
- assertEquals("ancestorIcon", parent.getPlainAttrMap().get("icon").getValues().get(0));
-
- roleParentMod.setInheritPlainAttrs(Boolean.FALSE);
- updateRole(roleParentMod);
-
- child = roleService.read(child.getKey());
- assertNotNull(child);
- assertNotNull(child.getPlainAttrMap().get("icon").getValues());
- assertEquals("parentIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
- }
-
- @Test
- public void issueSYNCOPE632() {
- RoleTO roleTO = null;
- try {
- // 1. create new LDAP resource having account id mapped to a derived attribute
- ResourceTO newLDAP = resourceService.read(RESOURCE_NAME_LDAP);
- newLDAP.setKey("new-ldap");
- newLDAP.setPropagationPrimary(true);
- MappingItemTO accountId = newLDAP.getRmapping().getAccountIdItem();
- accountId.setIntMappingType(IntMappingType.RoleDerivedSchema);
- accountId.setIntAttrName("displayProperty");
- newLDAP.getRmapping().setAccountIdItem(accountId);
- newLDAP.getRmapping().setAccountLink("'cn=' + displayProperty + ',ou=groups,o=isp'");
-
- MappingItemTO description = new MappingItemTO();
- description.setIntMappingType(IntMappingType.RoleId);
- description.setExtAttrName("description");
- description.setPurpose(MappingPurpose.BOTH);
- newLDAP.getRmapping().addItem(description);
-
- newLDAP = createResource(newLDAP);
- assertNotNull(newLDAP);
-
- // 2. create a role and give the resource created above
- roleTO = buildRoleTO("lastRole");
- roleTO.getRPlainAttrTemplates().add("icon");
- roleTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
- roleTO.getRPlainAttrTemplates().add("show");
- roleTO.getPlainAttrs().add(attrTO("show", "true"));
- roleTO.getRDerAttrTemplates().add("displayProperty");
- roleTO.getDerAttrs().add(attrTO("displayProperty", null));
- roleTO.getResources().clear();
- roleTO.getResources().add("new-ldap");
-
- roleTO = createRole(roleTO);
- assertNotNull(roleTO);
-
- // 3. update the role
- RoleMod roleMod = new RoleMod();
- roleMod.setKey(roleTO.getKey());
- roleMod.getPlainAttrsToRemove().add("icon");
- roleMod.getPlainAttrsToUpdate().add(attrMod("icon", "anotherIcon"));
-
- roleTO = updateRole(roleMod);
- assertNotNull(roleTO);
-
- // 4. check that a single group exists in LDAP for the role created and updated above
- int entries = 0;
- DirContext ctx = null;
- try {
- ctx = getLdapResourceDirContext(null, null);
-
- SearchControls ctls = new SearchControls();
- ctls.setReturningAttributes(new String[] { "*", "+" });
- ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
-
- NamingEnumeration<SearchResult> result =
- ctx.search("ou=groups,o=isp", "(description=" + roleTO.getKey() + ")", ctls);
- while (result.hasMore()) {
- result.next();
- entries++;
- }
- } catch (Exception e) {
- // ignore
- } finally {
- if (ctx != null) {
- try {
- ctx.close();
- } catch (NamingException e) {
- // ignore
- }
- }
- }
-
- assertEquals(1, entries);
- } finally {
- if (roleTO != null) {
- roleService.delete(roleTO.getKey());
- }
- resourceService.delete("new-ldap");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
index 6af2828..2fd4adb 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
@@ -27,7 +27,7 @@ import java.util.HashSet;
import java.util.Set;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.junit.FixMethodOrder;
import org.junit.Test;
@@ -76,15 +76,15 @@ public class SearchITCase extends AbstractITCase {
}
@Test
- public void searchByRolenameAndKey() {
- final PagedResult<RoleTO> matchingRoles = roleService.search(
- SyncopeClient.getRoleSearchConditionBuilder().
+ public void searchByGroupNameAndKey() {
+ final PagedResult<GroupTO> matchingGroups = groupService.search(
+ SyncopeClient.getGroupSearchConditionBuilder().
is("name").equalTo("root").and("key").lessThan(2).query());
- assertNotNull(matchingRoles);
- assertEquals(1, matchingRoles.getResult().size());
- assertEquals("root", matchingRoles.getResult().iterator().next().getName());
- assertEquals(1L, matchingRoles.getResult().iterator().next().getKey());
+ assertNotNull(matchingGroups);
+ assertEquals(1, matchingGroups.getResult().size());
+ assertEquals("root", matchingGroups.getResult().iterator().next().getName());
+ assertEquals(1L, matchingGroups.getResult().iterator().next().getKey());
}
@Test
@@ -131,29 +131,29 @@ public class SearchITCase extends AbstractITCase {
@Test
public void searchByBooleanSubjectCond() {
- final PagedResult<RoleTO> matchingRoles = roleService.search(
- SyncopeClient.getRoleSearchConditionBuilder().is("inheritPlainAttrs").equalTo("true").query());
- assertNotNull(matchingRoles);
- assertFalse(matchingRoles.getResult().isEmpty());
+ final PagedResult<GroupTO> matchingGroups = groupService.search(
+ SyncopeClient.getGroupSearchConditionBuilder().is("inheritPlainAttrs").equalTo("true").query());
+ assertNotNull(matchingGroups);
+ assertFalse(matchingGroups.getResult().isEmpty());
}
@Test
public void searchByEntitlement() {
- final PagedResult<RoleTO> matchingRoles = roleService.search(
- SyncopeClient.getRoleSearchConditionBuilder().hasEntitlements("USER_LIST", "USER_READ").query());
- assertNotNull(matchingRoles);
- assertFalse(matchingRoles.getResult().isEmpty());
+ final PagedResult<GroupTO> matchingGroups = groupService.search(
+ SyncopeClient.getGroupSearchConditionBuilder().hasEntitlements("USER_LIST", "USER_READ").query());
+ assertNotNull(matchingGroups);
+ assertFalse(matchingGroups.getResult().isEmpty());
}
@Test
public void searchByRelationshipSubjectCond() {
- final PagedResult<RoleTO> matchingRoles = roleService.search(SyncopeClient.getRoleSearchConditionBuilder().
+ final PagedResult<GroupTO> matchingGroups = groupService.search(SyncopeClient.getGroupSearchConditionBuilder().
isNotNull("passwordPolicy").and("userOwner").equalTo(5).query());
- assertNotNull(matchingRoles);
- assertEquals(1, matchingRoles.getResult().size());
- assertEquals("director", matchingRoles.getResult().iterator().next().getName());
- assertEquals(6L, matchingRoles.getResult().iterator().next().getKey());
+ assertNotNull(matchingGroups);
+ assertEquals(1, matchingGroups.getResult().size());
+ assertEquals("director", matchingGroups.getResult().iterator().next().getName());
+ assertEquals(6L, matchingGroups.getResult().iterator().next().getKey());
}
@Test
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
index eb35036..6b7443d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
@@ -39,7 +39,7 @@ import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.SyncPolicyTO;
import org.apache.syncope.common.lib.to.SyncTaskTO;
import org.apache.syncope.common.lib.to.TaskExecTO;
@@ -102,13 +102,13 @@ public class SyncTaskITCase extends AbstractTaskITCase {
userTemplate.getResources().add(RESOURCE_NAME_WS2);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(8L);
+ membershipTO.setGroupId(8L);
userTemplate.getMemberships().add(membershipTO);
task.setUserTemplate(userTemplate);
- RoleTO roleTemplate = new RoleTO();
- roleTemplate.getResources().add(RESOURCE_NAME_LDAP);
- task.setRoleTemplate(roleTemplate);
+ GroupTO groupTemplate = new GroupTO();
+ groupTemplate.getResources().add(RESOURCE_NAME_LDAP);
+ task.setGroupTemplate(groupTemplate);
Response response = taskService.create(task);
SyncTaskTO actual = getObject(response.getLocation(), TaskService.class, SyncTaskTO.class);
@@ -119,7 +119,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
assertEquals(actual.getKey(), task.getKey());
assertEquals(actual.getJobClassName(), task.getJobClassName());
assertEquals(userTemplate, task.getUserTemplate());
- assertEquals(roleTemplate, task.getRoleTemplate());
+ assertEquals(groupTemplate, task.getGroupTemplate());
}
@Test
@@ -254,14 +254,14 @@ public class SyncTaskITCase extends AbstractTaskITCase {
* Clean Syncope and LDAP resource status.
*/
private void ldapCleanup() {
- PagedResult<RoleTO> matchingRoles = roleService.search(
- SyncopeClient.getRoleSearchConditionBuilder().is("name").equalTo("testLDAPGroup").query());
- if (matchingRoles.getSize() > 0) {
- for (RoleTO role : matchingRoles.getResult()) {
- roleService.bulkDeassociation(role.getKey(),
+ PagedResult<GroupTO> matchingGroups = groupService.search(
+ SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("testLDAPGroup").query());
+ if (matchingGroups.getSize() > 0) {
+ for (GroupTO group : matchingGroups.getResult()) {
+ groupService.bulkDeassociation(group.getKey(),
ResourceDeassociationActionType.UNLINK,
CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class));
- roleService.delete(role.getKey());
+ groupService.delete(group.getKey());
}
}
PagedResult<UserTO> matchingUsers = userService.search(
@@ -278,7 +278,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
@Test
public void reconcileFromLDAP() {
- // First of all, clear any potential conflict with existing user / role
+ // First of all, clear any potential conflict with existing user / group
ldapCleanup();
// Update sync task
@@ -289,11 +289,11 @@ public class SyncTaskITCase extends AbstractTaskITCase {
assertNotNull(status);
assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
- // 2. verify that synchronized role is found, with expected attributes
- final PagedResult<RoleTO> matchingRoles = roleService.search(
- SyncopeClient.getRoleSearchConditionBuilder().is("name").equalTo("testLDAPGroup").query());
- assertNotNull(matchingRoles);
- assertEquals(1, matchingRoles.getResult().size());
+ // 2. verify that synchronized group is found, with expected attributes
+ final PagedResult<GroupTO> matchingGroups = groupService.search(
+ SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("testLDAPGroup").query());
+ assertNotNull(matchingGroups);
+ assertEquals(1, matchingGroups.getResult().size());
final PagedResult<UserTO> matchingUsers = userService.search(
SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("syncFromLDAP").query());
@@ -308,17 +308,17 @@ public class SyncTaskITCase extends AbstractTaskITCase {
// Check for SYNCOPE-123
assertNotNull(matchingUsers.getResult().get(0).getPlainAttrMap().get("photo"));
- final RoleTO roleTO = matchingRoles.getResult().iterator().next();
- assertNotNull(roleTO);
- assertEquals("testLDAPGroup", roleTO.getName());
- assertEquals(8L, roleTO.getParent());
- assertEquals("true", roleTO.getPlainAttrMap().get("show").getValues().get(0));
- assertEquals(matchingUsers.getResult().iterator().next().getKey(), (long) roleTO.getUserOwner());
- assertNull(roleTO.getRoleOwner());
+ final GroupTO groupTO = matchingGroups.getResult().iterator().next();
+ assertNotNull(groupTO);
+ assertEquals("testLDAPGroup", groupTO.getName());
+ assertEquals(8L, groupTO.getParent());
+ assertEquals("true", groupTO.getPlainAttrMap().get("show").getValues().get(0));
+ assertEquals(matchingUsers.getResult().iterator().next().getKey(), (long) groupTO.getUserOwner());
+ assertNull(groupTO.getGroupOwner());
- // 3. verify that LDAP group membership is propagated as Syncope role membership
+ // 3. verify that LDAP group membership is propagated as Syncope group membership
final PagedResult<UserTO> members = userService.search(
- SyncopeClient.getUserSearchConditionBuilder().hasRoles(roleTO.getKey()).query());
+ SyncopeClient.getUserSearchConditionBuilder().inGroups(groupTO.getKey()).query());
assertNotNull(members);
assertEquals(1, members.getResult().size());
}
@@ -343,7 +343,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
userTO.getResources().add(RESOURCE_NAME_NOPROPAGATION4);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7L);
+ membershipTO.setGroupId(7L);
userTO.getMemberships().add(membershipTO);
@@ -361,7 +361,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
UserTO template = new UserTO();
membershipTO = new MembershipTO();
- membershipTO.setRoleId(10L);
+ membershipTO.setGroupId(10L);
template.getMemberships().add(membershipTO);
@@ -610,7 +610,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
@Test
public void issueSYNCOPE313LDAP() throws Exception {
- // First of all, clear any potential conflict with existing user / role
+ // First of all, clear any potential conflict with existing user / group
ldapCleanup();
// 1. create user in LDAP
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
index 9b02e74..b77a11b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
@@ -61,7 +61,7 @@ import org.apache.syncope.common.lib.to.PasswordPolicyTO;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.PropagationTaskTO;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.common.lib.types.ClientExceptionType;
@@ -306,7 +306,7 @@ public class UserITCase extends AbstractITCase {
userTO.setUsername("us");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7L);
+ membershipTO.setGroupId(7L);
userTO.getMemberships().add(membershipTO);
@@ -324,14 +324,14 @@ public class UserITCase extends AbstractITCase {
}
@Test(expected = SyncopeClientException.class)
- public void createWithInvalidPasswordByRole() {
- UserTO userTO = getSampleTO("invalidPwdByRole@passwd.com");
+ public void createWithInvalidPasswordByGroup() {
+ UserTO userTO = getSampleTO("invalidPwdByGroup@passwd.com");
// configured to be minLength=16
userTO.setPassword("password1");
final MembershipTO membership = new MembershipTO();
- membership.setRoleId(8L);
+ membership.setGroupId(8L);
userTO.getMemberships().add(membership);
@@ -362,7 +362,7 @@ public class UserITCase extends AbstractITCase {
// add a membership
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(8L);
+ membershipTO.setGroupId(8L);
userTO.getMemberships().add(membershipTO);
// add an attribute with no values: must be ignored
@@ -460,7 +460,7 @@ public class UserITCase extends AbstractITCase {
userTO.getPlainAttrs().remove(type);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(8L);
+ membershipTO.setGroupId(8L);
userTO.getMemberships().add(membershipTO);
// 1. create user without type (mandatory by UserSchema)
@@ -647,7 +647,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("g.h@t.com");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(8L);
+ membershipTO.setGroupId(8L);
membershipTO.getPlainAttrs().add(attrTO("subscriptionDate", "2009-08-18T16:33:12.203+0200"));
userTO.getMemberships().add(membershipTO);
@@ -657,7 +657,7 @@ public class UserITCase extends AbstractITCase {
assertEquals(1, userTO.getMemberships().size());
MembershipMod membershipMod = new MembershipMod();
- membershipMod.setRole(8L);
+ membershipMod.setGroup(8L);
membershipMod.getPlainAttrsToUpdate().add(attrMod("subscriptionDate", "2010-08-18T16:33:12.203+0200"));
UserMod userMod = new UserMod();
@@ -704,7 +704,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("pwdonly@t.com");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(8L);
+ membershipTO.setGroupId(8L);
membershipTO.getPlainAttrs().add(attrTO("subscriptionDate", "2009-08-18T16:33:12.203+0200"));
userTO.getMemberships().add(membershipTO);
@@ -742,7 +742,7 @@ public class UserITCase extends AbstractITCase {
// add a membership
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(8L);
+ membershipTO.setGroupId(8L);
userTO.getMemberships().add(membershipTO);
// 1. create user
@@ -811,7 +811,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("createActivate@syncope.apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(11L);
+ membershipTO.setGroupId(11L);
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
@@ -838,7 +838,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("suspendReactivate@syncope.apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7L);
+ membershipTO.setGroupId(7L);
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
@@ -1105,8 +1105,8 @@ public class UserITCase extends AbstractITCase {
}
@Test
- public void roleAttrPropagation() {
- UserTO userTO = getUniqueSampleTO("checkRoleAttrPropagation@syncope.apache.org");
+ public void groupAttrPropagation() {
+ UserTO userTO = getUniqueSampleTO("checkGroupAttrPropagation@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
userTO.getDerAttrs().clear();
@@ -1115,7 +1115,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(1L);
+ membershipTO.setGroupId(1L);
userTO.getMemberships().add(membershipTO);
@@ -1128,7 +1128,7 @@ public class UserITCase extends AbstractITCase {
ConnObjectTO connObjectTO =
resourceService.getConnectorObject(RESOURCE_NAME_CSV, SubjectType.USER, actual.getKey());
assertNotNull(connObjectTO);
- assertEquals("sx-dx", connObjectTO.getPlainAttrMap().get("ROLE").getValues().get(0));
+ assertEquals("sx-dx", connObjectTO.getPlainAttrMap().get("THEIRGROUP").getValues().get(0));
}
@Test
@@ -1141,7 +1141,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(1L);
+ membershipTO.setGroupId(1L);
membershipTO.getPlainAttrs().add(attrTO("mderived_sx", "sx"));
membershipTO.getPlainAttrs().add(attrTO("mderived_dx", "dx"));
membershipTO.getDerAttrs().add(attrTO("mderToBePropagated", null));
@@ -1198,12 +1198,12 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
MembershipTO memb12 = new MembershipTO();
- memb12.setRoleId(12L);
+ memb12.setGroupId(12L);
userTO.getMemberships().add(memb12);
MembershipTO memb13 = new MembershipTO();
- memb13.setRoleId(13L);
+ memb13.setGroupId(13L);
userTO.getMemberships().add(memb13);
@@ -1282,12 +1282,12 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
MembershipTO memb12 = new MembershipTO();
- memb12.setRoleId(12L);
+ memb12.setGroupId(12L);
memb12.getPlainAttrs().add(attrTO("postalAddress", "postalAddress"));
userTO.getMemberships().add(memb12);
MembershipTO memb13 = new MembershipTO();
- memb13.setRoleId(13L);
+ memb13.setGroupId(13L);
userTO.getMemberships().add(memb13);
userTO.getResources().add(RESOURCE_NAME_LDAP);
@@ -1311,12 +1311,12 @@ public class UserITCase extends AbstractITCase {
assertTrue(title.getValues().contains("r12") && title.getValues().contains("r13"));
// -----------------------------------
- // Remove the first membership and check for membership attr propagation and role attr propagation
+ // Remove the first membership and check for membership attr propagation and group attr propagation
// -----------------------------------
UserMod userMod = new UserMod();
userMod.setKey(actual.getKey());
- MembershipTO membershipTO = actual.getMemberships().get(0).getRoleId() == 12L
+ MembershipTO membershipTO = actual.getMemberships().get(0).getGroupId() == 12L
? actual.getMemberships().get(0)
: actual.getMemberships().get(1);
@@ -1649,14 +1649,14 @@ public class UserITCase extends AbstractITCase {
assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
assertEquals("suspended", userService.read(
- Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());
+ Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3))).getStatus());
bulkAction.setOperation(BulkAction.Type.REACTIVATE);
res = userService.bulk(bulkAction);
assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
assertEquals("active", userService.read(
- Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());
+ Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3))).getStatus());
bulkAction.setOperation(BulkAction.Type.DELETE);
res = userService.bulk(bulkAction);
@@ -1666,37 +1666,37 @@ public class UserITCase extends AbstractITCase {
@Test
public void issueSYNCOPE354() {
- // change resource-ldap role mapping for including uniqueMember (need for assertions below)
+ // change resource-ldap group mapping for including uniqueMember (need for assertions below)
ResourceTO ldap = resourceService.read(RESOURCE_NAME_LDAP);
- for (MappingItemTO item : ldap.getRmapping().getItems()) {
+ for (MappingItemTO item : ldap.getGmapping().getItems()) {
if ("description".equals(item.getExtAttrName())) {
item.setExtAttrName("uniqueMember");
}
}
resourceService.update(ldap.getKey(), ldap);
- // 1. create role with LDAP resource
- RoleTO roleTO = new RoleTO();
- roleTO.setName("SYNCOPE354-" + getUUIDString());
- roleTO.setParent(8L);
- roleTO.getResources().add(RESOURCE_NAME_LDAP);
+ // 1. create group with LDAP resource
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName("SYNCOPE354-" + getUUIDString());
+ groupTO.setParent(8L);
+ groupTO.getResources().add(RESOURCE_NAME_LDAP);
- roleTO = createRole(roleTO);
- assertNotNull(roleTO);
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
- // 2. create user with LDAP resource and membership of the above role
+ // 2. create user with LDAP resource and membership of the above group
UserTO userTO = getUniqueSampleTO("syncope354@syncope.apache.org");
userTO.getResources().add(RESOURCE_NAME_LDAP);
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(roleTO.getKey());
+ membershipTO.setGroupId(groupTO.getKey());
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));
- // 3. read role on resource, check that user DN is included in uniqueMember
+ // 3. read group on resource, check that user DN is included in uniqueMember
ConnObjectTO connObj = resourceService.getConnectorObject(
- RESOURCE_NAME_LDAP, SubjectType.ROLE, roleTO.getKey());
+ RESOURCE_NAME_LDAP, SubjectType.GROUP, groupTO.getKey());
assertNotNull(connObj);
assertTrue(connObj.getPlainAttrMap().get("uniqueMember").getValues().
contains("uid=" + userTO.getUsername() + ",ou=people,o=isp"));
@@ -1709,14 +1709,14 @@ public class UserITCase extends AbstractITCase {
userTO = updateUser(userMod);
assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));
- // 5. read role on resource, check that user DN was removed from uniqueMember
- connObj = resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, roleTO.getKey());
+ // 5. read group on resource, check that user DN was removed from uniqueMember
+ connObj = resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, groupTO.getKey());
assertNotNull(connObj);
assertFalse(connObj.getPlainAttrMap().get("uniqueMember").getValues().
contains("uid=" + userTO.getUsername() + ",ou=people,o=isp"));
- // 6. restore original resource-ldap role mapping
- for (MappingItemTO item : ldap.getRmapping().getItems()) {
+ // 6. restore original resource-ldap group mapping
+ for (MappingItemTO item : ldap.getGmapping().getItems()) {
if ("uniqueMember".equals(item.getExtAttrName())) {
item.setExtAttrName("description");
}
@@ -1726,22 +1726,22 @@ public class UserITCase extends AbstractITCase {
@Test
public void issueSYNCOPE357() throws IOException {
- // 1. create role with LDAP resource
- RoleTO roleTO = new RoleTO();
- roleTO.setName("SYNCOPE357-" + getUUIDString());
- roleTO.setParent(8L);
- roleTO.getResources().add(RESOURCE_NAME_LDAP);
+ // 1. create group with LDAP resource
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName("SYNCOPE357-" + getUUIDString());
+ groupTO.setParent(8L);
+ groupTO.getResources().add(RESOURCE_NAME_LDAP);
- roleTO = createRole(roleTO);
- assertNotNull(roleTO);
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
- // 2. create user with membership of the above role
+ // 2. create user with membership of the above group
UserTO userTO = getUniqueSampleTO("syncope357@syncope.apache.org");
userTO.getPlainAttrs().add(attrTO("obscure", "valueToBeObscured"));
userTO.getPlainAttrs().add(attrTO("photo",
Base64Utility.encode(IOUtils.readBytesFromStream(getClass().getResourceAsStream("/favicon.jpg")))));
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(roleTO.getKey());
+ membershipTO.setGroupId(groupTO.getKey());
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
@@ -1760,8 +1760,8 @@ public class UserITCase extends AbstractITCase {
assertNotNull(jpegPhoto);
assertEquals(userTO.getPlainAttrMap().get("photo").getValues(), jpegPhoto.getValues());
- // 4. remove role
- roleService.delete(roleTO.getKey());
+ // 4. remove group
+ groupService.delete(groupTO.getKey());
// 5. try to read user on resource: fail
try {
@@ -2232,7 +2232,7 @@ public class UserITCase extends AbstractITCase {
}
ws1.setUmapping(ws1NewUMapping);
- ws1.setRmapping(ws1.getRmapping());
+ ws1.setGmapping(ws1.getGmapping());
resourceService.update(RESOURCE_NAME_WS1, ws1);
ResourceTO newWs1 = resourceService.read(ws1.getKey());
@@ -2270,7 +2270,7 @@ public class UserITCase extends AbstractITCase {
}
newWs1.setUmapping(ws1NewUMapping);
- newWs1.setRmapping(newWs1.getRmapping());
+ newWs1.setGmapping(newWs1.getGmapping());
resourceService.update(RESOURCE_NAME_WS1, newWs1);
}
@@ -2478,7 +2478,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(12L);
+ membershipTO.setGroupId(12L);
membershipTO.getPlainAttrs().add(attrTO("postalAddress", "postalAddress"));
userTO.getMemberships().add(membershipTO);
@@ -2497,7 +2497,7 @@ public class UserITCase extends AbstractITCase {
userMod.setKey(actual.getKey());
MembershipMod membershipMod = new MembershipMod();
- membershipMod.setRole(12L);
+ membershipMod.setGroup(12L);
membershipMod.getPlainAttrsToUpdate().add(attrMod("postalAddress", "newPostalAddress"));
userMod.getMembershipsToAdd().add(membershipMod);
userMod.getMembershipsToRemove().add(actual.getMemberships().iterator().next().getKey());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
index 515e13d..68d8f3d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
@@ -89,7 +89,7 @@ public class UserSelfITCase extends AbstractITCase {
// self-create user with membership: goes 'createApproval' with resources and membership but no propagation
UserTO userTO = UserITCase.getUniqueSampleTO("anonymous@syncope.apache.org");
MembershipTO membership = new MembershipTO();
- membership.setRoleId(3L);
+ membership.setGroupId(3L);
userTO.getMemberships().add(membership);
userTO.getResources().add(RESOURCE_NAME_TESTDB);
@@ -169,7 +169,7 @@ public class UserSelfITCase extends AbstractITCase {
// 2. self-update (username + memberships + resource) - works but needs approval
MembershipMod membershipMod = new MembershipMod();
- membershipMod.setRole(7L);
+ membershipMod.setGroup(7L);
AttrMod testAttrMod = new AttrMod();
testAttrMod.setSchema("testAttribute");
testAttrMod.getValuesToBeAdded().add("a value");
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
index 05399c0..80c916a 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
@@ -54,16 +54,16 @@ public class UserWorkflowITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("createWithReject@syncope.apache.org");
userTO.getResources().add(RESOURCE_NAME_TESTDB);
- // User with role 9 are defined in workflow as subject to approval
+ // User with group 9 are defined in workflow as subject to approval
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(9L);
+ membershipTO.setGroupId(9L);
userTO.getMemberships().add(membershipTO);
- // 1. create user with role 9
+ // 1. create user with group 9
userTO = createUser(userTO);
assertNotNull(userTO);
assertEquals(1, userTO.getMemberships().size());
- assertEquals(9, userTO.getMemberships().get(0).getRoleId());
+ assertEquals(9, userTO.getMemberships().get(0).getGroupId());
assertEquals("createApproval", userTO.getStatus());
// 2. request if there is any pending task for user just created
@@ -74,7 +74,7 @@ public class UserWorkflowITCase extends AbstractITCase {
assertNotNull(form.getTaskId());
assertNull(form.getOwner());
- // 3. claim task from rossini, not in role 7 (designated for approval in workflow definition): fail
+ // 3. claim task from rossini, not in group 7 (designated for approval in workflow definition): fail
UserWorkflowService userService2 = clientFactory.create(
"rossini", ADMIN_PWD).getService(UserWorkflowService.class);
@@ -85,7 +85,7 @@ public class UserWorkflowITCase extends AbstractITCase {
assertEquals(ClientExceptionType.Workflow, e.getType());
}
- // 4. claim task from bellini, in role 7
+ // 4. claim task from bellini, in group 7
UserWorkflowService userService3 = clientFactory.create(
"bellini", ADMIN_PWD).getService(UserWorkflowService.class);
@@ -128,16 +128,16 @@ public class UserWorkflowITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("createWithApproval@syncope.apache.org");
userTO.getResources().add(RESOURCE_NAME_TESTDB);
- // User with role 9 are defined in workflow as subject to approval
+ // User with group 9 are defined in workflow as subject to approval
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(9L);
+ membershipTO.setGroupId(9L);
userTO.getMemberships().add(membershipTO);
- // 1. create user with role 9 (and verify that no propagation occurred)
+ // 1. create user with group 9 (and verify that no propagation occurred)
userTO = createUser(userTO);
assertNotNull(userTO);
assertEquals(1, userTO.getMemberships().size());
- assertEquals(9, userTO.getMemberships().get(0).getRoleId());
+ assertEquals(9, userTO.getMemberships().get(0).getGroupId());
assertEquals("createApproval", userTO.getStatus());
assertEquals(Collections.singleton(RESOURCE_NAME_TESTDB), userTO.getResources());
@@ -214,12 +214,12 @@ public class UserWorkflowITCase extends AbstractITCase {
userTO.getDerAttrs().clear();
userTO.getMemberships().clear();
- // User with role 9 are defined in workflow as subject to approval
+ // User with group 9 are defined in workflow as subject to approval
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(9L);
+ membershipTO.setGroupId(9L);
userTO.getMemberships().add(membershipTO);
- // 1. create user with role 9 (and verify that no propagation occurred)
+ // 1. create user with group 9 (and verify that no propagation occurred)
userTO = createUser(userTO);
assertNotNull(userTO);
assertNotEquals(0L, userTO.getKey());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
index 68cfdcc..6ed3871 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
@@ -38,7 +38,7 @@ import org.apache.syncope.common.lib.to.MappingItemTO;
import org.apache.syncope.common.lib.to.MappingTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.IntMappingType;
@@ -59,7 +59,7 @@ public class VirAttrITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("issue16@apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(8L);
+ membershipTO.setGroupId(8L);
userTO.getMemberships().add(membershipTO);
// 1. create user
@@ -442,7 +442,7 @@ public class VirAttrITCase extends AbstractITCase {
@Test
public void issueSYNCOPE453() {
final String resourceName = "issueSYNCOPE453-Res-" + getUUIDString();
- final String roleName = "issueSYNCOPE453-Role-" + getUUIDString();
+ final String groupName = "issueSYNCOPE453-Group-" + getUUIDString();
// -------------------------------------------
// Create a resource ad-hoc
@@ -457,7 +457,7 @@ public class VirAttrITCase extends AbstractITCase {
MappingItemTO item = new MappingItemTO();
item.setIntAttrName("aLong");
item.setIntMappingType(IntMappingType.UserPlainSchema);
- item.setExtAttrName(roleName);
+ item.setExtAttrName(groupName);
item.setPurpose(MappingPurpose.PROPAGATION);
item.setAccountid(true);
mapping.setAccountIdItem(item);
@@ -472,7 +472,7 @@ public class VirAttrITCase extends AbstractITCase {
item = new MappingItemTO();
item.setExtAttrName("EMAIL");
item.setIntAttrName("rvirtualdata");
- item.setIntMappingType(IntMappingType.RoleVirtualSchema);
+ item.setIntMappingType(IntMappingType.GroupVirtualSchema);
item.setPurpose(MappingPurpose.PROPAGATION);
mapping.getItems().add(item);
@@ -482,17 +482,17 @@ public class VirAttrITCase extends AbstractITCase {
// -------------------------------------------
// -------------------------------------------
- // Create a role ad-hoc
+ // Create a VirAttrITCase ad-hoc
// -------------------------------------------
- RoleTO roleTO = new RoleTO();
- roleTO.setName(roleName);
- roleTO.setParent(8L);
- roleTO.getRVirAttrTemplates().add("rvirtualdata");
- roleTO.getVirAttrs().add(attrTO("rvirtualdata", "ml@role.it"));
- roleTO.getResources().add(RESOURCE_NAME_LDAP);
- roleTO = createRole(roleTO);
- assertEquals(1, roleTO.getVirAttrs().size());
- assertEquals("ml@role.it", roleTO.getVirAttrs().get(0).getValues().get(0));
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName(groupName);
+ groupTO.setParent(8L);
+ groupTO.getGVirAttrTemplates().add("rvirtualdata");
+ groupTO.getVirAttrs().add(attrTO("rvirtualdata", "ml@group.it"));
+ groupTO.getResources().add(RESOURCE_NAME_LDAP);
+ groupTO = createGroup(groupTO);
+ assertEquals(1, groupTO.getVirAttrs().size());
+ assertEquals("ml@group.it", groupTO.getVirAttrs().get(0).getValues().get(0));
// -------------------------------------------
// -------------------------------------------
@@ -507,7 +507,7 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getMemberships().clear();
final MembershipTO membership = new MembershipTO();
- membership.setRoleId(roleTO.getKey());
+ membership.setGroupId(groupTO.getKey());
membership.getVirAttrs().add(attrTO("mvirtualdata", "mvirtualvalue"));
userTO.getMemberships().add(membership);
@@ -523,14 +523,14 @@ public class VirAttrITCase extends AbstractITCase {
new Object[] { Integer.parseInt(userTO.getPlainAttrMap().get("aLong").getValues().get(0)) });
assertEquals(userTO.getPlainAttrMap().get("aLong").getValues().get(0), actuals.get("id").toString());
- assertEquals("ml@role.it", actuals.get("email"));
+ assertEquals("ml@group.it", actuals.get("email"));
// -------------------------------------------
// -------------------------------------------
- // Delete resource and role ad-hoc
+ // Delete resource and group ad-hoc
// -------------------------------------------
resourceService.delete(resourceName);
- roleService.delete(roleTO.getKey());
+ groupService.delete(groupTO.getKey());
// -------------------------------------------
}
@@ -565,14 +565,14 @@ public class VirAttrITCase extends AbstractITCase {
@Test
public void issueSYNCOPE458() {
// -------------------------------------------
- // Create a role ad-hoc
+ // Create a group ad-hoc
// -------------------------------------------
- final String roleName = "issueSYNCOPE458-Role-" + getUUIDString();
- RoleTO roleTO = new RoleTO();
- roleTO.setName(roleName);
- roleTO.setParent(2L);
- roleTO.setInheritTemplates(true);
- roleTO = createRole(roleTO);
+ final String groupName = "issueSYNCOPE458-Group-" + getUUIDString();
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName(groupName);
+ groupTO.setParent(2L);
+ groupTO.setInheritTemplates(true);
+ groupTO = createGroup(groupTO);
// -------------------------------------------
// -------------------------------------------
@@ -608,7 +608,7 @@ public class VirAttrITCase extends AbstractITCase {
// add membership, with virtual attribute populated, to user
MembershipTO membership = new MembershipTO();
- membership.setRoleId(roleTO.getKey());
+ membership.setGroupId(groupTO.getKey());
membership.getVirAttrs().add(attrTO("mvirtualdata", "syncope458@syncope.apache.org"));
userTO.getMemberships().add(membership);
@@ -626,7 +626,7 @@ public class VirAttrITCase extends AbstractITCase {
// 2. update membership virtual attribute
MembershipMod membershipMod = new MembershipMod();
- membershipMod.setRole(roleTO.getKey());
+ membershipMod.setGroup(groupTO.getKey());
membershipMod.getVirAttrsToUpdate().add(attrMod("mvirtualdata", "syncope458_NEW@syncope.apache.org"));
UserMod userMod = new UserMod();
@@ -657,7 +657,7 @@ public class VirAttrITCase extends AbstractITCase {
connectorService.update(connInstanceBean.getKey(), connInstanceBean);
membershipMod = new MembershipMod();
- membershipMod.setRole(roleTO.getKey());
+ membershipMod.setGroup(groupTO.getKey());
membershipMod.getVirAttrsToUpdate().add(attrMod("mvirtualdata", "syncope458_updated@syncope.apache.org"));
userMod = new UserMod();
@@ -703,7 +703,7 @@ public class VirAttrITCase extends AbstractITCase {
// 5. remove membership virtual attribute
membershipMod = new MembershipMod();
- membershipMod.setRole(roleTO.getKey());
+ membershipMod.setGroup(groupTO.getKey());
membershipMod.getVirAttrsToRemove().add("mvirtualdata");
userMod = new UserMod();
@@ -717,9 +717,9 @@ public class VirAttrITCase extends AbstractITCase {
assertTrue(userTO.getMemberships().get(0).getVirAttrMap().isEmpty());
// -------------------------------------------
- // Delete role ad-hoc and restore resource mapping
+ // Delete group ad-hoc and restore resource mapping
// -------------------------------------------
- roleService.delete(roleTO.getKey());
+ groupService.delete(groupTO.getKey());
resourceUMapping.removeItem(item);
resourceDBVirAttr.setUmapping(resourceUMapping);
@@ -796,19 +796,19 @@ public class VirAttrITCase extends AbstractITCase {
// -------------------------------------------
// -------------------------------------------
- // Create a role ad-hoc
+ // Create a group ad-hoc
// -------------------------------------------
- final String roleName = "issueSYNCOPE501-Role-" + getUUIDString();
- RoleTO roleTO = new RoleTO();
- roleTO.setName(roleName);
- roleTO.setParent(2L);
- roleTO.setInheritTemplates(true);
- roleTO = createRole(roleTO);
+ final String groupName = "issueSYNCOPE501-Group-" + getUUIDString();
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName(groupName);
+ groupTO.setParent(2L);
+ groupTO.setInheritTemplates(true);
+ groupTO = createGroup(groupTO);
// -------------------------------------------
// 1. add membership, with virtual attribute populated, to user
MembershipMod membershipMod = new MembershipMod();
- membershipMod.setRole(roleTO.getKey());
+ membershipMod.setGroup(groupTO.getKey());
membershipMod.getVirAttrsToUpdate().add(attrMod("mvirtualdata", "syncope501membership@test.org"));
userMod = new UserMod();
@@ -823,7 +823,7 @@ public class VirAttrITCase extends AbstractITCase {
// 2. update only membership virtual attribute and propagate user
membershipMod = new MembershipMod();
- membershipMod.setRole(roleTO.getKey());
+ membershipMod.setGroup(groupTO.getKey());
membershipMod.getVirAttrsToUpdate().add(attrMod("mvirtualdata",
"syncope501membership_updated@test.org"));
membershipMod.getVirAttrsToRemove().add("syncope501membership@test.org");
@@ -860,9 +860,9 @@ public class VirAttrITCase extends AbstractITCase {
// ----------------------------------------
// -------------------------------------------
- // Delete role ad-hoc and restore resource mapping
+ // Delete group ad-hoc and restore resource mapping
// -------------------------------------------
- roleService.delete(roleTO.getKey());
+ groupService.delete(groupTO.getKey());
resourceUMapping.removeItem(item);
resourceDBVirAttr.setUmapping(resourceUMapping);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirSchemaITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirSchemaITCase.java
index e66e51c..c8259f0 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirSchemaITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirSchemaITCase.java
@@ -69,13 +69,13 @@ public class VirSchemaITCase extends AbstractITCase {
@Test
public void delete() {
- VirSchemaTO schema = schemaService.read(AttributableType.ROLE, SchemaType.VIRTUAL, "rvirtualdata");
+ VirSchemaTO schema = schemaService.read(AttributableType.GROUP, SchemaType.VIRTUAL, "rvirtualdata");
assertNotNull(schema);
- schemaService.delete(AttributableType.ROLE, SchemaType.VIRTUAL, schema.getKey());
+ schemaService.delete(AttributableType.GROUP, SchemaType.VIRTUAL, schema.getKey());
try {
- schemaService.read(AttributableType.ROLE, SchemaType.VIRTUAL, "rvirtualdata");
+ schemaService.read(AttributableType.GROUP, SchemaType.VIRTUAL, "rvirtualdata");
fail();
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.NotFound, e.getType());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/WorkflowITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/WorkflowITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/WorkflowITCase.java
index 8bd844d..106b1f1 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/WorkflowITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/WorkflowITCase.java
@@ -49,9 +49,9 @@ public class WorkflowITCase extends AbstractITCase {
}
@Test
- public void getRoleDefinition() throws IOException {
- Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForRoles(syncopeService));
- exportDefinition(SubjectType.ROLE);
+ public void getGroupDefinition() throws IOException {
+ Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForGroups(syncopeService));
+ exportDefinition(SubjectType.GROUP);
}
private void importDefinition(final SubjectType type) throws IOException {
@@ -64,14 +64,12 @@ public class WorkflowITCase extends AbstractITCase {
@Test
public void updateUserDefinition() throws IOException {
Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers(syncopeService));
-
importDefinition(SubjectType.USER);
}
@Test
- public void updateRoleDefinition() throws IOException {
- Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForRoles(syncopeService));
-
- importDefinition(SubjectType.ROLE);
+ public void updateGroupDefinition() throws IOException {
+ Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForGroups(syncopeService));
+ importDefinition(SubjectType.GROUP);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/resources/test.csv
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/resources/test.csv b/fit/core-reference/src/test/resources/test.csv
index f227366..100f71a 100644
--- a/fit/core-reference/src/test/resources/test.csv
+++ b/fit/core-reference/src/test/resources/test.csv
@@ -1,10 +1,10 @@
-test0,nome0,cognome0,test0@syncope.apache.org,password0,role1,membership1,true,false
-test1,nome1,cognome1,test1@syncope.apache.org,password1,role1,membership1,false,false
-test2,nome2,cognome2,test2@syncope.apache.org,notpermitted1,role1,membership1,true,false
-test3,nome3,cognome3,test3@syncope.apache.org,password3,role1,membership1,true,false
-test4,nome4,cognome4,test4@syncope.apache.org,password4,role1,membership1,true,false
-test5,nome5,cognome5,test5@syncope.apache.org,password5,role1,membership1,true,false
-test6,nome6,cognome6,test6@syncope.apache.org,password6,role1,membership1,true,false
-test7,nome7,cognome7,test7@syncope.apache.org,password7,role1,membership1,true,false
-test8,nome8,cognome8,test8@syncope.apache.org,password8,role1,membership1,true,false
-test9,nome9,cognome9,test9@syncope.apache.org,password999,role1,membership1,true,false
+test0,nome0,cognome0,test0@syncope.apache.org,password0,group1,membership1,true,false
+test1,nome1,cognome1,test1@syncope.apache.org,password1,group1,membership1,false,false
+test2,nome2,cognome2,test2@syncope.apache.org,notpermitted1,group1,membership1,true,false
+test3,nome3,cognome3,test3@syncope.apache.org,password3,group1,membership1,true,false
+test4,nome4,cognome4,test4@syncope.apache.org,password4,group1,membership1,true,false
+test5,nome5,cognome5,test5@syncope.apache.org,password5,group1,membership1,true,false
+test6,nome6,cognome6,test6@syncope.apache.org,password6,group1,membership1,true,false
+test7,nome7,cognome7,test7@syncope.apache.org,password7,group1,membership1,true,false
+test8,nome8,cognome8,test8@syncope.apache.org,password8,group1,membership1,true,false
+test9,nome9,cognome9,test9@syncope.apache.org,password999,group1,membership1,true,false
[03/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
index 0f0560a..fc4af36 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertNotNull;
import java.io.InputStream;
import java.net.URI;
-import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
@@ -37,13 +36,13 @@ import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
import org.apache.syncope.common.lib.mod.AttrMod;
-import org.apache.syncope.common.lib.mod.RoleMod;
+import org.apache.syncope.common.lib.mod.GroupMod;
import org.apache.syncope.common.lib.mod.UserMod;
import org.apache.syncope.common.lib.to.AbstractPolicyTO;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.ConnConfProperty;
@@ -58,7 +57,7 @@ import org.apache.syncope.common.rest.api.service.NotificationService;
import org.apache.syncope.common.rest.api.service.PolicyService;
import org.apache.syncope.common.rest.api.service.ReportService;
import org.apache.syncope.common.rest.api.service.ResourceService;
-import org.apache.syncope.common.rest.api.service.RoleService;
+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.SecurityQuestionService;
import org.apache.syncope.common.rest.api.service.SyncopeService;
@@ -153,7 +152,7 @@ public abstract class AbstractITCase {
protected static UserWorkflowService userWorkflowService;
- protected static RoleService roleService;
+ protected static GroupService groupService;
protected static ResourceService resourceService;
@@ -178,7 +177,7 @@ public abstract class AbstractITCase {
protected static PolicyService policyService;
protected static SecurityQuestionService securityQuestionService;
-
+
protected static CamelRouteService camelRouteService;
@Autowired
@@ -218,7 +217,7 @@ public abstract class AbstractITCase {
userService = adminClient.getService(UserService.class);
userSelfService = adminClient.getService(UserSelfService.class);
userWorkflowService = adminClient.getService(UserWorkflowService.class);
- roleService = adminClient.getService(RoleService.class);
+ groupService = adminClient.getService(GroupService.class);
resourceService = adminClient.getService(ResourceService.class);
entitlementService = adminClient.getService(EntitlementService.class);
configurationService = adminClient.getService(ConfigurationService.class);
@@ -302,23 +301,23 @@ public abstract class AbstractITCase {
return (T) getObject(response.getLocation(), SchemaService.class, schemaTO.getClass());
}
- protected RoleTO createRole(final RoleTO newRoleTO) {
- Response response = roleService.create(newRoleTO);
+ protected GroupTO createGroup(final GroupTO newGroupTO) {
+ Response response = groupService.create(newGroupTO);
if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
if (ex != null) {
throw (RuntimeException) ex;
}
}
- return getObject(response.getLocation(), RoleService.class, RoleTO.class);
+ return getObject(response.getLocation(), GroupService.class, GroupTO.class);
}
- protected RoleTO updateRole(final RoleMod roleMod) {
- return roleService.update(roleMod.getKey(), roleMod).readEntity(RoleTO.class);
+ protected GroupTO updateGroup(final GroupMod groupMod) {
+ return groupService.update(groupMod.getKey(), groupMod).readEntity(GroupTO.class);
}
- protected RoleTO deleteRole(final Long id) {
- return roleService.delete(id).readEntity(RoleTO.class);
+ protected GroupTO deleteGroup(final Long id) {
+ return groupService.delete(id).readEntity(GroupTO.class);
}
@SuppressWarnings("unchecked")
@@ -351,7 +350,7 @@ public abstract class AbstractITCase {
final Map<String, ConnConfProperty> ldapConnConf =
connectorService.read(ldapRes.getConnectorId()).getConfigurationMap();
- Hashtable env = new Hashtable();
+ Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://" + ldapConnConf.get("host").getValues().get(0)
+ ":" + ldapConnConf.get("port").getValues().get(0) + "/");
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ActivitiDetector.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ActivitiDetector.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ActivitiDetector.java
index f697c19..798a313 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ActivitiDetector.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ActivitiDetector.java
@@ -26,7 +26,7 @@ public class ActivitiDetector {
return syncopeService.info().getUserWorkflowAdapter().indexOf("Activiti") != -1;
}
- public static boolean isActivitiEnabledForRoles(final SyncopeService syncopeService) {
- return syncopeService.info().getRoleWorkflowAdapter().indexOf("Activiti") != -1;
+ public static boolean isActivitiEnabledForGroups(final SyncopeService syncopeService) {
+ return syncopeService.info().getGroupWorkflowAdapter().indexOf("Activiti") != -1;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
index 4623f25..ef99feb 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
@@ -40,7 +40,7 @@ import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO;
import org.apache.syncope.common.lib.to.WorkflowFormTO;
@@ -99,14 +99,14 @@ public class AuthenticationITCase extends AbstractITCase {
@Test
public void testUserSchemaAuthorization() {
- // 0. create a role that can only read schemas
- RoleTO authRoleTO = new RoleTO();
- authRoleTO.setName("authRole" + getUUIDString());
- authRoleTO.setParent(8L);
- authRoleTO.getEntitlements().add("SCHEMA_READ");
+ // 0. create a group that can only read schemas
+ GroupTO authGroupTO = new GroupTO();
+ authGroupTO.setName("authGroup" + getUUIDString());
+ authGroupTO.setParent(8L);
+ authGroupTO.getEntitlements().add("SCHEMA_READ");
- authRoleTO = createRole(authRoleTO);
- assertNotNull(authRoleTO);
+ authGroupTO = createGroup(authGroupTO);
+ assertNotNull(authGroupTO);
String schemaName = "authTestSchema" + getUUIDString();
@@ -119,11 +119,11 @@ public class AuthenticationITCase extends AbstractITCase {
PlainSchemaTO newPlainSchemaTO = createSchema(AttributableType.USER, SchemaType.PLAIN, schemaTO);
assertEquals(schemaTO, newPlainSchemaTO);
- // 2. create an user with the role created above (as admin)
+ // 2. create an user with the group created above (as admin)
UserTO userTO = UserITCase.getUniqueSampleTO("auth@test.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(authRoleTO.getKey());
+ membershipTO.setGroupId(authGroupTO.getKey());
AttrTO testAttrTO = new AttrTO();
testAttrTO.setSchema("testAttribute");
testAttrTO.getValues().add("a value");
@@ -146,7 +146,7 @@ public class AuthenticationITCase extends AbstractITCase {
// 5. update the schema create above (as user) - failure
try {
- schemaService2.update(AttributableType.ROLE, SchemaType.PLAIN, schemaName, schemaTO);
+ schemaService2.update(AttributableType.GROUP, SchemaType.PLAIN, schemaName, schemaTO);
fail("Schemaupdate as user schould not work");
} catch (SyncopeClientException e) {
assertNotNull(e);
@@ -164,7 +164,7 @@ public class AuthenticationITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("testuserread@test.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7L);
+ membershipTO.setGroupId(7L);
AttrTO testAttrTO = new AttrTO();
testAttrTO.setSchema("testAttribute");
testAttrTO.getValues().add("a value");
@@ -190,7 +190,7 @@ public class AuthenticationITCase extends AbstractITCase {
exception = e;
}
assertNotNull(exception);
- assertEquals(ClientExceptionType.UnauthorizedRole, exception.getType());
+ assertEquals(ClientExceptionType.UnauthorizedGroup, exception.getType());
}
@Test
@@ -198,7 +198,7 @@ public class AuthenticationITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("testusersearch@test.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7L);
+ membershipTO.setGroupId(7L);
AttrTO testAttrTO = new AttrTO();
testAttrTO.setSchema("testAttribute");
testAttrTO.getValues().add("a value");
@@ -240,7 +240,7 @@ public class AuthenticationITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("checkFailedLogin@syncope.apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7L);
+ membershipTO.setGroupId(7L);
AttrTO testAttrTO = new AttrTO();
testAttrTO.setSchema("testAttribute");
testAttrTO.getValues().add("a value");
@@ -273,7 +273,7 @@ public class AuthenticationITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("checkSuspension@syncope.apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7L);
+ membershipTO.setGroupId(7L);
AttrTO testAttrTO = new AttrTO();
testAttrTO.setSchema("testAttribute");
testAttrTO.getValues().add("a value");
@@ -322,56 +322,56 @@ public class AuthenticationITCase extends AbstractITCase {
@Test
public void issueSYNCOPE48() {
- // Parent role, able to create users with role 1
- RoleTO parentRole = new RoleTO();
- parentRole.setName("parentAdminRole" + getUUIDString());
- parentRole.getEntitlements().add("USER_CREATE");
- parentRole.getEntitlements().add("ROLE_1");
- parentRole.setParent(1L);
- parentRole = createRole(parentRole);
- assertNotNull(parentRole);
-
- // Child role, with no entitlements
- RoleTO childRole = new RoleTO();
- childRole.setName("childAdminRole");
- childRole.setParent(parentRole.getKey());
-
- childRole = createRole(childRole);
- assertNotNull(childRole);
-
- // User with child role, created by admin
- UserTO role1Admin = UserITCase.getUniqueSampleTO("syncope48admin@apache.org");
- role1Admin.setPassword("password");
+ // Parent group, able to create users with group 1
+ GroupTO parentGroup = new GroupTO();
+ parentGroup.setName("parentAdminGroup" + getUUIDString());
+ parentGroup.getEntitlements().add("USER_CREATE");
+ parentGroup.getEntitlements().add("GROUP_1");
+ parentGroup.setParent(1L);
+ parentGroup = createGroup(parentGroup);
+ assertNotNull(parentGroup);
+
+ // Child group, with no entitlements
+ GroupTO childGroup = new GroupTO();
+ childGroup.setName("childAdminGroup");
+ childGroup.setParent(parentGroup.getKey());
+
+ childGroup = createGroup(childGroup);
+ assertNotNull(childGroup);
+
+ // User with child group, created by admin
+ UserTO group1Admin = UserITCase.getUniqueSampleTO("syncope48admin@apache.org");
+ group1Admin.setPassword("password");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(childRole.getKey());
- role1Admin.getMemberships().add(membershipTO);
+ membershipTO.setGroupId(childGroup.getKey());
+ group1Admin.getMemberships().add(membershipTO);
- role1Admin = createUser(role1Admin);
- assertNotNull(role1Admin);
+ group1Admin = createUser(group1Admin);
+ assertNotNull(group1Admin);
- UserService userService2 = clientFactory.create(role1Admin.getUsername(), "password").getService(
+ UserService userService2 = clientFactory.create(group1Admin.getUsername(), "password").getService(
UserService.class);
- // User with role 1, created by user with child role created above
- UserTO role1User = UserITCase.getUniqueSampleTO("syncope48user@apache.org");
+ // User with group 1, created by user with child group created above
+ UserTO group1User = UserITCase.getUniqueSampleTO("syncope48user@apache.org");
membershipTO = new MembershipTO();
- membershipTO.setRoleId(1L);
- role1User.getMemberships().add(membershipTO);
+ membershipTO.setGroupId(1L);
+ group1User.getMemberships().add(membershipTO);
- Response response = userService2.create(role1User, true);
+ Response response = userService2.create(group1User, true);
assertNotNull(response);
- role1User = response.readEntity(UserTO.class);
- assertNotNull(role1User);
+ group1User = response.readEntity(UserTO.class);
+ assertNotNull(group1User);
}
@Test
public void issueSYNCOPE434() {
Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers(syncopeService));
- // 1. create user with role 9 (users with role 9 are defined in workflow as subject to approval)
+ // 1. create user with group 9 (users with group 9 are defined in workflow as subject to approval)
UserTO userTO = UserITCase.getUniqueSampleTO("createWithReject@syncope.apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(9L);
+ membershipTO.setGroupId(9L);
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelDetector.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelDetector.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelDetector.java
index 47cad19..a061005 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelDetector.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelDetector.java
@@ -26,7 +26,7 @@ public class CamelDetector {
return syncopeService.info().getUserProvisioningManager().indexOf("Camel") != -1;
}
- public static boolean isCamelEnabledForRoles(final SyncopeService syncopeService) {
- return syncopeService.info().getRoleProvisioningManager().indexOf("Camel") != -1;
+ public static boolean isCamelEnabledForGroups(final SyncopeService syncopeService) {
+ return syncopeService.info().getGroupProvisioningManager().indexOf("Camel") != -1;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
index 1b3e91d..35f270c 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
@@ -50,13 +50,13 @@ public class CamelRouteITCase extends AbstractITCase {
}
@Test
- public void roleRoutes() {
- Assume.assumeTrue(CamelDetector.isCamelEnabledForRoles(syncopeService));
+ public void groupRoutes() {
+ Assume.assumeTrue(CamelDetector.isCamelEnabledForGroups(syncopeService));
- List<CamelRouteTO> roleRoutes = camelRouteService.list(SubjectType.ROLE);
- assertNotNull(roleRoutes);
- assertEquals(7, roleRoutes.size());
- for (CamelRouteTO route : roleRoutes) {
+ List<CamelRouteTO> groupRoutes = camelRouteService.list(SubjectType.GROUP);
+ assertNotNull(groupRoutes);
+ assertEquals(7, groupRoutes.size());
+ for (CamelRouteTO route : groupRoutes) {
assertNotNull(route.getContent());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
index 27fb19b..3277305 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
@@ -41,7 +41,7 @@ import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.ConfTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.ClientExceptionType;
@@ -194,16 +194,17 @@ public class ConfigurationITCase extends AbstractITCase {
membershipKey.setType(AttrSchemaType.String);
createSchema(AttributableType.MEMBERSHIP, SchemaType.PLAIN, membershipKey);
- PlainSchemaTO roleKey = new PlainSchemaTO();
- roleKey.setKey("roleKey" + getUUIDString());
- roleKey.setType(AttrSchemaType.String);
- createSchema(AttributableType.ROLE, SchemaType.PLAIN, roleKey);
+ PlainSchemaTO groupKey = new PlainSchemaTO();
+ groupKey.setKey("group"
+ + "Key" + getUUIDString());
+ groupKey.setType(AttrSchemaType.String);
+ createSchema(AttributableType.GROUP, SchemaType.PLAIN, groupKey);
- RoleTO roleTO = new RoleTO();
- roleTO.setName("aRole" + getUUIDString());
- roleTO.getMPlainAttrTemplates().add(membershipKey.getKey());
- roleTO.getRPlainAttrTemplates().add(roleKey.getKey());
- roleTO = createRole(roleTO);
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName("aGroup" + getUUIDString());
+ groupTO.getMPlainAttrTemplates().add(membershipKey.getKey());
+ groupTO.getGPlainAttrTemplates().add(groupKey.getKey());
+ groupTO = createGroup(groupTO);
try {
Response response = configurationService.export();
@@ -219,11 +220,11 @@ public class ConfigurationITCase extends AbstractITCase {
assertFalse(configExport.isEmpty());
assertTrue(configExport.length() > 1000);
- String[] result = substringsBetween(configExport, "<RPLAINATTRTEMPLATE", "/>");
+ String[] result = substringsBetween(configExport, "<GPLAINATTRTEMPLATE", "/>");
assertNotNull(result);
boolean rattrExists = false;
for (String entry : result) {
- if (entry.contains(roleKey.getKey())) {
+ if (entry.contains(groupKey.getKey())) {
rattrExists = true;
}
}
@@ -239,7 +240,7 @@ public class ConfigurationITCase extends AbstractITCase {
}
assertTrue(mattrExists);
} finally {
- deleteRole(roleTO.getKey());
+ deleteGroup(groupTO.getKey());
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DerSchemaITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DerSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DerSchemaITCase.java
index a5c14ad..adbcdf7 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DerSchemaITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DerSchemaITCase.java
@@ -71,19 +71,19 @@ public class DerSchemaITCase extends AbstractITCase {
@Test
public void delete() {
- DerSchemaTO schema = schemaService.read(AttributableType.ROLE, SchemaType.DERIVED, "rderiveddata");
+ DerSchemaTO schema = schemaService.read(AttributableType.GROUP, SchemaType.DERIVED, "rderiveddata");
assertNotNull(schema);
- schemaService.delete(AttributableType.ROLE, SchemaType.DERIVED, schema.getKey());
+ schemaService.delete(AttributableType.GROUP, SchemaType.DERIVED, schema.getKey());
try {
- schemaService.read(AttributableType.ROLE, SchemaType.DERIVED, "rderiveddata");
+ schemaService.read(AttributableType.GROUP, SchemaType.DERIVED, "rderiveddata");
fail();
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.NotFound, e.getType());
} finally {
// Recreate schema to make test re-runnable
- schema = createSchema(AttributableType.ROLE, SchemaType.DERIVED, schema);
+ schema = createSchema(AttributableType.GROUP, SchemaType.DERIVED, schema);
assertNotNull(schema);
}
}
@@ -113,11 +113,11 @@ public class DerSchemaITCase extends AbstractITCase {
@Test
public void issueSYNCOPE323() {
- DerSchemaTO actual = schemaService.read(AttributableType.ROLE, SchemaType.DERIVED, "rderiveddata");
+ DerSchemaTO actual = schemaService.read(AttributableType.GROUP, SchemaType.DERIVED, "rderiveddata");
assertNotNull(actual);
try {
- createSchema(AttributableType.ROLE, SchemaType.DERIVED, actual);
+ createSchema(AttributableType.GROUP, SchemaType.DERIVED, actual);
fail();
} catch (SyncopeClientException e) {
assertEquals(Response.Status.CONFLICT, e.getType().getResponseStatus());
@@ -126,7 +126,7 @@ public class DerSchemaITCase extends AbstractITCase {
actual.setKey(null);
try {
- createSchema(AttributableType.ROLE, SchemaType.DERIVED, actual);
+ createSchema(AttributableType.GROUP, SchemaType.DERIVED, actual);
fail();
} catch (SyncopeClientException e) {
assertEquals(Response.Status.BAD_REQUEST, e.getType().getResponseStatus());
@@ -141,7 +141,7 @@ public class DerSchemaITCase extends AbstractITCase {
schema.setExpression("derived_sx + '_' + derived_dx");
try {
- createSchema(AttributableType.ROLE, SchemaType.DERIVED, schema);
+ createSchema(AttributableType.GROUP, SchemaType.DERIVED, schema);
fail();
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidDerSchema, e.getType());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
new file mode 100644
index 0000000..edbb5e1
--- /dev/null
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
@@ -0,0 +1,887 @@
+/*
+ * 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.fit.core.reference;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.AccessControlException;
+import java.util.List;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.ws.rs.core.Response;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.mod.ReferenceMod;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.MappingItemTO;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.ResourceTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
+import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.common.lib.wrap.ResourceName;
+import org.apache.syncope.common.rest.api.CollectionWrapper;
+import org.apache.syncope.common.rest.api.Preference;
+import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.service.GroupService;
+import org.identityconnectors.framework.common.objects.Name;
+import org.junit.FixMethodOrder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.JVM)
+public class GroupITCase extends AbstractITCase {
+
+ private GroupTO buildBasicGroupTO(final String name) {
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName(name + getUUIDString());
+ groupTO.setParent(8L);
+ return groupTO;
+ }
+
+ private GroupTO buildGroupTO(final String name) {
+ GroupTO groupTO = buildBasicGroupTO(name);
+
+ // verify inheritance password and account policies
+ groupTO.setInheritAccountPolicy(false);
+ // not inherited so setter execution shouldn't be ignored
+ groupTO.setAccountPolicy(6L);
+
+ groupTO.setInheritPasswordPolicy(true);
+ // inherited so setter execution should be ignored
+ groupTO.setPasswordPolicy(2L);
+
+ groupTO.getGPlainAttrTemplates().add("icon");
+ groupTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
+
+ groupTO.getResources().add(RESOURCE_NAME_LDAP);
+ return groupTO;
+ }
+
+ @Test
+ public void createWithException() {
+ GroupTO newGroupTO = new GroupTO();
+ newGroupTO.getPlainAttrs().add(attrTO("attr1", "value1"));
+
+ try {
+ createGroup(newGroupTO);
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(ClientExceptionType.InvalidGroup, e.getType());
+ }
+ }
+
+ @Test
+ @Ignore
+ public void create() {
+ GroupTO groupTO = buildGroupTO("lastGroup");
+ groupTO.getGVirAttrTemplates().add("rvirtualdata");
+ groupTO.getVirAttrs().add(attrTO("rvirtualdata", "rvirtualvalue"));
+ groupTO.setGroupOwner(8L);
+
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
+
+ assertNotNull(groupTO.getVirAttrMap());
+ assertNotNull(groupTO.getVirAttrMap().get("rvirtualdata").getValues());
+ assertFalse(groupTO.getVirAttrMap().get("rvirtualdata").getValues().isEmpty());
+ assertEquals("rvirtualvalue", groupTO.getVirAttrMap().get("rvirtualdata").getValues().get(0));
+
+ assertNotNull(groupTO.getAccountPolicy());
+ assertEquals(6L, (long) groupTO.getAccountPolicy());
+
+ assertNotNull(groupTO.getPasswordPolicy());
+ assertEquals(4L, (long) groupTO.getPasswordPolicy());
+
+ assertTrue(groupTO.getResources().contains(RESOURCE_NAME_LDAP));
+
+ ConnObjectTO connObjectTO =
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, groupTO.getKey());
+ assertNotNull(connObjectTO);
+ assertNotNull(connObjectTO.getPlainAttrMap().get("owner"));
+
+ // SYNCOPE-515: remove ownership
+ final GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupTO.getKey());
+ groupMod.setGroupOwner(new ReferenceMod());
+
+ assertNull(updateGroup(groupMod).getGroupOwner());
+ }
+
+ @Test
+ public void createWithPasswordPolicy() {
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName("groupWithPassword" + getUUIDString());
+ groupTO.setParent(8L);
+ groupTO.setPasswordPolicy(4L);
+
+ GroupTO actual = createGroup(groupTO);
+ assertNotNull(actual);
+
+ actual = groupService.read(actual.getKey());
+ assertNotNull(actual);
+ assertNotNull(actual.getPasswordPolicy());
+ assertEquals(4L, (long) actual.getPasswordPolicy());
+ }
+
+ @Test
+ public void delete() {
+ try {
+ groupService.delete(0L);
+ } catch (SyncopeClientException e) {
+ assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
+ }
+
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName("toBeDeleted" + getUUIDString());
+ groupTO.setParent(8L);
+
+ groupTO.getResources().add(RESOURCE_NAME_LDAP);
+
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
+
+ GroupTO deletedGroup = deleteGroup(groupTO.getKey());
+ assertNotNull(deletedGroup);
+
+ try {
+ groupService.read(deletedGroup.getKey());
+ } catch (SyncopeClientException e) {
+ assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
+ }
+ }
+
+ @Test
+ public void list() {
+ PagedResult<GroupTO> groupTOs = groupService.list();
+ assertNotNull(groupTOs);
+ assertTrue(groupTOs.getResult().size() >= 8);
+ for (GroupTO groupTO : groupTOs.getResult()) {
+ assertNotNull(groupTO);
+ }
+ }
+
+ @Test
+ public void parent() {
+ GroupTO groupTO = groupService.parent(7L);
+
+ assertNotNull(groupTO);
+ assertEquals(groupTO.getKey(), 6L);
+ }
+
+ @Test
+ public void read() {
+ GroupTO groupTO = groupService.read(1L);
+
+ assertNotNull(groupTO);
+ assertNotNull(groupTO.getPlainAttrs());
+ assertFalse(groupTO.getPlainAttrs().isEmpty());
+ }
+
+ @Test
+ public void selfRead() {
+ UserTO userTO = userService.read(1L);
+ assertNotNull(userTO);
+
+ assertTrue(userTO.getMembershipMap().containsKey(1L));
+ assertFalse(userTO.getMembershipMap().containsKey(3L));
+
+ GroupService groupService2 = clientFactory.create("rossini", ADMIN_PWD).getService(GroupService.class);
+
+ try {
+ groupService2.readSelf(3L);
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(ClientExceptionType.UnauthorizedGroup, e.getType());
+ }
+
+ GroupTO groupTO = groupService2.readSelf(1L);
+ assertNotNull(groupTO);
+ assertNotNull(groupTO.getPlainAttrs());
+ assertFalse(groupTO.getPlainAttrs().isEmpty());
+ }
+
+ @Test
+ public void update() {
+ GroupTO groupTO = buildGroupTO("latestGroup" + getUUIDString());
+ groupTO.getGPlainAttrTemplates().add("show");
+ groupTO = createGroup(groupTO);
+
+ assertEquals(1, groupTO.getPlainAttrs().size());
+
+ assertNotNull(groupTO.getAccountPolicy());
+ assertEquals(6L, (long) groupTO.getAccountPolicy());
+
+ assertNotNull(groupTO.getPasswordPolicy());
+ assertEquals(4L, (long) groupTO.getPasswordPolicy());
+
+ GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupTO.getKey());
+ String modName = "finalGroup" + getUUIDString();
+ groupMod.setName(modName);
+ groupMod.getPlainAttrsToUpdate().add(attrMod("show", "FALSE"));
+
+ // change password policy inheritance
+ groupMod.setInheritPasswordPolicy(Boolean.FALSE);
+
+ groupTO = updateGroup(groupMod);
+
+ assertEquals(modName, groupTO.getName());
+ assertEquals(2, groupTO.getPlainAttrs().size());
+
+ // changes ignored because not requested (null ReferenceMod)
+ assertNotNull(groupTO.getAccountPolicy());
+ assertEquals(6L, (long) groupTO.getAccountPolicy());
+
+ // password policy null because not inherited
+ assertNull(groupTO.getPasswordPolicy());
+ }
+
+ @Test
+ public void updateRemovingVirAttribute() {
+ GroupTO groupTO = buildBasicGroupTO("withvirtual" + getUUIDString());
+ groupTO.getGVirAttrTemplates().add("rvirtualdata");
+ groupTO.getVirAttrs().add(attrTO("rvirtualdata", null));
+
+ groupTO = createGroup(groupTO);
+
+ assertNotNull(groupTO);
+ assertEquals(1, groupTO.getVirAttrs().size());
+
+ final GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupTO.getKey());
+ groupMod.getVirAttrsToRemove().add("rvirtualdata");
+
+ groupTO = updateGroup(groupMod);
+ assertNotNull(groupTO);
+ assertTrue(groupTO.getVirAttrs().isEmpty());
+ }
+
+ @Test
+ public void updateRemovingDerAttribute() {
+ GroupTO groupTO = buildBasicGroupTO("withderived" + getUUIDString());
+ groupTO.getGDerAttrTemplates().add("rderivedschema");
+ groupTO.getDerAttrs().add(attrTO("rderivedschema", null));
+
+ groupTO = createGroup(groupTO);
+
+ assertNotNull(groupTO);
+ assertEquals(1, groupTO.getDerAttrs().size());
+
+ final GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupTO.getKey());
+ groupMod.getDerAttrsToRemove().add("rderivedschema");
+
+ groupTO = updateGroup(groupMod);
+ assertNotNull(groupTO);
+ assertTrue(groupTO.getDerAttrs().isEmpty());
+ }
+
+ @Test
+ public void updateAsGroupOwner() {
+ // 1. read group as admin
+ GroupTO groupTO = groupService.read(7L);
+
+ // issue SYNCOPE-15
+ assertNotNull(groupTO.getCreationDate());
+ assertNotNull(groupTO.getLastChangeDate());
+ assertEquals("admin", groupTO.getCreator());
+ assertEquals("admin", groupTO.getLastModifier());
+
+ // 2. prepare update
+ GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupTO.getKey());
+ groupMod.setName("Managing Director");
+
+ // 3. try to update as verdi, not owner of group 7 - fail
+ GroupService groupService2 = clientFactory.create("verdi", ADMIN_PWD).getService(GroupService.class);
+
+ try {
+ groupService2.update(groupMod.getKey(), groupMod);
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(Response.Status.UNAUTHORIZED, e.getType().getResponseStatus());
+ } catch (AccessControlException e) {
+ assertNotNull(e);
+ }
+
+ // 4. update as puccini, owner of group 7 because owner of group 6 with inheritance - success
+ GroupService groupService3 = clientFactory.create("puccini", ADMIN_PWD).getService(GroupService.class);
+
+ groupTO = groupService3.update(groupMod.getKey(), groupMod).readEntity(GroupTO.class);
+ assertEquals("Managing Director", groupTO.getName());
+
+ // issue SYNCOPE-15
+ assertNotNull(groupTO.getCreationDate());
+ assertNotNull(groupTO.getLastChangeDate());
+ assertEquals("admin", groupTO.getCreator());
+ assertEquals("puccini", groupTO.getLastModifier());
+ assertTrue(groupTO.getCreationDate().before(groupTO.getLastChangeDate()));
+ }
+
+ /**
+ * Group rename used to fail in case of parent null.
+ */
+ @Test
+ public void issue178() {
+ GroupTO groupTO = new GroupTO();
+ String groupName = "torename" + getUUIDString();
+ groupTO.setName(groupName);
+
+ GroupTO actual = createGroup(groupTO);
+
+ assertNotNull(actual);
+ assertEquals(groupName, actual.getName());
+ assertEquals(0L, actual.getParent());
+
+ GroupMod groupMod = new GroupMod();
+ groupMod.setKey(actual.getKey());
+ String renamedGroup = "renamed" + getUUIDString();
+ groupMod.setName(renamedGroup);
+
+ actual = updateGroup(groupMod);
+ assertNotNull(actual);
+ assertEquals(renamedGroup, actual.getName());
+ assertEquals(0L, actual.getParent());
+ }
+
+ @Test
+ public void issueSYNCOPE228() {
+ GroupTO groupTO = buildGroupTO("issueSYNCOPE228");
+ groupTO.getEntitlements().add("USER_READ");
+ groupTO.getEntitlements().add("SCHEMA_READ");
+
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
+ assertNotNull(groupTO.getEntitlements());
+ assertFalse(groupTO.getEntitlements().isEmpty());
+
+ List<String> entitlements = groupTO.getEntitlements();
+
+ GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupTO.getKey());
+ groupMod.setInheritDerAttrs(Boolean.TRUE);
+
+ groupTO = updateGroup(groupMod);
+ assertNotNull(groupTO);
+ assertEquals(entitlements, groupTO.getEntitlements());
+
+ groupMod = new GroupMod();
+ groupMod.setKey(groupTO.getKey());
+ groupMod.setModEntitlements(true);
+ groupMod.getEntitlements().clear();
+
+ groupTO = updateGroup(groupMod);
+ assertNotNull(groupTO);
+ assertTrue(groupTO.getEntitlements().isEmpty());
+ }
+
+ @Test
+ public void unlink() {
+ GroupTO actual = createGroup(buildGroupTO("unlink"));
+ assertNotNull(actual);
+
+ assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey()));
+
+ assertNotNull(groupService.bulkDeassociation(actual.getKey(),
+ ResourceDeassociationActionType.UNLINK,
+ CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
+ readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertNotNull(actual);
+ assertTrue(actual.getResources().isEmpty());
+
+ assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey()));
+ }
+
+ @Test
+ public void link() {
+ GroupTO groupTO = buildGroupTO("link");
+ groupTO.getResources().clear();
+
+ GroupTO actual = createGroup(groupTO);
+ assertNotNull(actual);
+
+ try {
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+
+ assertNotNull(groupService.bulkAssociation(actual.getKey(),
+ ResourceAssociationActionType.LINK,
+ CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
+ readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertFalse(actual.getResources().isEmpty());
+
+ try {
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+ }
+
+ @Test
+ public void unassign() {
+ GroupTO actual = createGroup(buildGroupTO("unassign"));
+ assertNotNull(actual);
+
+ assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey()));
+
+ assertNotNull(groupService.bulkDeassociation(actual.getKey(),
+ ResourceDeassociationActionType.UNASSIGN,
+ CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
+ readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertNotNull(actual);
+ assertTrue(actual.getResources().isEmpty());
+
+ try {
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+ }
+
+ @Test
+ public void assign() {
+ GroupTO groupTO = buildGroupTO("assign");
+ groupTO.getResources().clear();
+
+ GroupTO actual = createGroup(groupTO);
+ assertNotNull(actual);
+
+ try {
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+
+ assertNotNull(groupService.bulkAssociation(actual.getKey(),
+ ResourceAssociationActionType.ASSIGN,
+ CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
+ readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertFalse(actual.getResources().isEmpty());
+ assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey()));
+ }
+
+ @Test
+ public void deprovision() {
+ GroupTO actual = createGroup(buildGroupTO("deprovision"));
+ assertNotNull(actual);
+
+ assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey()));
+
+ assertNotNull(groupService.bulkDeassociation(actual.getKey(),
+ ResourceDeassociationActionType.DEPROVISION,
+ CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
+ readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertNotNull(actual);
+ assertFalse(actual.getResources().isEmpty());
+
+ try {
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+ }
+
+ @Test
+ public void provision() {
+ GroupTO groupTO = buildGroupTO("assign");
+ groupTO.getResources().clear();
+
+ GroupTO actual = createGroup(groupTO);
+ assertNotNull(actual);
+
+ try {
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+
+ assertNotNull(groupService.bulkAssociation(actual.getKey(),
+ ResourceAssociationActionType.PROVISION,
+ CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
+ readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertTrue(actual.getResources().isEmpty());
+
+ assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey()));
+ }
+
+ @Test
+ public void deprovisionUnlinked() {
+ GroupTO groupTO = buildGroupTO("assign");
+ groupTO.getResources().clear();
+
+ GroupTO actual = createGroup(groupTO);
+ assertNotNull(actual);
+
+ try {
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+
+ assertNotNull(groupService.bulkAssociation(actual.getKey(),
+ ResourceAssociationActionType.PROVISION,
+ CollectionWrapper.wrap("resource-ldap", ResourceName.class)).
+ readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertTrue(actual.getResources().isEmpty());
+
+ assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey()));
+
+ assertNotNull(groupService.bulkDeassociation(actual.getKey(),
+ ResourceDeassociationActionType.DEPROVISION,
+ CollectionWrapper.wrap(RESOURCE_NAME_LDAP, ResourceName.class)).
+ readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertNotNull(actual);
+ assertTrue(actual.getResources().isEmpty());
+
+ try {
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+ }
+
+ @Test
+ public void createWithMandatorySchemaNotTemplate() {
+ // 1. create a group mandatory schema
+ PlainSchemaTO badge = new PlainSchemaTO();
+ badge.setKey("badge");
+ badge.setMandatoryCondition("true");
+ schemaService.create(AttributableType.GROUP, SchemaType.PLAIN, badge);
+
+ // 2. create a group *without* an attribute for that schema: it works
+ GroupTO groupTO = buildGroupTO("lastGroup");
+ assertFalse(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
+ assertFalse(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
+
+ // 3. add a template for badge to the group just created -
+ // failure since no values are provided and it is mandatory
+ GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupTO.getKey());
+ groupMod.setModRAttrTemplates(true);
+ groupMod.getRPlainAttrTemplates().add("badge");
+
+ try {
+ updateGroup(groupMod);
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
+ }
+
+ // 4. also add an actual attribute for badge - it will work
+ groupMod.getPlainAttrsToUpdate().add(attrMod(badge.getKey(), "xxxxxxxxxx"));
+
+ groupTO = updateGroup(groupMod);
+ assertNotNull(groupTO);
+ assertTrue(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
+ }
+
+ @Test
+ public void anonymous() {
+ GroupService unauthenticated = clientFactory.createAnonymous().getService(GroupService.class);
+ try {
+ unauthenticated.list();
+ fail();
+ } catch (AccessControlException e) {
+ assertNotNull(e);
+ }
+
+ GroupService anonymous = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(GroupService.class);
+ assertFalse(anonymous.list().getResult().isEmpty());
+ }
+
+ @Test
+ public void noContent() throws IOException {
+ SyncopeClient noContentclient = clientFactory.create(ADMIN_UNAME, ADMIN_PWD);
+ GroupService noContentService = noContentclient.prefer(GroupService.class, Preference.RETURN_NO_CONTENT);
+
+ GroupTO group = buildGroupTO("noContent");
+
+ Response response = noContentService.create(group);
+ assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
+ assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
+ assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
+
+ group = getObject(response.getLocation(), GroupService.class, GroupTO.class);
+ assertNotNull(group);
+
+ GroupMod groupMod = new GroupMod();
+ groupMod.getPlainAttrsToUpdate().add(attrMod("badge", "xxxxxxxxxx"));
+
+ response = noContentService.update(group.getKey(), groupMod);
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+ assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
+ assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
+
+ response = noContentService.delete(group.getKey());
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+ assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
+ assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
+ }
+
+ @Test
+ public void issueSYNCOPE455() {
+ final String parentName = "issueSYNCOPE455-PGroup";
+ final String childName = "issueSYNCOPE455-CGroup";
+
+ // 1. create parent group
+ GroupTO parent = buildBasicGroupTO(parentName);
+ parent.getResources().add(RESOURCE_NAME_LDAP);
+
+ parent = createGroup(parent);
+ assertTrue(parent.getResources().contains(RESOURCE_NAME_LDAP));
+
+ final ConnObjectTO parentRemoteObject =
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, parent.getKey());
+ assertNotNull(parentRemoteObject);
+ assertNotNull(getLdapRemoteObject(parentRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
+
+ // 2. create child group
+ GroupTO child = buildBasicGroupTO(childName);
+ child.getResources().add(RESOURCE_NAME_LDAP);
+ child.setParent(parent.getKey());
+
+ child = createGroup(child);
+ assertTrue(child.getResources().contains(RESOURCE_NAME_LDAP));
+
+ final ConnObjectTO childRemoteObject =
+ resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, child.getKey());
+ assertNotNull(childRemoteObject);
+ assertNotNull(getLdapRemoteObject(childRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
+
+ // 3. remove parent group
+ groupService.delete(parent.getKey());
+
+ // 4. asserts for issue 455
+ try {
+ groupService.read(parent.getKey());
+ fail();
+ } catch (SyncopeClientException scce) {
+ assertNotNull(scce);
+ }
+
+ try {
+ groupService.read(child.getKey());
+ fail();
+ } catch (SyncopeClientException scce) {
+ assertNotNull(scce);
+ }
+
+ assertNull(getLdapRemoteObject(parentRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
+ assertNull(getLdapRemoteObject(childRemoteObject.getPlainAttrMap().get(Name.NAME).getValues().get(0)));
+ }
+
+ @Test
+ public void issueSYNCOPE543() {
+ final String ancestorName = "issueSYNCOPE543-AGroup";
+ final String parentName = "issueSYNCOPE543-PGroup";
+ final String childName = "issueSYNCOPE543-CGroup";
+
+ // 1. create ancestor group
+ GroupTO ancestor = buildBasicGroupTO(ancestorName);
+ ancestor.setParent(0L);
+ ancestor.getGPlainAttrTemplates().add("icon");
+ ancestor.getPlainAttrs().add(attrTO("icon", "ancestorIcon"));
+ ancestor = createGroup(ancestor);
+ assertEquals("ancestorIcon", ancestor.getPlainAttrMap().get("icon").getValues().get(0));
+
+ // 2. create parent group
+ GroupTO parent = buildBasicGroupTO(parentName);
+ parent.setParent(ancestor.getKey());
+ parent.getGPlainAttrTemplates().add("icon");
+ parent.getPlainAttrs().add(attrTO("icon", "parentIcon"));
+ parent = createGroup(parent);
+ assertEquals("parentIcon", parent.getPlainAttrMap().get("icon").getValues().get(0));
+
+ // 3. create child group
+ GroupTO child = buildBasicGroupTO(childName);
+ child.setParent(parent.getKey());
+ child.getGPlainAttrTemplates().add("icon");
+ child.getPlainAttrs().add(attrTO("icon", "childIcon"));
+ child = createGroup(child);
+ assertEquals("childIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
+
+ final GroupMod groupChildMod = new GroupMod();
+ groupChildMod.setKey(child.getKey());
+ groupChildMod.setInheritPlainAttrs(Boolean.TRUE);
+ updateGroup(groupChildMod);
+
+ child = groupService.read(child.getKey());
+ assertNotNull(child);
+ assertNotNull(child.getPlainAttrMap().get("icon").getValues());
+ assertEquals("parentIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
+
+ final GroupMod groupParentMod = new GroupMod();
+ groupParentMod.setKey(parent.getKey());
+ groupParentMod.setInheritPlainAttrs(Boolean.TRUE);
+ updateGroup(groupParentMod);
+
+ child = groupService.read(child.getKey());
+ assertNotNull(child);
+ assertNotNull(child.getPlainAttrMap().get("icon").getValues());
+ assertEquals("ancestorIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
+
+ parent = groupService.read(parent.getKey());
+ assertNotNull(parent);
+ assertNotNull(parent.getPlainAttrMap().get("icon").getValues());
+ assertEquals("ancestorIcon", parent.getPlainAttrMap().get("icon").getValues().get(0));
+
+ groupParentMod.setInheritPlainAttrs(Boolean.FALSE);
+ updateGroup(groupParentMod);
+
+ child = groupService.read(child.getKey());
+ assertNotNull(child);
+ assertNotNull(child.getPlainAttrMap().get("icon").getValues());
+ assertEquals("parentIcon", child.getPlainAttrMap().get("icon").getValues().get(0));
+ }
+
+ @Test
+ public void issueSYNCOPE632() {
+ GroupTO groupTO = null;
+ try {
+ // 1. create new LDAP resource having account id mapped to a derived attribute
+ ResourceTO newLDAP = resourceService.read(RESOURCE_NAME_LDAP);
+ newLDAP.setKey("new-ldap");
+ newLDAP.setPropagationPrimary(true);
+ MappingItemTO accountId = newLDAP.getGmapping().getAccountIdItem();
+ accountId.setIntMappingType(IntMappingType.GroupDerivedSchema);
+ accountId.setIntAttrName("displayProperty");
+ newLDAP.getGmapping().setAccountIdItem(accountId);
+ newLDAP.getGmapping().setAccountLink("'cn=' + displayProperty + ',ou=groups,o=isp'");
+
+ MappingItemTO description = new MappingItemTO();
+ description.setIntMappingType(IntMappingType.GroupId);
+ description.setExtAttrName("description");
+ description.setPurpose(MappingPurpose.BOTH);
+ newLDAP.getGmapping().addItem(description);
+
+ newLDAP = createResource(newLDAP);
+ assertNotNull(newLDAP);
+
+ // 2. create a group and give the resource created above
+ groupTO = buildGroupTO("lastGroup");
+ groupTO.getGPlainAttrTemplates().add("icon");
+ groupTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
+ groupTO.getGPlainAttrTemplates().add("show");
+ groupTO.getPlainAttrs().add(attrTO("show", "true"));
+ groupTO.getGDerAttrTemplates().add("displayProperty");
+ groupTO.getDerAttrs().add(attrTO("displayProperty", null));
+ groupTO.getResources().clear();
+ groupTO.getResources().add("new-ldap");
+
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
+
+ // 3. update the group
+ GroupMod groupMod = new GroupMod();
+ groupMod.setKey(groupTO.getKey());
+ groupMod.getPlainAttrsToRemove().add("icon");
+ groupMod.getPlainAttrsToUpdate().add(attrMod("icon", "anotherIcon"));
+
+ groupTO = updateGroup(groupMod);
+ assertNotNull(groupTO);
+
+ // 4. check that a single group exists in LDAP for the group created and updated above
+ int entries = 0;
+ DirContext ctx = null;
+ try {
+ ctx = getLdapResourceDirContext(null, null);
+
+ SearchControls ctls = new SearchControls();
+ ctls.setReturningAttributes(new String[] { "*", "+" });
+ ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
+
+ NamingEnumeration<SearchResult> result =
+ ctx.search("ou=groups,o=isp", "(description=" + groupTO.getKey() + ")", ctls);
+ while (result.hasMore()) {
+ result.next();
+ entries++;
+ }
+ } catch (Exception e) {
+ // ignore
+ } finally {
+ if (ctx != null) {
+ try {
+ ctx.close();
+ } catch (NamingException e) {
+ // ignore
+ }
+ }
+ }
+
+ assertEquals(1, entries);
+ } finally {
+ if (groupTO != null) {
+ groupService.delete(groupTO.getKey());
+ }
+ resourceService.delete("new-ldap");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
index 7b5e845..012c6ab 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
@@ -37,7 +37,7 @@ import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.common.rest.api.CollectionWrapper;
import org.apache.syncope.core.logic.ReportLogic;
import org.apache.syncope.core.logic.ResourceLogic;
-import org.apache.syncope.core.logic.RoleLogic;
+import org.apache.syncope.core.logic.GroupLogic;
import org.apache.syncope.core.logic.UserLogic;
import org.junit.FixMethodOrder;
import org.junit.Test;
@@ -143,7 +143,7 @@ public class LoggerITCase extends AbstractITCase {
found = false;
for (EventCategoryTO eventCategoryTO : events) {
- if (RoleLogic.class.getSimpleName().equals(eventCategoryTO.getCategory())) {
+ if (GroupLogic.class.getSimpleName().equals(eventCategoryTO.getCategory())) {
assertEquals(EventCategoryType.REST, eventCategoryTO.getType());
assertTrue(eventCategoryTO.getEvents().contains("create"));
assertTrue(eventCategoryTO.getEvents().contains("list"));
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
index 03a557f..d5c9570 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationITCase.java
@@ -75,7 +75,7 @@ public class NotificationITCase extends AbstractITCase {
@Test
public void create() {
NotificationTO notificationTO = buildNotificationTO();
- notificationTO.setRecipients(SyncopeClient.getUserSearchConditionBuilder().hasRoles(7L).query());
+ notificationTO.setRecipients(SyncopeClient.getUserSearchConditionBuilder().inGroups(7L).query());
Response response = notificationService.create(notificationTO);
NotificationTO actual = getObject(response.getLocation(), NotificationService.class,
@@ -90,7 +90,7 @@ public class NotificationITCase extends AbstractITCase {
@Test
public void update() {
NotificationTO notificationTO = notificationService.read(10L);
- notificationTO.setRecipients(SyncopeClient.getUserSearchConditionBuilder().hasRoles(7L).query());
+ notificationTO.setRecipients(SyncopeClient.getUserSearchConditionBuilder().inGroups(7L).query());
notificationService.update(notificationTO.getKey(), notificationTO);
NotificationTO actual = notificationService.read(notificationTO.getKey());
@@ -155,7 +155,8 @@ public class NotificationITCase extends AbstractITCase {
public void issueSYNCOPE446() {
NotificationTO notificationTO = buildNotificationTO();
notificationTO.getStaticRecipients().add("syncope446@syncope.apache.org");
- notificationTO.setRoleAbout(SyncopeClient.getRoleSearchConditionBuilder().hasEntitlements("ROLE_READ").query());
+ notificationTO.setGroupAbout(
+ SyncopeClient.getGroupSearchConditionBuilder().hasEntitlements("GROUP_READ").query());
NotificationTO actual = null;
try {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
index ee75de9..1fb1a93 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
@@ -109,9 +109,9 @@ public class NotificationTaskITCase extends AbstractTaskITCase {
notification.setTraceLevel(TraceLevel.FAILURES);
notification.getEvents().add("[REST]:[UserLogic]:[]:[create]:[SUCCESS]");
- notification.setUserAbout(SyncopeClient.getUserSearchConditionBuilder().hasRoles(7L).query());
+ notification.setUserAbout(SyncopeClient.getUserSearchConditionBuilder().inGroups(7L).query());
- notification.setRecipients(SyncopeClient.getUserSearchConditionBuilder().hasRoles(8L).query());
+ notification.setRecipients(SyncopeClient.getUserSearchConditionBuilder().inGroups(8L).query());
notification.setSelfAsRecipient(true);
notification.setRecipientAttrName("email");
@@ -130,7 +130,7 @@ public class NotificationTaskITCase extends AbstractTaskITCase {
// 2. create user
UserTO userTO = UserITCase.getUniqueSampleTO("syncope@syncope.apache.org");
MembershipTO membershipTO = new MembershipTO();
- membershipTO.setRoleId(7);
+ membershipTO.setGroupId(7);
userTO.getMemberships().add(membershipTO);
userTO = createUser(userTO);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
index b9d8239..1968206 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
@@ -92,7 +92,7 @@ public class PlainSchemaITCase extends AbstractITCase {
schemaTO.setType(AttrSchemaType.Enum);
try {
- createSchema(AttributableType.ROLE, SchemaType.PLAIN, schemaTO);
+ createSchema(AttributableType.GROUP, SchemaType.PLAIN, schemaTO);
fail("This should not be reacheable");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
@@ -136,7 +136,7 @@ public class PlainSchemaITCase extends AbstractITCase {
schemaTO.setType(AttrSchemaType.Binary);
schemaTO.setMimeType("application/x-x509-ca-cert");
- createSchema(AttributableType.ROLE, SchemaType.PLAIN, schemaTO);
+ createSchema(AttributableType.GROUP, SchemaType.PLAIN, schemaTO);
}
@Test
@@ -163,9 +163,9 @@ public class PlainSchemaITCase extends AbstractITCase {
assertNotNull(schemaTO);
}
- List<PlainSchemaTO> roleSchemas = schemaService.list(AttributableType.ROLE, SchemaType.PLAIN);
- assertFalse(roleSchemas.isEmpty());
- for (PlainSchemaTO schemaTO : roleSchemas) {
+ List<PlainSchemaTO> groupSchemas = schemaService.list(AttributableType.GROUP, SchemaType.PLAIN);
+ assertFalse(groupSchemas.isEmpty());
+ for (PlainSchemaTO schemaTO : groupSchemas) {
assertNotNull(schemaTO);
}
@@ -178,16 +178,16 @@ public class PlainSchemaITCase extends AbstractITCase {
@Test
public void update() {
- PlainSchemaTO schemaTO = schemaService.read(AttributableType.ROLE, SchemaType.PLAIN, "icon");
+ PlainSchemaTO schemaTO = schemaService.read(AttributableType.GROUP, SchemaType.PLAIN, "icon");
assertNotNull(schemaTO);
- schemaService.update(AttributableType.ROLE, SchemaType.PLAIN, schemaTO.getKey(), schemaTO);
- PlainSchemaTO updatedTO = schemaService.read(AttributableType.ROLE, SchemaType.PLAIN, "icon");
+ schemaService.update(AttributableType.GROUP, SchemaType.PLAIN, schemaTO.getKey(), schemaTO);
+ PlainSchemaTO updatedTO = schemaService.read(AttributableType.GROUP, SchemaType.PLAIN, "icon");
assertEquals(schemaTO, updatedTO);
updatedTO.setType(AttrSchemaType.Date);
try {
- schemaService.update(AttributableType.ROLE, SchemaType.PLAIN, schemaTO.getKey(), updatedTO);
+ schemaService.update(AttributableType.GROUP, SchemaType.PLAIN, schemaTO.getKey(), updatedTO);
fail("This should not be reacheable");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
@@ -233,7 +233,7 @@ public class PlainSchemaITCase extends AbstractITCase {
UserTO newUserTO = SerializationUtils.clone(userTO);
MembershipTO membership = new MembershipTO();
- membership.setRoleId(2L);
+ membership.setGroupId(2L);
newUserTO.getMemberships().add(membership);
UserMod userMod = AttributableOperations.diff(newUserTO, userTO);
@@ -266,11 +266,11 @@ public class PlainSchemaITCase extends AbstractITCase {
@Test
public void issueSYNCOPE323() {
- PlainSchemaTO actual = schemaService.read(AttributableType.ROLE, SchemaType.PLAIN, "icon");
+ PlainSchemaTO actual = schemaService.read(AttributableType.GROUP, SchemaType.PLAIN, "icon");
assertNotNull(actual);
try {
- createSchema(AttributableType.ROLE, SchemaType.PLAIN, actual);
+ createSchema(AttributableType.GROUP, SchemaType.PLAIN, actual);
fail();
} catch (SyncopeClientException e) {
assertEquals(Response.Status.CONFLICT, e.getType().getResponseStatus());
@@ -279,7 +279,7 @@ public class PlainSchemaITCase extends AbstractITCase {
actual.setKey(null);
try {
- createSchema(AttributableType.ROLE, SchemaType.PLAIN, actual);
+ createSchema(AttributableType.GROUP, SchemaType.PLAIN, actual);
fail();
} catch (SyncopeClientException e) {
assertEquals(Response.Status.BAD_REQUEST, e.getType().getResponseStatus());
@@ -293,7 +293,7 @@ public class PlainSchemaITCase extends AbstractITCase {
AttrSchemaType.Double);
try {
- createSchema(AttributableType.ROLE, SchemaType.PLAIN, schema);
+ createSchema(AttributableType.GROUP, SchemaType.PLAIN, schema);
fail();
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PolicyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PolicyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PolicyITCase.java
index 409f29d..bdf3f90 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PolicyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PolicyITCase.java
@@ -68,7 +68,7 @@ public class PolicyITCase extends AbstractITCase {
assertNotNull(policyTO);
assertTrue(policyTO.getUsedByResources().isEmpty());
- assertEquals(Arrays.asList(6L, 7L, 10L, 14L), policyTO.getUsedByRoles());
+ assertTrue(policyTO.getUsedByGroups().containsAll(Arrays.asList(6L, 7L, 10L, 14L)));
}
@Test
@@ -77,7 +77,7 @@ public class PolicyITCase extends AbstractITCase {
assertNotNull(policyTO);
assertTrue(policyTO.getUsedByResources().contains(RESOURCE_NAME_NOPROPAGATION));
- assertEquals(Arrays.asList(6L, 7L, 10L, 8L), policyTO.getUsedByRoles());
+ assertTrue(policyTO.getUsedByGroups().containsAll(Arrays.asList(6L, 7L, 10L, 8L)));
}
@Test
@@ -85,7 +85,7 @@ public class PolicyITCase extends AbstractITCase {
SyncPolicyTO policyTO = policyService.read(1L);
assertNotNull(policyTO);
- assertTrue(policyTO.getUsedByRoles().isEmpty());
+ assertTrue(policyTO.getUsedByGroups().isEmpty());
}
@Test
@@ -114,7 +114,7 @@ public class PolicyITCase extends AbstractITCase {
assertEquals(PolicyType.GLOBAL_SYNC, policyTO.getType());
assertFalse(policyTO.getUsedByResources().contains(RESOURCE_NAME_CSV));
assertFalse(policyTO.getUsedByResources().contains(RESOURCE_NAME_WS2));
- assertTrue(policyTO.getUsedByRoles().isEmpty());
+ assertTrue(policyTO.getUsedByGroups().isEmpty());
}
@Test
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
index 3427a1d..76da48c 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
@@ -39,7 +39,7 @@ import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.to.PushTaskTO;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.TaskExecTO;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.AttributableType;
@@ -94,8 +94,8 @@ public class PushTaskITCase extends AbstractTaskITCase {
task.setResource(RESOURCE_NAME_WS2);
task.setUserFilter(
SyncopeClient.getUserSearchConditionBuilder().hasNotResources(RESOURCE_NAME_TESTDB2).query());
- task.setRoleFilter(
- SyncopeClient.getRoleSearchConditionBuilder().isNotNull("cool").query());
+ task.setGroupFilter(
+ SyncopeClient.getGroupSearchConditionBuilder().isNotNull("cool").query());
task.setMatchingRule(MatchingRule.LINK);
final Response response = taskService.create(task);
@@ -107,24 +107,24 @@ public class PushTaskITCase extends AbstractTaskITCase {
assertEquals(task.getKey(), actual.getKey());
assertEquals(task.getJobClassName(), actual.getJobClassName());
assertEquals(task.getUserFilter(), actual.getUserFilter());
- assertEquals(task.getRoleFilter(), actual.getRoleFilter());
+ assertEquals(task.getGroupFilter(), actual.getGroupFilter());
assertEquals(UnmatchingRule.ASSIGN, actual.getUnmatchingRule());
assertEquals(MatchingRule.LINK, actual.getMatchingRule());
}
@Test
- public void pushMatchingUnmatchingRoles() {
- assertFalse(roleService.read(3L).getResources().contains(RESOURCE_NAME_LDAP));
+ public void pushMatchingUnmatchingGroups() {
+ assertFalse(groupService.read(3L).getResources().contains(RESOURCE_NAME_LDAP));
execSyncTask(23L, 50, false);
- assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, 3L));
- assertTrue(roleService.read(3L).getResources().contains(RESOURCE_NAME_LDAP));
+ assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, 3L));
+ assertTrue(groupService.read(3L).getResources().contains(RESOURCE_NAME_LDAP));
execSyncTask(23L, 50, false);
- assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.ROLE, 3L));
- assertFalse(roleService.read(3L).getResources().contains(RESOURCE_NAME_LDAP));
+ assertNotNull(resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.GROUP, 3L));
+ assertFalse(groupService.read(3L).getResources().contains(RESOURCE_NAME_LDAP));
}
@Test
@@ -247,27 +247,27 @@ public class PushTaskITCase extends AbstractTaskITCase {
@Test
public void issueSYNCOPE598() {
- // create a new role schema
+ // create a new group schema
final PlainSchemaTO schemaTO = new PlainSchemaTO();
schemaTO.setKey("LDAPGroupName" + getUUIDString());
schemaTO.setType(AttrSchemaType.String);
schemaTO.setMandatoryCondition("true");
- final PlainSchemaTO newPlainSchemaTO = createSchema(AttributableType.ROLE, SchemaType.PLAIN, schemaTO);
+ final PlainSchemaTO newPlainSchemaTO = createSchema(AttributableType.GROUP, SchemaType.PLAIN, schemaTO);
assertEquals(schemaTO, newPlainSchemaTO);
- // create a new sample role
- RoleTO roleTO = new RoleTO();
- roleTO.setName("all" + getUUIDString());
- roleTO.setParent(8L);
+ // create a new sample group
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName("all" + getUUIDString());
+ groupTO.setParent(8L);
- roleTO.getRPlainAttrTemplates().add(newPlainSchemaTO.getKey());
- roleTO.getPlainAttrs().add(attrTO(newPlainSchemaTO.getKey(), "all"));
+ groupTO.getGPlainAttrTemplates().add(newPlainSchemaTO.getKey());
+ groupTO.getPlainAttrs().add(attrTO(newPlainSchemaTO.getKey(), "all"));
- roleTO = createRole(roleTO);
- assertNotNull(roleTO);
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
- String resourceName = "resource-ldap-roleonly";
+ String resourceName = "resource-ldap-grouponly";
ResourceTO newResourceTO = null;
try {
@@ -311,7 +311,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
final MappingTO rmapping = new MappingTO();
item = new MappingItemTO();
- item.setIntMappingType(IntMappingType.RolePlainSchema);
+ item.setIntMappingType(IntMappingType.GroupPlainSchema);
item.setExtAttrName("cn");
item.setIntAttrName(newPlainSchemaTO.getKey());
item.setAccountid(true);
@@ -320,14 +320,14 @@ public class PushTaskITCase extends AbstractTaskITCase {
rmapping.setAccountLink("'cn=' + " + newPlainSchemaTO.getKey() + " + ',ou=groups,o=isp'");
- resourceTO.setRmapping(rmapping);
+ resourceTO.setGmapping(rmapping);
Response response = resourceService.create(resourceTO);
newResourceTO = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
assertNotNull(newResourceTO);
assertNull(newResourceTO.getUmapping());
- assertNotNull(newResourceTO.getRmapping());
+ assertNotNull(newResourceTO.getGmapping());
// create push task ad-hoc
final PushTaskTO task = new PushTaskTO();
@@ -348,7 +348,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
final TaskExecTO pushExec = execSyncTask(push.getKey(), 50, false);
assertTrue(PropagationTaskExecStatus.valueOf(pushExec.getStatus()).isSuccessful());
} finally {
- roleService.delete(roleTO.getKey());
+ groupService.delete(groupTO.getKey());
if (newResourceTO != null) {
resourceService.delete(resourceName);
}
@@ -363,8 +363,8 @@ public class PushTaskITCase extends AbstractTaskITCase {
task.setResource(RESOURCE_NAME_LDAP);
task.setUserFilter(
SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("_NO_ONE_").query());
- task.setRoleFilter(
- SyncopeClient.getRoleSearchConditionBuilder().is("name").equalTo("citizen").query());
+ task.setGroupFilter(
+ SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("citizen").query());
task.setMatchingRule(MatchingRule.IGNORE);
task.setUnmatchingRule(UnmatchingRule.IGNORE);
@@ -375,8 +375,8 @@ public class PushTaskITCase extends AbstractTaskITCase {
// 2. Create notification
NotificationTO notification = new NotificationTO();
notification.setTraceLevel(TraceLevel.FAILURES);
- notification.getEvents().add("[PushTask]:[role]:[resource-ldap]:[matchingrule_ignore]:[SUCCESS]");
- notification.getEvents().add("[PushTask]:[role]:[resource-ldap]:[unmatchingrule_ignore]:[SUCCESS]");
+ notification.getEvents().add("[PushTask]:[group]:[resource-ldap]:[matchingrule_ignore]:[SUCCESS]");
+ notification.getEvents().add("[PushTask]:[group]:[resource-ldap]:[unmatchingrule_ignore]:[SUCCESS]");
notification.getStaticRecipients().add("issueyncope648@syncope.apache.org");
notification.setSelfAsRecipient(false);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
index f3618d3..90664b0 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
@@ -182,13 +182,13 @@ public class ResourceITCase extends AbstractITCase {
MappingTO rmapping = new MappingTO();
item = new MappingItemTO();
- item.setIntMappingType(IntMappingType.RoleId);
- item.setExtAttrName("roleId");
+ item.setIntMappingType(IntMappingType.GroupId);
+ item.setExtAttrName("groupId");
item.setAccountid(true);
item.setPurpose(MappingPurpose.SYNCHRONIZATION);
rmapping.setAccountIdItem(item);
- resourceTO.setRmapping(rmapping);
+ resourceTO.setGmapping(rmapping);
Response response = resourceService.create(resourceTO);
ResourceTO actual = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
@@ -196,9 +196,9 @@ public class ResourceITCase extends AbstractITCase {
assertNotNull(actual);
assertNotNull(actual.getUmapping());
assertNotNull(actual.getUmapping().getItems());
- assertNotNull(actual.getRmapping());
- assertNotNull(actual.getRmapping().getItems());
- assertEquals(MappingPurpose.SYNCHRONIZATION, actual.getRmapping().getAccountIdItem().getPurpose());
+ assertNotNull(actual.getGmapping());
+ assertNotNull(actual.getGmapping().getItems());
+ assertEquals(MappingPurpose.SYNCHRONIZATION, actual.getGmapping().getAccountIdItem().getPurpose());
assertEquals(MappingPurpose.PROPAGATION, actual.getUmapping().getAccountIdItem().getPurpose());
}
@@ -489,22 +489,22 @@ public class ResourceITCase extends AbstractITCase {
MappingTO mapping = new MappingTO();
MappingItemTO item = new MappingItemTO();
- item.setIntMappingType(IntMappingType.RoleName);
+ item.setIntMappingType(IntMappingType.GroupName);
item.setExtAttrName("cn");
item.setPurpose(MappingPurpose.BOTH);
mapping.setAccountIdItem(item);
item = new MappingItemTO();
- item.setIntMappingType(IntMappingType.RoleOwnerSchema);
+ item.setIntMappingType(IntMappingType.GroupOwnerSchema);
item.setExtAttrName("owner");
item.setPurpose(MappingPurpose.BOTH);
mapping.addItem(item);
- resourceTO.setRmapping(mapping);
+ resourceTO.setGmapping(mapping);
resourceTO = createResource(resourceTO);
assertNotNull(resourceTO);
- assertEquals(2, resourceTO.getRmapping().getItems().size());
+ assertEquals(2, resourceTO.getGmapping().getItems().size());
}
@Test
[41/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
index 029bb27..d9df85f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
@@ -18,12 +18,17 @@
*/
package org.apache.syncope.core.provisioning.java.data;
+import static org.apache.syncope.core.provisioning.java.data.AbstractAttributableDataBinder.LOG;
+
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeClientCompositeException;
import org.apache.syncope.common.lib.SyncopeClientException;
@@ -50,10 +55,12 @@ import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
+import org.apache.syncope.core.misc.security.AuthContextUtils;
import org.apache.syncope.core.misc.security.Encryptor;
import org.apache.syncope.core.misc.spring.BeanUtils;
-import org.apache.syncope.core.misc.ConnObjectUtil;
+import org.apache.syncope.core.misc.ConnObjectUtils;
+import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.entity.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -63,14 +70,18 @@ import org.springframework.transaction.annotation.Transactional;
public class UserDataBinderImpl extends AbstractAttributableDataBinder implements UserDataBinder {
private static final String[] IGNORE_USER_PROPERTIES = {
- "memberships", "plainAttrs", "derAttrs", "virAttrs", "resources", "securityQuestion", "securityAnswer"
+ "realm", "roles", "memberships", "plainAttrs", "derAttrs", "virAttrs", "resources",
+ "securityQuestion", "securityAnswer"
};
@Autowired
+ private RoleDAO roleDAO;
+
+ @Autowired
private ConfDAO confDAO;
@Autowired
- private ConnObjectUtil connObjectUtil;
+ private ConnObjectUtils connObjectUtils;
@Autowired
private SecurityQuestionDAO securityQuestionDAO;
@@ -88,7 +99,7 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
public UserTO getAuthenticatedUserTO() {
final UserTO authUserTO;
- final String authUsername = AuthContextUtil.getAuthenticatedUsername();
+ final String authUsername = AuthContextUtils.getAuthenticatedUsername();
if (anonymousUser.equals(authUsername)) {
authUserTO = new UserTO();
authUserTO.setKey(-2);
@@ -117,9 +128,7 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
return encryptor.verify(password, user.getCipherAlgorithm(), user.getPassword());
}
- private void setPassword(final User user, final String password,
- final SyncopeClientCompositeException scce) {
-
+ private void setPassword(final User user, final String password, final SyncopeClientCompositeException scce) {
try {
final String algorithm = confDAO.find(
"password.cipher.algorithm", CipherAlgorithm.AES.name()).getValues().get(0).getStringValue();
@@ -139,10 +148,20 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
public void create(final User user, final UserTO userTO, final boolean storePassword) {
SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
+ // roles
+ for (Long roleKey : userTO.getRoles()) {
+ Role role = roleDAO.find(roleKey);
+ if (role == null) {
+ LOG.warn("Ignoring unknown role with id {}", roleKey);
+ } else {
+ user.addRole(role);
+ }
+ }
+
// memberships
Group group;
for (MembershipTO membershipTO : userTO.getMemberships()) {
- group = groupDAO.find(membershipTO.getGroupId());
+ group = groupDAO.find(membershipTO.getGroupKey());
if (group == null) {
if (LOG.isDebugEnabled()) {
@@ -163,12 +182,12 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
user.addMembership(membership);
}
- fill(membership, membershipTO, attrUtilFactory.getInstance(AttributableType.MEMBERSHIP), scce);
+ fill(membership, membershipTO, attrUtilsFactory.getInstance(AttributableType.MEMBERSHIP), scce);
}
}
- // attributes, derived attributes, virtual attributes and resources
- fill(user, userTO, attrUtilFactory.getInstance(AttributableType.USER), scce);
+ // realm, attributes, derived attributes, virtual attributes and resources
+ fill(user, userTO, attrUtilsFactory.getInstance(AttributableType.USER), scce);
// set password
if (StringUtils.isBlank(userTO.getPassword()) || !storePassword) {
@@ -201,7 +220,7 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
@Override
public PropagationByResource update(final User toBeUpdated, final UserMod userMod) {
// Re-merge any pending change from workflow tasks
- User user = userDAO.save(toBeUpdated);
+ final User user = userDAO.save(toBeUpdated);
PropagationByResource propByRes = new PropagationByResource();
@@ -212,6 +231,9 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
// fetch account ids before update
Map<String, String> oldAccountIds = getAccountIds(user, AttributableType.USER);
+ // realm
+ setRealm(user, userMod);
+
// password
if (StringUtils.isNotBlank(userMod.getPassword())) {
setPassword(user, userMod.getPassword(), scce);
@@ -224,6 +246,7 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
propByRes.addAll(ResourceOperation.UPDATE, currentResources);
user.setUsername(userMod.getUsername());
+ AuthContextUtils.updateAuthenticatedUsername(userMod.getUsername());
}
// security question / answer:
@@ -241,25 +264,55 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
}
}
+ // roles
+ CollectionUtils.forAllDo(userMod.getRolesToRemove(), new Closure<Long>() {
+
+ @Override
+ public void execute(final Long roleKey) {
+ Role role = roleDAO.find(roleKey);
+ if (role == null) {
+ LOG.warn("Ignoring unknown role with id {}", roleKey);
+ } else {
+ user.removeRole(role);
+ }
+ }
+ });
+ CollectionUtils.forAllDo(userMod.getRolesToAdd(), new Closure<Long>() {
+
+ @Override
+ public void execute(final Long roleKey) {
+ Role role = roleDAO.find(roleKey);
+ if (role == null) {
+ LOG.warn("Ignoring unknown role with id {}", roleKey);
+ } else {
+ user.addRole(role);
+ }
+ }
+ });
+
// attributes, derived attributes, virtual attributes and resources
- propByRes.merge(fill(user, userMod, attrUtilFactory.getInstance(AttributableType.USER), scce));
+ propByRes.merge(fill(user, userMod, attrUtilsFactory.getInstance(AttributableType.USER), scce));
// store the group ids of membership required to be added
- Set<Long> membershipToBeAddedGroupKeys = new HashSet<>();
- for (MembershipMod membToBeAdded : userMod.getMembershipsToAdd()) {
- membershipToBeAddedGroupKeys.add(membToBeAdded.getGroup());
- }
+ Set<Long> membershipToBeAddedGroupKeys = CollectionUtils.collect(userMod.getMembershipsToAdd(),
+ new Transformer<MembershipMod, Long>() {
+
+ @Override
+ public Long transform(final MembershipMod membToBeAdded) {
+ return membToBeAdded.getGroup();
+ }
+ }, new HashSet<Long>());
final Set<String> toBeDeprovisioned = new HashSet<>();
final Set<String> toBeProvisioned = new HashSet<>();
// memberships to be removed
- for (Long membershipId : userMod.getMembershipsToRemove()) {
- LOG.debug("Membership to be removed: {}", membershipId);
+ for (Long membKey : userMod.getMembershipsToRemove()) {
+ LOG.debug("Membership to be removed: {}", membKey);
- Membership membership = membershipDAO.find(membershipId);
+ Membership membership = membershipDAO.find(membKey);
if (membership == null) {
- LOG.debug("Invalid membership id specified to be removed: {}", membershipId);
+ LOG.warn("Invalid membership id specified to be removed: {}", membKey);
} else {
if (!membershipToBeAddedGroupKeys.contains(membership.getGroup().getKey())) {
toBeDeprovisioned.addAll(membership.getGroup().getResourceNames());
@@ -271,36 +324,36 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
// some modifications compared to the one stored in the DB
membership = user.getMembership(membership.getGroup().getKey());
if (membershipToBeAddedGroupKeys.contains(membership.getGroup().getKey())) {
- Set<Long> attributeIds = new HashSet<>(membership.getPlainAttrs().size());
- for (PlainAttr attribute : membership.getPlainAttrs()) {
- attributeIds.add(attribute.getKey());
+ Set<Long> attrKeys = new HashSet<>(membership.getPlainAttrs().size());
+ for (PlainAttr plainAttr : membership.getPlainAttrs()) {
+ attrKeys.add(plainAttr.getKey());
}
- for (Long attributeId : attributeIds) {
- plainAttrDAO.delete(attributeId, MPlainAttr.class);
+ for (Long attrKey : attrKeys) {
+ plainAttrDAO.delete(attrKey, MPlainAttr.class);
}
- attributeIds.clear();
+ attrKeys.clear();
// remove derived attributes
for (DerAttr derAttr : membership.getDerAttrs()) {
- attributeIds.add(derAttr.getKey());
+ attrKeys.add(derAttr.getKey());
}
- for (Long derAttrId : attributeIds) {
+ for (Long derAttrId : attrKeys) {
derAttrDAO.delete(derAttrId, MDerAttr.class);
}
- attributeIds.clear();
+ attrKeys.clear();
// remove virtual attributes
for (VirAttr virAttr : membership.getVirAttrs()) {
- attributeIds.add(virAttr.getKey());
+ attrKeys.add(virAttr.getKey());
}
- for (Long virAttrId : attributeIds) {
+ for (Long virAttrId : attrKeys) {
virAttrDAO.delete(virAttrId, MVirAttr.class);
}
- attributeIds.clear();
+ attrKeys.clear();
} else {
user.removeMembership(membership);
- membershipDAO.delete(membershipId);
+ membershipDAO.delete(membKey);
}
}
}
@@ -325,7 +378,7 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
}
propByRes.merge(fill(membership, membershipMod,
- attrUtilFactory.getInstance(AttributableType.MEMBERSHIP), scce));
+ attrUtilsFactory.getInstance(AttributableType.MEMBERSHIP), scce));
}
}
@@ -366,8 +419,9 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
userTO.setSecurityQuestion(user.getSecurityQuestion().getKey());
}
- connObjectUtil.retrieveVirAttrValues(user, attrUtilFactory.getInstance(AttributableType.USER));
- fillTO(userTO, user.getPlainAttrs(), user.getDerAttrs(), user.getVirAttrs(), user.getResources());
+ connObjectUtils.retrieveVirAttrValues(user, attrUtilsFactory.getInstance(AttributableType.USER));
+ fillTO(userTO, user.getRealm().getFullPath(),
+ user.getPlainAttrs(), user.getDerAttrs(), user.getVirAttrs(), user.getResources());
MembershipTO membershipTO;
for (Membership membership : user.getMemberships()) {
@@ -380,13 +434,12 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
membershipTO.setLastChangeDate(membership.getLastChangeDate());
membershipTO.setKey(membership.getKey());
- membershipTO.setGroupId(membership.getGroup().getKey());
+ membershipTO.setGroupKey(membership.getGroup().getKey());
membershipTO.setGroupName(membership.getGroup().getName());
// SYNCOPE-458 retrieve also membership virtual attributes
- connObjectUtil.retrieveVirAttrValues(membership, attrUtilFactory.getInstance(AttributableType.MEMBERSHIP));
-
- fillTO(membershipTO,
+ connObjectUtils.retrieveVirAttrValues(membership, attrUtilsFactory.getInstance(AttributableType.MEMBERSHIP));
+ fillTO(membershipTO, null,
membership.getPlainAttrs(), membership.getDerAttrs(), membership.getVirAttrs(),
Collections.<ExternalResource>emptyList());
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractTaskJob.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractTaskJob.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractTaskJob.java
index 2eddca1..cf4d54f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractTaskJob.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractTaskJob.java
@@ -28,7 +28,7 @@ import org.apache.syncope.core.persistence.api.entity.task.Task;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
import org.apache.syncope.core.provisioning.api.job.TaskJob;
import org.apache.syncope.core.misc.AuditManager;
-import org.apache.syncope.core.misc.ExceptionUtil;
+import org.apache.syncope.core.misc.ExceptionUtils2;
import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
@@ -133,7 +133,7 @@ public abstract class AbstractTaskJob implements TaskJob {
LOG.error("While executing task " + taskId, e);
result = Result.FAILURE;
- execution.setMessage(ExceptionUtil.getFullStackTrace(e));
+ execution.setMessage(ExceptionUtils2.getFullStackTrace(e));
execution.setStatus(Status.FAILURE.name());
}
execution.setEndDate(new Date());
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
index cdfb6fe..a6341c0 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
@@ -37,9 +37,7 @@ import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.SubjectType;
import org.apache.syncope.common.lib.CollectionUtils2;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.ConfDAO;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.NotificationDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
@@ -47,7 +45,7 @@ import org.apache.syncope.core.persistence.api.dao.TaskDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.Notification;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
@@ -61,7 +59,7 @@ import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
-import org.apache.syncope.core.misc.ConnObjectUtil;
+import org.apache.syncope.core.misc.ConnObjectUtils;
import org.apache.syncope.core.misc.search.SearchCondConverter;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
@@ -138,10 +136,7 @@ public class NotificationManagerImpl implements NotificationManager {
private ToolManager velocityToolManager;
@Autowired
- private EntitlementDAO entitlementDAO;
-
- @Autowired
- private ConnObjectUtil connObjectUtil;
+ private ConnObjectUtils connObjectUtils;
@Autowired
private UserDataBinder userDataBinder;
@@ -153,7 +148,7 @@ public class NotificationManagerImpl implements NotificationManager {
private EntityFactory entityFactory;
@Autowired
- private AttributableUtilFactory attrUtilFactory;
+ private AttributableUtilsFactory attrUtilsFactory;
@Transactional(readOnly = true)
@Override
@@ -175,15 +170,15 @@ public class NotificationManagerImpl implements NotificationManager {
final Map<String, Object> model) {
if (attributable != null) {
- connObjectUtil.retrieveVirAttrValues(attributable,
- attrUtilFactory.getInstance(
+ connObjectUtils.retrieveVirAttrValues(attributable,
+ attrUtilsFactory.getInstance(
attributable instanceof User ? AttributableType.USER : AttributableType.GROUP));
}
final List<User> recipients = new ArrayList<>();
if (notification.getRecipients() != null) {
- recipients.addAll(searchDAO.<User>search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
+ recipients.addAll(searchDAO.<User>search(SyncopeConstants.FULL_ADMIN_REALMS,
SearchCondConverter.convert(notification.getRecipients()),
Collections.<OrderByClause>emptyList(), SubjectType.USER));
}
@@ -195,7 +190,7 @@ public class NotificationManagerImpl implements NotificationManager {
final Set<String> recipientEmails = new HashSet<>();
final List<UserTO> recipientTOs = new ArrayList<>(recipients.size());
for (User recipient : recipients) {
- connObjectUtil.retrieveVirAttrValues(recipient, attrUtilFactory.getInstance(AttributableType.USER));
+ connObjectUtils.retrieveVirAttrValues(recipient, attrUtilsFactory.getInstance(AttributableType.USER));
String email = getRecipientEmail(notification.getRecipientAttrType(),
notification.getRecipientAttrName(), recipient);
@@ -293,13 +288,10 @@ public class NotificationManagerImpl implements NotificationManager {
for (Notification notification : notificationDAO.findAll()) {
LOG.debug("Notification available user about {}", notification.getUserAbout());
LOG.debug("Notification available group about {}", notification.getGroupAbout());
- if (notification.isActive()) {
- final Set<String> events = new HashSet<>(notification.getEvents());
- events.retainAll(Collections.<String>singleton(AuditLoggerName.buildEvent(
- type, category, subcategory, event, condition)));
-
- if (events.isEmpty()) {
+ if (notification.isActive()) {
+ String currentEvent = AuditLoggerName.buildEvent(type, category, subcategory, event, condition);
+ if (!notification.getEvents().contains(currentEvent)) {
LOG.debug("No events found about {}", subject);
} else if (subjectType == null || subject == null
|| notification.getUserAbout() == null || notification.getGroupAbout() == null
@@ -308,7 +300,7 @@ public class NotificationManagerImpl implements NotificationManager {
|| searchDAO.matches(subject,
SearchCondConverter.convert(notification.getGroupAbout()), subjectType)) {
- LOG.debug("Creating notification task for events {} about {}", events, subject);
+ LOG.debug("Creating notification task for event {} about {}", currentEvent, subject);
final Map<String, Object> model = new HashMap<>();
model.put("type", type);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
index 4ff9f3e..73c0572 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
@@ -34,7 +34,7 @@ import org.apache.syncope.common.lib.types.TraceLevel;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.TaskDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.Subject;
@@ -48,8 +48,8 @@ import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
import org.apache.syncope.core.misc.AuditManager;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.misc.ConnObjectUtil;
-import org.apache.syncope.core.misc.ExceptionUtil;
+import org.apache.syncope.core.misc.ConnObjectUtils;
+import org.apache.syncope.core.misc.ExceptionUtils2;
import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
import org.identityconnectors.framework.common.exceptions.ConnectorException;
import org.identityconnectors.framework.common.objects.Attribute;
@@ -79,10 +79,10 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
protected ConnectorFactory connFactory;
/**
- * ConnObjectUtil.
+ * ConnObjectUtils.
*/
@Autowired
- protected ConnObjectUtil connObjectUtil;
+ protected ConnObjectUtils connObjectUtils;
/**
* User DAO.
@@ -115,7 +115,7 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
protected AuditManager auditManager;
@Autowired
- protected AttributableUtilFactory attrUtilFactory;
+ protected AttributableUtilsFactory attrUtilsFactory;
@Autowired
protected EntityFactory entityFactory;
@@ -196,8 +196,8 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
// 2. check wether anything is actually needing to be propagated, i.e. if there is attribute
// difference between beforeObj - just read above from the connector - and the values to be propagated
- Map<String, Attribute> originalAttrMap = connObjectUtil.toMap(beforeObj.getAttributes());
- Map<String, Attribute> updateAttrMap = connObjectUtil.toMap(attributes);
+ Map<String, Attribute> originalAttrMap = connObjectUtils.toMap(beforeObj.getAttributes());
+ Map<String, Attribute> updateAttrMap = connObjectUtils.toMap(attributes);
// Only compare attribute from beforeObj that are also being updated
Set<String> skipAttrNames = originalAttrMap.keySet();
@@ -356,7 +356,7 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
failureReason = e.getMessage() + "\n\n Cause: " + e.getCause().getMessage().split("\n")[0];
}
} else {
- taskExecutionMessage = ExceptionUtil.getFullStackTrace(e);
+ taskExecutionMessage = ExceptionUtils2.getFullStackTrace(e);
if (e.getCause() == null) {
failureReason = e.getMessage();
} else {
@@ -508,7 +508,7 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
task.getPropagationOperation(),
new ObjectClass(task.getObjectClassName()),
new Uid(accountId),
- connector.getOperationOptions(attrUtilFactory.getInstance(task.getSubjectType()).
+ connector.getOperationOptions(attrUtilsFactory.getInstance(task.getSubjectType()).
getMappingItems(task.getResource(), MappingPurpose.PROPAGATION)));
} catch (TimeoutException toe) {
LOG.debug("Request timeout", toe);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
index df655a4..7437241 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
@@ -24,7 +24,7 @@ import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
-import org.apache.syncope.core.misc.ConnObjectUtil;
+import org.apache.syncope.core.misc.ConnObjectUtils;
import org.identityconnectors.framework.common.objects.ConnectorObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,7 +35,7 @@ public class DefaultPropagationReporter implements PropagationReporter {
protected static final Logger LOG = LoggerFactory.getLogger(DefaultPropagationReporter.class);
@Autowired
- protected ConnObjectUtil connObjectUtil;
+ protected ConnObjectUtils connObjectUtils;
protected final List<PropagationStatus> statuses = new ArrayList<>();
@@ -44,17 +44,17 @@ public class DefaultPropagationReporter implements PropagationReporter {
final PropagationTaskExecStatus executionStatus,
final String failureReason, final ConnectorObject beforeObj, final ConnectorObject afterObj) {
- final PropagationStatus propagation = new PropagationStatus();
+ PropagationStatus propagation = new PropagationStatus();
propagation.setResource(resource);
propagation.setStatus(executionStatus);
propagation.setFailureReason(failureReason);
if (beforeObj != null) {
- propagation.setBeforeObj(connObjectUtil.getConnObjectTO(beforeObj));
+ propagation.setBeforeObj(connObjectUtils.getConnObjectTO(beforeObj));
}
if (afterObj != null) {
- propagation.setAfterObj(connObjectUtil.getConnObjectTO(afterObj));
+ propagation.setAfterObj(connObjectUtils.getConnObjectTO(afterObj));
}
statuses.add(propagation);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
index f62aca0..6600e44 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
@@ -30,7 +30,7 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.misc.jexl.JexlUtil;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.AttributeBuilder;
import org.identityconnectors.framework.common.objects.AttributeUtil;
@@ -78,12 +78,12 @@ public class LDAPMembershipPropagationActions extends DefaultPropagationActions
LOG.debug("Evaluating accountLink for {}", group);
final JexlContext jexlContext = new MapContext();
- JexlUtil.addFieldsToContext(group, jexlContext);
- JexlUtil.addAttrsToContext(group.getPlainAttrs(), jexlContext);
- JexlUtil.addDerAttrsToContext(group.getDerAttrs(), group.getPlainAttrs(), jexlContext);
+ JexlUtils.addFieldsToContext(group, jexlContext);
+ JexlUtils.addAttrsToContext(group.getPlainAttrs(), jexlContext);
+ JexlUtils.addDerAttrsToContext(group.getDerAttrs(), group.getPlainAttrs(), jexlContext);
final String groupAccountLink =
- JexlUtil.evaluate(task.getResource().getGmapping().getAccountLink(), jexlContext);
+ JexlUtils.evaluate(task.getResource().getGmapping().getAccountLink(), jexlContext);
LOG.debug("AccountLink for {} is '{}'", group, groupAccountLink);
if (StringUtils.isNotBlank(groupAccountLink)) {
groupAccountLinks.add(groupAccountLink);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
index 122261f..c9e8f5b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
@@ -28,6 +28,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.mod.AttrMod;
import org.apache.syncope.common.lib.mod.MembershipMod;
import org.apache.syncope.common.lib.mod.UserMod;
@@ -41,8 +42,8 @@ import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
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.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
@@ -56,10 +57,10 @@ import org.apache.syncope.core.provisioning.api.WorkflowResult;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
import org.apache.syncope.core.provisioning.java.VirAttrHandler;
-import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
-import org.apache.syncope.core.misc.ConnObjectUtil;
-import org.apache.syncope.core.misc.MappingUtil;
-import org.apache.syncope.core.misc.jexl.JexlUtil;
+import org.apache.syncope.core.misc.security.UnauthorizedException;
+import org.apache.syncope.core.misc.ConnObjectUtils;
+import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.AttributeBuilder;
import org.identityconnectors.framework.common.objects.AttributeUtil;
@@ -101,79 +102,31 @@ public class PropagationManagerImpl implements PropagationManager {
protected EntityFactory entityFactory;
/**
- * ConnObjectUtil.
+ * ConnObjectUtils.
*/
@Autowired
- protected ConnObjectUtil connObjectUtil;
+ protected ConnObjectUtils connObjectUtils;
@Autowired
- protected AttributableUtilFactory attrUtilFactory;
+ protected AttributableUtilsFactory attrUtilsFactory;
@Autowired
protected VirAttrHandler virAttrHandler;
- /**
- * Create the user on every associated resource.
- *
- * @param wfResult user to be propagated (and info associated), as per result from workflow
- * @param password to be set
- * @param vAttrs virtual attributes to be set
- * @param membershipTOs user memberships
- * @return list of propagation tasks
- * @throws NotFoundException if user is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
- */
- @Override
- public List<PropagationTask> getUserCreateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
- final String password, final List<AttrTO> vAttrs, final List<MembershipTO> membershipTOs)
- throws NotFoundException, UnauthorizedGroupException {
-
- return getUserCreateTaskIds(wfResult, password, vAttrs, null, membershipTOs);
- }
-
- /**
- * Create the user on every associated resource.
- *
- * @param wfResult user to be propagated (and info associated), as per result from workflow
- * @param password to be set
- * @param vAttrs virtual attributes to be set
- * @param noPropResourceNames external resources not to be considered for propagation
- * @param membershipTOs user memberships
- * @return list of propagation tasks
- * @throws NotFoundException if user is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
- */
- @Override
- public List<PropagationTask> getUserCreateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
- final String password, final Collection<AttrTO> vAttrs,
- final Set<String> noPropResourceNames, final List<MembershipTO> membershipTOs)
- throws NotFoundException, UnauthorizedGroupException {
-
- return getUserCreateTaskIds(
- wfResult.getResult().getKey(),
- wfResult.getResult().getValue(),
- wfResult.getPropByRes(),
- password,
- vAttrs,
- membershipTOs,
- noPropResourceNames);
- }
-
@Override
- public List<PropagationTask> getUserCreateTaskIds(
+ public List<PropagationTask> getUserCreateTasks(
final Long key,
- final Boolean enabled,
+ final Boolean enable,
final PropagationByResource propByRes,
final String password,
final Collection<AttrTO> vAttrs,
final Collection<MembershipTO> membershipTOs,
final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedGroupException {
+ throws NotFoundException, UnauthorizedException {
User user = userDAO.authFetch(key);
if (vAttrs != null && !vAttrs.isEmpty()) {
- virAttrHandler.fillVirtual(user, vAttrs, attrUtilFactory.getInstance(AttributableType.USER));
-
+ virAttrHandler.fillVirtual(user, vAttrs, attrUtilsFactory.getInstance(AttributableType.USER));
}
for (final Membership membership : user.getMemberships()) {
if (membership.getVirAttrs() != null && !membership.getVirAttrs().isEmpty()) {
@@ -181,32 +134,16 @@ public class PropagationManagerImpl implements PropagationManager {
@Override
public boolean evaluate(final MembershipTO membershipTO) {
- return membershipTO.getGroupId() == membership.getGroup().getKey();
+ return membershipTO.getGroupKey() == membership.getGroup().getKey();
}
});
if (membershipTO != null) {
virAttrHandler.fillVirtual(membership,
- membershipTO.getVirAttrs(), attrUtilFactory.getInstance(AttributableType.MEMBERSHIP));
+ membershipTO.getVirAttrs(), attrUtilsFactory.getInstance(AttributableType.MEMBERSHIP));
}
}
}
- return getCreateTaskIds(user, password, enabled, propByRes, noPropResourceNames);
- }
-
- /**
- * Create the group on every associated resource.
- *
- * @param wfResult user to be propagated (and info associated), as per result from workflow
- * @param vAttrs virtual attributes to be set
- * @return list of propagation tasks
- * @throws NotFoundException if group is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
- */
- @Override
- public List<PropagationTask> getGroupCreateTaskIds(final WorkflowResult<Long> wfResult, final List<AttrTO> vAttrs)
- throws NotFoundException, UnauthorizedGroupException {
-
- return getGroupCreateTaskIds(wfResult, vAttrs, null);
+ return getCreateTaskIds(user, password, enable, propByRes, noPropResourceNames);
}
/**
@@ -217,16 +154,16 @@ public class PropagationManagerImpl implements PropagationManager {
* @param noPropResourceNames external resources performing not to be considered for propagation
* @return list of propagation tasks
* @throws NotFoundException if group is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
+ * @throws UnauthorizedException if caller doesn't own enough entitlements to administer the given group
*/
@Override
- public List<PropagationTask> getGroupCreateTaskIds(
+ public List<PropagationTask> getGroupCreateTasks(
final WorkflowResult<Long> wfResult,
final Collection<AttrTO> vAttrs,
final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedGroupException {
+ throws NotFoundException, UnauthorizedException {
- return getGroupCreateTaskIds(wfResult.getResult(), vAttrs, wfResult.getPropByRes(), noPropResourceNames);
+ return getGroupCreateTasks(wfResult.getResult(), vAttrs, wfResult.getPropByRes(), noPropResourceNames);
}
/**
@@ -238,19 +175,19 @@ public class PropagationManagerImpl implements PropagationManager {
* @param noPropResourceNames external resources performing not to be considered for propagation
* @return list of propagation tasks
* @throws NotFoundException if group is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
+ * @throws UnauthorizedException if caller doesn't own enough entitlements to administer the given group
*/
@Override
- public List<PropagationTask> getGroupCreateTaskIds(
+ public List<PropagationTask> getGroupCreateTasks(
final Long key,
final Collection<AttrTO> vAttrs,
final PropagationByResource propByRes,
final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedGroupException {
+ throws NotFoundException, UnauthorizedException {
Group group = groupDAO.authFetch(key);
if (vAttrs != null && !vAttrs.isEmpty()) {
- virAttrHandler.fillVirtual(group, vAttrs, attrUtilFactory.getInstance(AttributableType.GROUP));
+ virAttrHandler.fillVirtual(group, vAttrs, attrUtilsFactory.getInstance(AttributableType.GROUP));
}
return getCreateTaskIds(group, null, null, propByRes, noPropResourceNames);
@@ -282,10 +219,10 @@ public class PropagationManagerImpl implements PropagationManager {
* @throws NotFoundException if user is not found
*/
@Override
- public List<PropagationTask> getUserUpdateTaskIds(final User user, final Boolean enable,
+ public List<PropagationTask> getUserUpdateTasks(final User user, final Boolean enable,
final Collection<String> noPropResourceNames) throws NotFoundException {
- return getUpdateTaskIds(
+ return getUpdateTasks(
user, // user to be updated on external resources
null, // no password
false,
@@ -305,15 +242,15 @@ public class PropagationManagerImpl implements PropagationManager {
* @param noPropResourceNames external resources not to be considered for propagation
* @return list of propagation tasks
* @throws NotFoundException if user is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
+ * @throws UnauthorizedException if caller doesn't own enough entitlements to administer the given user
*/
@Override
- public List<PropagationTask> getUserUpdateTaskIds(final WorkflowResult<Map.Entry<UserMod, Boolean>> wfResult,
+ public List<PropagationTask> getUserUpdateTasks(final WorkflowResult<Pair<UserMod, Boolean>> wfResult,
final boolean changePwd, final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedGroupException {
+ throws NotFoundException, UnauthorizedException {
User user = userDAO.authFetch(wfResult.getResult().getKey().getKey());
- return getUpdateTaskIds(user,
+ return getUpdateTasks(user,
wfResult.getResult().getKey().getPassword(),
changePwd,
wfResult.getResult().getValue(),
@@ -325,14 +262,14 @@ public class PropagationManagerImpl implements PropagationManager {
}
@Override
- public List<PropagationTask> getUserUpdateTaskIds(final WorkflowResult<Map.Entry<UserMod, Boolean>> wfResult) {
+ public List<PropagationTask> getUserUpdateTasks(final WorkflowResult<Pair<UserMod, Boolean>> wfResult) {
UserMod userMod = wfResult.getResult().getKey();
// Propagate password update only to requested resources
List<PropagationTask> tasks = new ArrayList<>();
if (userMod.getPwdPropRequest() == null) {
// a. no specific password propagation request: generate propagation tasks for any resource associated
- tasks = getUserUpdateTaskIds(wfResult, false, null);
+ tasks = getUserUpdateTasks(wfResult, false, null);
} else {
// b. generate the propagation task list in two phases: first the ones containing password,
// the the rest (with no password)
@@ -348,7 +285,7 @@ public class PropagationManagerImpl implements PropagationManager {
Set<String> toBeExcluded = new HashSet<>(currentResourceNames);
toBeExcluded.addAll(userMod.getResourcesToAdd());
toBeExcluded.removeAll(pwdResourceNames);
- tasks.addAll(getUserUpdateTaskIds(wfResult, true, toBeExcluded));
+ tasks.addAll(getUserUpdateTasks(wfResult, true, toBeExcluded));
}
final PropagationByResource nonPwdPropByRes = new PropagationByResource();
@@ -356,56 +293,27 @@ public class PropagationManagerImpl implements PropagationManager {
nonPwdPropByRes.removeAll(pwdResourceNames);
nonPwdPropByRes.purge();
if (!nonPwdPropByRes.isEmpty()) {
- tasks.addAll(getUserUpdateTaskIds(wfResult, false, pwdResourceNames));
+ tasks.addAll(getUserUpdateTasks(wfResult, false, pwdResourceNames));
}
}
return tasks;
}
- /**
- * Performs update on each resource associated to the group.
- *
- * @param wfResult group to be propagated (and info associated), as per result from workflow
- * @param vAttrsToBeRemoved virtual attributes to be removed
- * @param vAttrsToBeUpdated virtual attributes to be added
- * @return list of propagation tasks
- * @throws NotFoundException if group is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
- */
@Override
- public List<PropagationTask> getGroupUpdateTaskIds(final WorkflowResult<Long> wfResult,
- final Set<String> vAttrsToBeRemoved, final Set<AttrMod> vAttrsToBeUpdated)
- throws NotFoundException, UnauthorizedGroupException {
-
- return getGroupUpdateTaskIds(wfResult, vAttrsToBeRemoved, vAttrsToBeUpdated, null);
- }
-
- /**
- * Performs update on each resource associated to the group.
- *
- * @param wfResult group to be propagated (and info associated), as per result from workflow
- * @param vAttrsToBeRemoved virtual attributes to be removed
- * @param vAttrsToBeUpdated virtual attributes to be added
- * @param noPropResourceNames external resource names not to be considered for propagation
- * @return list of propagation tasks
- * @throws NotFoundException if group is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
- */
- @Override
- public List<PropagationTask> getGroupUpdateTaskIds(final WorkflowResult<Long> wfResult,
+ public List<PropagationTask> getGroupUpdateTasks(final WorkflowResult<Long> wfResult,
final Set<String> vAttrsToBeRemoved, final Set<AttrMod> vAttrsToBeUpdated,
final Set<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedGroupException {
+ throws NotFoundException, UnauthorizedException {
Group group = groupDAO.authFetch(wfResult.getResult());
- return getUpdateTaskIds(group, null, false, null,
+ return getUpdateTasks(group, null, false, null,
vAttrsToBeRemoved, vAttrsToBeUpdated, wfResult.getPropByRes(), noPropResourceNames,
Collections.<MembershipMod>emptySet());
}
@Override
- public List<PropagationTask> getUpdateTaskIds(final Subject<?, ?, ?> subject,
+ public List<PropagationTask> getUpdateTasks(final Subject<?, ?, ?> subject,
final String password, final boolean changePwd, final Boolean enable,
final Set<String> vAttrsToBeRemoved, final Set<AttrMod> vAttrsToBeUpdated,
final PropagationByResource propByRes, final Collection<String> noPropResourceNames,
@@ -416,7 +324,7 @@ public class PropagationManagerImpl implements PropagationManager {
? Collections.<String>emptySet()
: vAttrsToBeRemoved, vAttrsToBeUpdated == null
? Collections.<AttrMod>emptySet()
- : vAttrsToBeUpdated, attrUtilFactory.getInstance(subject));
+ : vAttrsToBeUpdated, attrUtilsFactory.getInstance(subject));
// SYNCOPE-458 fill membership virtual attributes
if (subject instanceof User) {
@@ -436,7 +344,7 @@ public class PropagationManagerImpl implements PropagationManager {
? Collections.<String>emptySet()
: membershipMod.getVirAttrsToRemove(),
membershipMod.getVirAttrsToUpdate() == null ? Collections.<AttrMod>emptySet()
- : membershipMod.getVirAttrsToUpdate(), attrUtilFactory.getInstance(
+ : membershipMod.getVirAttrsToUpdate(), attrUtilsFactory.getInstance(
AttributableType.MEMBERSHIP));
}
}
@@ -480,165 +388,56 @@ public class PropagationManagerImpl implements PropagationManager {
localPropByRes);
}
- /**
- * Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
- *
- * @param userKey to be deleted
- * @return list of propagation tasks
- * @throws NotFoundException if user is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
- */
- @Override
- public List<PropagationTask> getUserDeleteTaskIds(final Long userKey)
- throws NotFoundException, UnauthorizedGroupException {
-
- return getUserDeleteTaskIds(userKey, Collections.<String>emptySet());
- }
-
- /**
- * Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
- *
- * @param userKey to be deleted
- * @param noPropResourceName name of external resource not to be considered for propagation
- * @return list of propagation tasks
- * @throws NotFoundException if user is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
- */
- @Override
- public List<PropagationTask> getUserDeleteTaskIds(final Long userKey, final String noPropResourceName)
- throws NotFoundException, UnauthorizedGroupException {
- return getUserDeleteTaskIds(userKey, Collections.<String>singleton(noPropResourceName));
- }
-
- /**
- * Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
- *
- * @param userKey to be deleted
- * @param noPropResourceNames name of external resources not to be considered for propagation
- * @return list of propagation tasks
- * @throws NotFoundException if user is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
- */
@Override
- public List<PropagationTask> getUserDeleteTaskIds(final Long userKey, final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedGroupException {
+ public List<PropagationTask> getUserDeleteTasks(final Long userKey, final Collection<String> noPropResourceNames)
+ throws NotFoundException, UnauthorizedException {
User user = userDAO.authFetch(userKey);
return getDeleteTaskIds(user, user.getResourceNames(), noPropResourceNames);
}
- /**
- * Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
- *
- * @param userKey to be deleted
- * @param resourceNames resource from which user is to be deleted
- * @param noPropResourceNames name of external resources not to be considered for propagation
- * @return list of propagation tasks
- * @throws NotFoundException if user is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
- */
@Override
- public List<PropagationTask> getUserDeleteTaskIds(
+ public List<PropagationTask> getUserDeleteTasks(
final Long userKey, final Set<String> resourceNames, final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedGroupException {
+ throws NotFoundException, UnauthorizedException {
User user = userDAO.authFetch(userKey);
return getDeleteTaskIds(user, resourceNames, noPropResourceNames);
}
- /**
- * Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
- *
- * @param wfResult user to be propagated (and info associated), as per result from workflow
- * @return list of propagation tasks
- */
@Override
- public List<PropagationTask> getUserDeleteTaskIds(final WorkflowResult<Long> wfResult) {
+ public List<PropagationTask> getUserDeleteTasks(final WorkflowResult<Long> wfResult) {
User user = userDAO.authFetch(wfResult.getResult());
return createTasks(user, null, false, null, null, null, null, false, true, wfResult.getPropByRes());
}
- /**
- * Perform delete on each resource associated to the group. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
- *
- * @param groupKey to be deleted
- * @return list of propagation tasks
- * @throws NotFoundException if group is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
- */
@Override
- public List<PropagationTask> getGroupDeleteTaskIds(final Long groupKey)
- throws NotFoundException, UnauthorizedGroupException {
+ public List<PropagationTask> getGroupDeleteTasks(final Long groupKey)
+ throws NotFoundException, UnauthorizedException {
- return getGroupDeleteTaskIds(groupKey, Collections.<String>emptySet());
+ return getGroupDeleteTasks(groupKey, Collections.<String>emptySet());
}
- /**
- * Perform delete on each resource associated to the group. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
- *
- * @param groupKey to be deleted
- * @param noPropResourceName name of external resource not to be considered for propagation
- * @return list of propagation tasks
- * @throws NotFoundException if group is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
- */
@Override
- public List<PropagationTask> getGroupDeleteTaskIds(final Long groupKey, final String noPropResourceName)
- throws NotFoundException, UnauthorizedGroupException {
+ public List<PropagationTask> getGroupDeleteTasks(final Long groupKey, final String noPropResourceName)
+ throws NotFoundException, UnauthorizedException {
- return getGroupDeleteTaskIds(groupKey, Collections.<String>singleton(noPropResourceName));
+ return getGroupDeleteTasks(groupKey, Collections.<String>singleton(noPropResourceName));
}
- /**
- * Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
- *
- * @param groupKey to be deleted
- * @param noPropResourceNames name of external resources not to be considered for propagation
- * @return list of propagation tasks
- * @throws NotFoundException if group is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
- */
@Override
- public List<PropagationTask> getGroupDeleteTaskIds(
+ public List<PropagationTask> getGroupDeleteTasks(
final Long groupKey, final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedGroupException {
+ throws NotFoundException, UnauthorizedException {
Group group = groupDAO.authFetch(groupKey);
return getDeleteTaskIds(group, group.getResourceNames(), noPropResourceNames);
}
- /**
- * Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
- * some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
- * the creation fails onto a mandatory resource.
- *
- * @param groupKey to be deleted
- * @param resourceNames resource from which group is to be deleted
- * @param noPropResourceNames name of external resources not to be considered for propagation
- * @return list of propagation tasks
- * @throws NotFoundException if group is not found
- * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
- */
@Override
- public List<PropagationTask> getGroupDeleteTaskIds(
+ public List<PropagationTask> getGroupDeleteTasks(
final Long groupKey, final Set<String> resourceNames, final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedGroupException {
+ throws NotFoundException, UnauthorizedException {
Group group = groupDAO.authFetch(groupKey);
return getDeleteTaskIds(group, resourceNames, noPropResourceNames);
@@ -680,12 +479,12 @@ public class PropagationManagerImpl implements PropagationManager {
LOG.debug("Provisioning subject {}:\n{}", subject, propByRes);
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(subject);
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(subject);
if (!propByRes.get(ResourceOperation.CREATE).isEmpty()
&& vAttrsToBeRemoved != null && vAttrsToBeUpdated != null) {
- connObjectUtil.retrieveVirAttrValues(subject, attrUtil);
+ connObjectUtils.retrieveVirAttrValues(subject, attrUtils);
// update vAttrsToBeUpdated as well
for (VirAttr virAttr : subject.getVirAttrs()) {
@@ -710,14 +509,14 @@ public class PropagationManagerImpl implements PropagationManager {
final ExternalResource resource = resourceDAO.find(resourceName);
if (resource == null) {
LOG.error("Invalid resource name specified: {}, ignoring...", resourceName);
- } else if (attrUtil.getMappingItems(resource, MappingPurpose.PROPAGATION).isEmpty()) {
+ } else if (attrUtils.getMappingItems(resource, MappingPurpose.PROPAGATION).isEmpty()) {
LOG.warn("Requesting propagation for {} but no propagation mapping provided for {}",
- attrUtil.getType(), resource);
+ attrUtils.getType(), resource);
} else {
PropagationTask task = entityFactory.newEntity(PropagationTask.class);
task.setResource(resource);
- task.setObjectClassName(connObjectUtil.fromSubject(subject).getObjectClassValue());
- task.setSubjectType(attrUtil.getType());
+ task.setObjectClassName(connObjectUtils.fromSubject(subject).getObjectClassValue());
+ task.setSubjectType(attrUtils.getType());
if (!deleteOnResource) {
task.setSubjectKey(subject.getKey());
}
@@ -725,7 +524,7 @@ public class PropagationManagerImpl implements PropagationManager {
task.setPropagationMode(resource.getPropagationMode());
task.setOldAccountId(propByRes.getOldAccountId(resource.getKey()));
- Map.Entry<String, Set<Attribute>> preparedAttrs = MappingUtil.prepareAttributes(attrUtil, subject,
+ Pair<String, Set<Attribute>> preparedAttrs = MappingUtils.prepareAttributes(attrUtils, subject,
password, changePwd, vAttrsToBeRemoved, vAttrsToBeUpdated, membVAttrsToBeRemoved,
membVAttrsToBeUpdatedMap, enable, resource);
task.setAccountId(preparedAttrs.getKey());
@@ -734,9 +533,9 @@ public class PropagationManagerImpl implements PropagationManager {
// if so, add special attributes that will be evaluated by PropagationTaskExecutor
List<String> mandatoryMissing = new ArrayList<>();
List<String> mandatoryNullOrEmpty = new ArrayList<>();
- for (MappingItem item : attrUtil.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
+ for (MappingItem item : attrUtils.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
if (!item.isAccountid()
- && JexlUtil.evaluateMandatoryCondition(item.getMandatoryCondition(), subject)) {
+ && JexlUtils.evaluateMandatoryCondition(item.getMandatoryCondition(), subject)) {
Attribute attr = AttributeUtil.find(item.getExtAttrName(), preparedAttrs.getValue());
if (attr == null) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
index 0920146..4ba68c5 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
@@ -20,15 +20,17 @@ package org.apache.syncope.core.provisioning.java.sync;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.lib.types.TraceLevel;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
+import org.apache.syncope.core.misc.security.SyncopeGrantedAuthority;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
import org.apache.syncope.core.persistence.api.entity.group.GMapping;
import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
import org.apache.syncope.core.persistence.api.entity.task.PushTask;
@@ -44,7 +46,6 @@ import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
@@ -72,12 +73,6 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
protected ExternalResourceDAO resourceDAO;
/**
- * Entitlement DAO.
- */
- @Autowired
- protected EntitlementDAO entitlementDAO;
-
- /**
* Policy DAO.
*/
@Autowired
@@ -317,16 +312,16 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
@Override
protected String doExecute(final boolean dryRun) throws JobExecutionException {
// PRE: grant all authorities (i.e. setup the SecurityContextHolder)
- List<GrantedAuthority> authorities = new ArrayList<>();
- CollectionUtils.collect(entitlementDAO.findAll(), new Transformer<Entitlement, GrantedAuthority>() {
+ List<GrantedAuthority> authorities = CollectionUtils.collect(Arrays.asList(Entitlement.values()),
+ new Transformer<Entitlement, GrantedAuthority>() {
- @Override
- public GrantedAuthority transform(final Entitlement entitlement) {
- return new SimpleGrantedAuthority(entitlement.getKey());
- }
- }, authorities);
+ @Override
+ public GrantedAuthority transform(final Entitlement entitlement) {
+ return new SyncopeGrantedAuthority(entitlement, SyncopeConstants.ROOT_REALM);
+ }
+ }, new ArrayList<GrantedAuthority>());
- final UserDetails userDetails = new User("admin", "FAKE_PASSWORD", true, true, true, true, authorities);
+ final UserDetails userDetails = new User("admin", "FAKE_PASSWORD", authorities);
SecurityContextHolder.getContext().setAuthentication(
new UsernamePasswordAuthenticationToken(userDetails, "FAKE_PASSWORD", authorities));
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
index de222bd..98b0dff 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
@@ -33,7 +33,7 @@ import org.apache.syncope.common.lib.types.MatchingRule;
import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.common.lib.types.UnmatchingRule;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.Mapping;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
import org.apache.syncope.core.persistence.api.entity.Subject;
@@ -43,7 +43,7 @@ import org.apache.syncope.core.persistence.api.entity.task.PushTask;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
import org.apache.syncope.core.provisioning.api.sync.PushActions;
-import org.apache.syncope.core.misc.MappingUtil;
+import org.apache.syncope.core.misc.MappingUtils;
import org.apache.syncope.core.provisioning.api.sync.SyncopePushResultHandler;
import org.identityconnectors.framework.common.objects.ConnectorObject;
import org.quartz.JobExecutionException;
@@ -52,7 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHandler<PushTask, PushActions>
implements SyncopePushResultHandler {
- protected abstract AttributableUtil getAttributableUtil();
+ protected abstract AttributableUtils getAttributableUtils();
protected abstract String getName(final Subject<?, ?, ?> subject);
@@ -91,13 +91,13 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
final Subject<?, ?, ?> subject = getSubject(subjectId);
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(subject);
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(subject);
final ProvisioningResult result = new ProvisioningResult();
profile.getResults().add(result);
result.setId(subject.getKey());
- result.setSubjectType(attrUtil.getType());
+ result.setSubjectType(attrUtils.getType());
result.setName(getName(subject));
final Boolean enabled = subject instanceof User && profile.getTask().isSyncStatus()
@@ -105,7 +105,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
: null;
LOG.debug("Propagating {} with key {} towards {}",
- attrUtil.getType(), subject.getKey(), profile.getTask().getResource());
+ attrUtils.getType(), subject.getKey(), profile.getTask().getResource());
Object output = null;
Result resultStatus = null;
@@ -113,7 +113,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
String operation = null;
// Try to read remote object (user / group) BEFORE any actual operation
- final String accountId = MappingUtil.getAccountIdValue(
+ final String accountId = MappingUtils.getAccountIdValue(
subject, profile.getTask().getResource(), getMapping().getAccountIdItem());
beforeObj = getRemoteObject(accountId);
@@ -265,18 +265,16 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
LOG.warn("Error pushing {} towards {}", subject, profile.getTask().getResource(), e);
throw new JobExecutionException(e);
} finally {
- notificationManager.createTasks(
- AuditElements.EventCategoryType.PUSH,
- getAttributableUtil().getType().name().toLowerCase(),
+ notificationManager.createTasks(AuditElements.EventCategoryType.PUSH,
+ getAttributableUtils().getType().name().toLowerCase(),
profile.getTask().getResource().getKey(),
operation,
resultStatus,
beforeObj,
output,
subject);
- auditManager.audit(
- AuditElements.EventCategoryType.PUSH,
- getAttributableUtil().getType().name().toLowerCase(),
+ auditManager.audit(AuditElements.EventCategoryType.PUSH,
+ getAttributableUtils().getType().name().toLowerCase(),
profile.getTask().getResource().getKey(),
operation,
resultStatus,
@@ -372,7 +370,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
final PropagationByResource propByRes = new PropagationByResource();
propByRes.add(ResourceOperation.CREATE, profile.getTask().getResource().getKey());
- taskExecutor.execute(propagationManager.getUpdateTaskIds(
+ taskExecutor.execute(propagationManager.getUpdateTasks(
sbj, null, changepwd, enabled, vattrToBeRemoved, vattrToBeUpdated, propByRes, noPropResources,
membsToAdd));
[07/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java
deleted file mode 100644
index 2e12820..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RoleDataBinderImpl.java
+++ /dev/null
@@ -1,411 +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.provisioning.java.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.common.lib.SyncopeClientCompositeException;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.Schema;
-import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
-import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.core.provisioning.api.data.RoleDataBinder;
-import org.apache.syncope.core.misc.ConnObjectUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-@Component
-@Transactional(rollbackFor = { Throwable.class })
-public class RoleDataBinderImpl extends AbstractAttributableDataBinder implements RoleDataBinder {
-
- @Autowired
- private ConnObjectUtil connObjectUtil;
-
- @Autowired
- private EntitlementDAO entitlementDAO;
-
- private <T extends AttrTemplate<S>, S extends Schema> void setAttrTemplates(
- final Role role, final List<String> schemaNames,
- final Class<T> templateClass, final Class<S> schemaClass) {
-
- List<T> toRemove = new ArrayList<>();
- for (T template : role.getAttrTemplates(templateClass)) {
- if (!schemaNames.contains(template.getSchema().getKey())) {
- toRemove.add(template);
- }
- }
- role.getAttrTemplates(templateClass).removeAll(toRemove);
-
- for (String schemaName : schemaNames) {
- if (role.getAttrTemplate(templateClass, schemaName) == null) {
- S schema = getSchema(schemaName, schemaClass);
- if (schema != null) {
- try {
- T template = entityFactory.newEntity(templateClass);
- template.setSchema(schema);
- template.setOwner(role);
- role.getAttrTemplates(templateClass).add(template);
- } catch (Exception e) {
- LOG.error("Could not create template for {}", templateClass, e);
- }
- }
- }
- }
- }
-
- @Override
- public Role create(final Role role, final RoleTO roleTO) {
- role.setInheritOwner(roleTO.isInheritOwner());
-
- role.setInheritPlainAttrs(roleTO.isInheritPlainAttrs());
- role.setInheritDerAttrs(roleTO.isInheritDerAttrs());
- role.setInheritVirAttrs(roleTO.isInheritVirAttrs());
-
- role.setInheritTemplates(roleTO.isInheritTemplates());
-
- role.setInheritPasswordPolicy(roleTO.isInheritPasswordPolicy());
- role.setInheritAccountPolicy(roleTO.isInheritAccountPolicy());
-
- SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
-
- // name and parent
- SyncopeClientException invalidRoles = SyncopeClientException.build(ClientExceptionType.InvalidRoles);
- if (roleTO.getName() == null) {
- LOG.error("No name specified for this role");
-
- invalidRoles.getElements().add("No name specified for this role");
- } else {
- role.setName(roleTO.getName());
- }
- Long parentRoleKey = null;
- if (roleTO.getParent() != 0) {
- Role parentRole = roleDAO.find(roleTO.getParent());
- if (parentRole == null) {
- LOG.error("Could not find role with id " + roleTO.getParent());
-
- invalidRoles.getElements().add(String.valueOf(roleTO.getParent()));
- scce.addException(invalidRoles);
- } else {
- role.setParent(parentRole);
- parentRoleKey = role.getParent().getKey();
- }
- }
-
- Role otherRole = roleDAO.find(roleTO.getName(), parentRoleKey);
- if (otherRole != null) {
- LOG.error("Another role exists with the same name " + "and the same parent role: " + otherRole);
-
- invalidRoles.getElements().add(roleTO.getName());
- }
-
- // attribute templates
- setAttrTemplates(role, roleTO.getRPlainAttrTemplates(), RPlainAttrTemplate.class, RPlainSchema.class);
- setAttrTemplates(role, roleTO.getRDerAttrTemplates(), RDerAttrTemplate.class, RDerSchema.class);
- setAttrTemplates(role, roleTO.getRVirAttrTemplates(), RVirAttrTemplate.class, RVirSchema.class);
- setAttrTemplates(role, roleTO.getMPlainAttrTemplates(), MPlainAttrTemplate.class, MPlainSchema.class);
- setAttrTemplates(role, roleTO.getMDerAttrTemplates(), MDerAttrTemplate.class, MDerSchema.class);
- setAttrTemplates(role, roleTO.getMVirAttrTemplates(), MVirAttrTemplate.class, MVirSchema.class);
-
- // attributes, derived attributes, virtual attributes and resources
- fill(role, roleTO, attrUtilFactory.getInstance(AttributableType.ROLE), scce);
-
- // entitlements
- for (String entitlementName : roleTO.getEntitlements()) {
- Entitlement entitlement = entitlementDAO.find(entitlementName);
- if (entitlement == null) {
- LOG.warn("Ignoring invalid entitlement {}", entitlementName);
- } else {
- role.addEntitlement(entitlement);
- }
- }
-
- // owner
- if (roleTO.getUserOwner() != null) {
- User owner = userDAO.find(roleTO.getUserOwner());
- if (owner == null) {
- LOG.warn("Ignoring invalid user specified as owner: {}", roleTO.getUserOwner());
- } else {
- role.setUserOwner(owner);
- }
- }
- if (roleTO.getRoleOwner() != null) {
- Role owner = roleDAO.find(roleTO.getRoleOwner());
- if (owner == null) {
- LOG.warn("Ignoring invalid role specified as owner: {}", roleTO.getRoleOwner());
- } else {
- role.setRoleOwner(owner);
- }
- }
-
- // policies
- if (roleTO.getPasswordPolicy() != null) {
- role.setPasswordPolicy((PasswordPolicy) policyDAO.find(roleTO.getPasswordPolicy()));
- }
- if (roleTO.getAccountPolicy() != null) {
- role.setAccountPolicy((AccountPolicy) policyDAO.find(roleTO.getAccountPolicy()));
- }
-
- return role;
- }
-
- @Override
- public PropagationByResource update(final Role role, final RoleMod roleMod) {
- PropagationByResource propByRes = new PropagationByResource();
-
- SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
-
- // fetch account ids before update
- Map<String, String> oldAccountIds = getAccountIds(role, AttributableType.ROLE);
-
- // name
- SyncopeClientException invalidRoles = SyncopeClientException.build(ClientExceptionType.InvalidRoles);
- if (roleMod.getName() != null) {
- Role otherRole = roleDAO.find(roleMod.getName(),
- role.getParent() == null ? null : role.getParent().getKey());
- if (otherRole == null || role.equals(otherRole)) {
- if (!roleMod.getName().equals(role.getName())) {
- propByRes.addAll(ResourceOperation.UPDATE, role.getResourceNames());
-
- role.setName(roleMod.getName());
- }
- } else {
- LOG.error("Another role exists with the same name and the same parent role: " + otherRole);
-
- invalidRoles.getElements().add(roleMod.getName());
- scce.addException(invalidRoles);
- }
- }
-
- if (roleMod.getInheritOwner() != null) {
- role.setInheritOwner(roleMod.getInheritOwner());
- }
-
- if (roleMod.getInheritTemplates() != null) {
- role.setInheritTemplates(roleMod.getInheritTemplates());
- }
-
- if (roleMod.getInheritPlainAttrs() != null) {
- role.setInheritPlainAttrs(roleMod.getInheritPlainAttrs());
- }
- if (roleMod.getInheritDerAttrs() != null) {
- role.setInheritDerAttrs(roleMod.getInheritDerAttrs());
- }
- if (roleMod.getInheritVirAttrs() != null) {
- role.setInheritVirAttrs(roleMod.getInheritVirAttrs());
- }
-
- if (roleMod.getInheritPasswordPolicy() != null) {
- role.setInheritPasswordPolicy(roleMod.getInheritPasswordPolicy());
- }
- if (roleMod.getInheritAccountPolicy() != null) {
- role.setInheritAccountPolicy(roleMod.getInheritAccountPolicy());
- }
-
- // entitlements
- if (roleMod.isModEntitlements()) {
- role.getEntitlements().clear();
- for (String entitlementName : roleMod.getEntitlements()) {
- Entitlement entitlement = entitlementDAO.find(entitlementName);
- if (entitlement == null) {
- LOG.warn("Ignoring invalid entitlement {}", entitlementName);
- } else {
- role.addEntitlement(entitlement);
- }
- }
- }
-
- // attribute templates
- if (roleMod.isModRAttrTemplates()) {
- setAttrTemplates(role, roleMod.getRPlainAttrTemplates(), RPlainAttrTemplate.class, RPlainSchema.class);
- }
- if (roleMod.isModRDerAttrTemplates()) {
- setAttrTemplates(role, roleMod.getRDerAttrTemplates(), RDerAttrTemplate.class, RDerSchema.class);
- }
- if (roleMod.isModRVirAttrTemplates()) {
- setAttrTemplates(role, roleMod.getRVirAttrTemplates(), RVirAttrTemplate.class, RVirSchema.class);
- }
- if (roleMod.isModMAttrTemplates()) {
- setAttrTemplates(role, roleMod.getMPlainAttrTemplates(), MPlainAttrTemplate.class, MPlainSchema.class);
- }
- if (roleMod.isModMDerAttrTemplates()) {
- setAttrTemplates(role, roleMod.getMDerAttrTemplates(), MDerAttrTemplate.class, MDerSchema.class);
- }
- if (roleMod.isModMVirAttrTemplates()) {
- setAttrTemplates(role, roleMod.getMVirAttrTemplates(), MVirAttrTemplate.class, MVirSchema.class);
- }
-
- // policies
- if (roleMod.getPasswordPolicy() != null) {
- role.setPasswordPolicy(roleMod.getPasswordPolicy().getKey() == null
- ? null
- : (PasswordPolicy) policyDAO.find(roleMod.getPasswordPolicy().getKey()));
- }
- if (roleMod.getAccountPolicy() != null) {
- role.setAccountPolicy(roleMod.getAccountPolicy().getKey() == null
- ? null
- : (AccountPolicy) policyDAO.find(roleMod.getAccountPolicy().getKey()));
- }
-
- // owner
- if (roleMod.getUserOwner() != null) {
- role.setUserOwner(roleMod.getUserOwner().getKey() == null
- ? null
- : userDAO.find(roleMod.getUserOwner().getKey()));
- }
- if (roleMod.getRoleOwner() != null) {
- role.setRoleOwner(roleMod.getRoleOwner().getKey() == null
- ? null
- : roleDAO.find(roleMod.getRoleOwner().getKey()));
- }
-
- // attributes, derived attributes, virtual attributes and resources
- propByRes.merge(fill(role, roleMod, attrUtilFactory.getInstance(AttributableType.ROLE), scce));
-
- // check if some account id was changed by the update above
- Map<String, String> newAccountIds = getAccountIds(role, AttributableType.ROLE);
- for (Map.Entry<String, String> entry : oldAccountIds.entrySet()) {
- if (newAccountIds.containsKey(entry.getKey())
- && !entry.getValue().equals(newAccountIds.get(entry.getKey()))) {
-
- propByRes.addOldAccountId(entry.getKey(), entry.getValue());
- propByRes.add(ResourceOperation.UPDATE, entry.getKey());
- }
- }
-
- return propByRes;
- }
-
- @SuppressWarnings("unchecked")
- @Transactional(readOnly = true)
- @Override
- public RoleTO getRoleTO(final Role role) {
- connObjectUtil.retrieveVirAttrValues(role, attrUtilFactory.getInstance(AttributableType.ROLE));
-
- RoleTO roleTO = new RoleTO();
-
- // set sys info
- roleTO.setCreator(role.getCreator());
- roleTO.setCreationDate(role.getCreationDate());
- roleTO.setLastModifier(role.getLastModifier());
- roleTO.setLastChangeDate(role.getLastChangeDate());
-
- roleTO.setKey(role.getKey());
- roleTO.setName(role.getName());
-
- roleTO.setInheritOwner(role.isInheritOwner());
-
- roleTO.setInheritTemplates(role.isInheritTemplates());
-
- roleTO.setInheritPlainAttrs(role.isInheritPlainAttrs());
- roleTO.setInheritDerAttrs(role.isInheritDerAttrs());
- roleTO.setInheritVirAttrs(role.isInheritVirAttrs());
-
- roleTO.setInheritPasswordPolicy(role.isInheritPasswordPolicy());
- roleTO.setInheritAccountPolicy(role.isInheritAccountPolicy());
-
- if (role.getParent() != null) {
- roleTO.setParent(role.getParent().getKey());
- }
-
- if (role.getUserOwner() != null) {
- roleTO.setUserOwner(role.getUserOwner().getKey());
- }
- if (role.getRoleOwner() != null) {
- roleTO.setRoleOwner(role.getRoleOwner().getKey());
- }
-
- // -------------------------
- // Retrieve all [derived/virtual] attributes (inherited and not)
- // -------------------------
- final List<? extends RPlainAttr> allAttributes = role.findLastInheritedAncestorPlainAttrs();
-
- final List<? extends RDerAttr> allDerAttributes = role.findLastInheritedAncestorDerAttrs();
-
- final List<? extends RVirAttr> allVirAttributes = role.findLastInheritedAncestorVirAttrs();
- // -------------------------
-
- fillTO(roleTO, allAttributes, allDerAttributes, allVirAttributes, role.getResources());
-
- for (Entitlement entitlement : role.getEntitlements()) {
- roleTO.getEntitlements().add(entitlement.getKey());
- }
-
- for (RPlainAttrTemplate template : role.findInheritedTemplates(RPlainAttrTemplate.class)) {
- roleTO.getRPlainAttrTemplates().add(template.getSchema().getKey());
- }
- for (RDerAttrTemplate template : role.findInheritedTemplates(RDerAttrTemplate.class)) {
- roleTO.getRDerAttrTemplates().add(template.getSchema().getKey());
- }
- for (RVirAttrTemplate template : role.findInheritedTemplates(RVirAttrTemplate.class)) {
- roleTO.getRVirAttrTemplates().add(template.getSchema().getKey());
- }
- for (MPlainAttrTemplate template : role.findInheritedTemplates(MPlainAttrTemplate.class)) {
- roleTO.getMPlainAttrTemplates().add(template.getSchema().getKey());
- }
- for (MDerAttrTemplate template : role.findInheritedTemplates(MDerAttrTemplate.class)) {
- roleTO.getMDerAttrTemplates().add(template.getSchema().getKey());
- }
- for (MVirAttrTemplate template : role.findInheritedTemplates(MVirAttrTemplate.class)) {
- roleTO.getMVirAttrTemplates().add(template.getSchema().getKey());
- }
-
- roleTO.setPasswordPolicy(role.getPasswordPolicy() == null
- ? null
- : role.getPasswordPolicy().getKey());
- roleTO.setAccountPolicy(role.getAccountPolicy() == null
- ? null
- : role.getAccountPolicy().getKey());
-
- return roleTO;
- }
-
- @Transactional(readOnly = true)
- @Override
- public RoleTO getRoleTO(final Long key) {
- return getRoleTO(roleDAO.authFetch(key));
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
index 091c108..8a1076b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
@@ -28,7 +28,7 @@ import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.PropagationTaskTO;
import org.apache.syncope.common.lib.to.PushTaskTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.SchedTaskTO;
import org.apache.syncope.common.lib.to.SyncTaskTO;
import org.apache.syncope.common.lib.to.TaskExecTO;
@@ -107,7 +107,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
final PushTaskTO pushTaskTO = (PushTaskTO) taskTO;
pushTask.setUserFilter(pushTaskTO.getUserFilter());
- pushTask.setRoleFilter(pushTaskTO.getRoleFilter());
+ pushTask.setGroupFilter(pushTaskTO.getGroupFilter());
pushTask.setMatchingRule(pushTaskTO.getMatchingRule() == null
? MatchingRule.LINK : pushTaskTO.getMatchingRule());
@@ -125,7 +125,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
syncTask.setUnmatchingRule(syncTaskTO.getUnmatchingRule() == null
? UnmatchingRule.PROVISION : syncTaskTO.getUnmatchingRule());
- // 1. validate JEXL expressions in user and role templates
+ // 1. validate JEXL expressions in user and group templates
if (syncTaskTO.getUserTemplate() != null) {
UserTO template = syncTaskTO.getUserTemplate();
@@ -146,8 +146,8 @@ public class TaskDataBinderImpl implements TaskDataBinder {
checkJexl(memb, sce);
}
}
- if (syncTaskTO.getRoleTemplate() != null) {
- RoleTO template = syncTaskTO.getRoleTemplate();
+ if (syncTaskTO.getGroupTemplate() != null) {
+ GroupTO template = syncTaskTO.getGroupTemplate();
if (StringUtils.isNotBlank(template.getName()) && !JexlUtil.isExpressionValid(template.getName())) {
sce.getElements().add("Invalid JEXL: " + template.getName());
@@ -159,9 +159,9 @@ public class TaskDataBinderImpl implements TaskDataBinder {
throw sce;
}
- // 2. all JEXL expressions are valid: accept user and role templates
+ // 2. all JEXL expressions are valid: accept user and group templates
syncTask.setUserTemplate(syncTaskTO.getUserTemplate());
- syncTask.setRoleTemplate(syncTaskTO.getRoleTemplate());
+ syncTask.setGroupTemplate(syncTaskTO.getGroupTemplate());
syncTask.setFullReconciliation(syncTaskTO.isFullReconciliation());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
index af6dbb6..029bb27 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
@@ -45,7 +45,7 @@ import org.apache.syncope.core.persistence.api.entity.membership.MDerAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.common.lib.types.PropagationByResource;
@@ -140,24 +140,24 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
// memberships
- Role role;
+ Group group;
for (MembershipTO membershipTO : userTO.getMemberships()) {
- role = roleDAO.find(membershipTO.getRoleId());
+ group = groupDAO.find(membershipTO.getGroupId());
- if (role == null) {
+ if (group == null) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Ignoring invalid role " + membershipTO.getRoleName());
+ LOG.debug("Ignoring invalid group " + membershipTO.getGroupName());
}
} else {
Membership membership = null;
if (user.getKey() != null) {
- membership = user.getMembership(role.getKey()) == null
- ? membershipDAO.find(user, role)
- : user.getMembership(role.getKey());
+ membership = user.getMembership(group.getKey()) == null
+ ? membershipDAO.find(user, group)
+ : user.getMembership(group.getKey());
}
if (membership == null) {
membership = entityFactory.newEntity(Membership.class);
- membership.setRole(role);
+ membership.setGroup(group);
membership.setUser(user);
user.addMembership(membership);
@@ -244,10 +244,10 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
// attributes, derived attributes, virtual attributes and resources
propByRes.merge(fill(user, userMod, attrUtilFactory.getInstance(AttributableType.USER), scce));
- // store the role ids of membership required to be added
- Set<Long> membershipToBeAddedRoleIds = new HashSet<>();
+ // store the group ids of membership required to be added
+ Set<Long> membershipToBeAddedGroupKeys = new HashSet<>();
for (MembershipMod membToBeAdded : userMod.getMembershipsToAdd()) {
- membershipToBeAddedRoleIds.add(membToBeAdded.getRole());
+ membershipToBeAddedGroupKeys.add(membToBeAdded.getGroup());
}
final Set<String> toBeDeprovisioned = new HashSet<>();
@@ -261,16 +261,16 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
if (membership == null) {
LOG.debug("Invalid membership id specified to be removed: {}", membershipId);
} else {
- if (!membershipToBeAddedRoleIds.contains(membership.getRole().getKey())) {
- toBeDeprovisioned.addAll(membership.getRole().getResourceNames());
+ if (!membershipToBeAddedGroupKeys.contains(membership.getGroup().getKey())) {
+ toBeDeprovisioned.addAll(membership.getGroup().getResourceNames());
}
// In order to make the removeMembership() below to work,
// we need to be sure to take exactly the same membership
// of the user object currently in memory (which has potentially
// some modifications compared to the one stored in the DB
- membership = user.getMembership(membership.getRole().getKey());
- if (membershipToBeAddedRoleIds.contains(membership.getRole().getKey())) {
+ membership = user.getMembership(membership.getGroup().getKey());
+ if (membershipToBeAddedGroupKeys.contains(membership.getGroup().getKey())) {
Set<Long> attributeIds = new HashSet<>(membership.getPlainAttrs().size());
for (PlainAttr attribute : membership.getPlainAttrs()) {
attributeIds.add(attribute.getKey());
@@ -307,21 +307,21 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
// memberships to be added
for (MembershipMod membershipMod : userMod.getMembershipsToAdd()) {
- LOG.debug("Membership to be added: role({})", membershipMod.getRole());
+ LOG.debug("Membership to be added: group({})", membershipMod.getGroup());
- Role role = roleDAO.find(membershipMod.getRole());
- if (role == null) {
- LOG.debug("Ignoring invalid role {}", membershipMod.getRole());
+ Group group = groupDAO.find(membershipMod.getGroup());
+ if (group == null) {
+ LOG.debug("Ignoring invalid group {}", membershipMod.getGroup());
} else {
- Membership membership = user.getMembership(role.getKey());
+ Membership membership = user.getMembership(group.getKey());
if (membership == null) {
membership = entityFactory.newEntity(Membership.class);
- membership.setRole(role);
+ membership.setGroup(group);
membership.setUser(user);
user.addMembership(membership);
- toBeProvisioned.addAll(role.getResourceNames());
+ toBeProvisioned.addAll(group.getResourceNames());
}
propByRes.merge(fill(membership, membershipMod,
@@ -333,7 +333,7 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
propByRes.addAll(ResourceOperation.UPDATE, toBeProvisioned);
/**
- * In case of new memberships all the current resources have to be updated in order to propagate new role and
+ * In case of new memberships all the current resources have to be updated in order to propagate new group and
* membership attribute values.
*/
if (!toBeDeprovisioned.isEmpty() || !toBeProvisioned.isEmpty()) {
@@ -380,8 +380,8 @@ public class UserDataBinderImpl extends AbstractAttributableDataBinder implement
membershipTO.setLastChangeDate(membership.getLastChangeDate());
membershipTO.setKey(membership.getKey());
- membershipTO.setRoleId(membership.getRole().getKey());
- membershipTO.setRoleName(membership.getRole().getName());
+ membershipTO.setGroupId(membership.getGroup().getKey());
+ membershipTO.setGroupName(membership.getGroup().getName());
// SYNCOPE-458 retrieve also membership virtual attributes
connObjectUtil.retrieveVirAttrValues(membership, attrUtilFactory.getInstance(AttributableType.MEMBERSHIP));
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
index 67d5a24..169ac88 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
@@ -28,7 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.common.lib.types.AuditElements;
@@ -36,11 +36,11 @@ import org.apache.syncope.common.lib.types.AuditElements.Result;
import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.ConfDAO;
import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.NotificationDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.TaskDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
@@ -51,14 +51,14 @@ import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.Notification;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.Subject;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.provisioning.api.data.RoleDataBinder;
+import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
import org.apache.syncope.core.misc.ConnObjectUtil;
import org.apache.syncope.core.misc.search.SearchCondConverter;
@@ -107,10 +107,10 @@ public class NotificationManagerImpl implements NotificationManager {
private UserDAO userDAO;
/**
- * Role DAO.
+ * Group DAO.
*/
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
/**
* User Search DAO.
@@ -146,7 +146,7 @@ public class NotificationManagerImpl implements NotificationManager {
private UserDataBinder userDataBinder;
@Autowired
- private RoleDataBinder roleDataBinder;
+ private GroupDataBinder groupDataBinder;
@Autowired
private EntityFactory entityFactory;
@@ -176,13 +176,13 @@ public class NotificationManagerImpl implements NotificationManager {
if (attributable != null) {
connObjectUtil.retrieveVirAttrValues(attributable,
attrUtilFactory.getInstance(
- attributable instanceof User ? AttributableType.USER : AttributableType.ROLE));
+ attributable instanceof User ? AttributableType.USER : AttributableType.GROUP));
}
final List<User> recipients = new ArrayList<>();
if (notification.getRecipients() != null) {
- recipients.addAll(searchDAO.<User>search(RoleEntitlementUtil.getRoleKeys(entitlementDAO.findAll()),
+ recipients.addAll(searchDAO.<User>search(GroupEntitlementUtil.getGroupKeys(entitlementDAO.findAll()),
SearchCondConverter.convert(notification.getRecipients()),
Collections.<OrderByClause>emptyList(), SubjectType.USER));
}
@@ -279,19 +279,19 @@ public class NotificationManagerImpl implements NotificationManager {
} else if (output instanceof UserTO) {
subjectType = SubjectType.USER;
subject = userDAO.find(((UserTO) output).getKey());
- } else if (before instanceof RoleTO) {
- subjectType = SubjectType.ROLE;
- subject = roleDAO.find(((RoleTO) before).getKey());
- } else if (output instanceof RoleTO) {
- subjectType = SubjectType.ROLE;
- subject = roleDAO.find(((RoleTO) output).getKey());
+ } else if (before instanceof GroupTO) {
+ subjectType = SubjectType.GROUP;
+ subject = groupDAO.find(((GroupTO) before).getKey());
+ } else if (output instanceof GroupTO) {
+ subjectType = SubjectType.GROUP;
+ subject = groupDAO.find(((GroupTO) output).getKey());
}
LOG.debug("Search notification for [{}]{}", subjectType, subject);
for (Notification notification : notificationDAO.findAll()) {
LOG.debug("Notification available user about {}", notification.getUserAbout());
- LOG.debug("Notification available role about {}", notification.getRoleAbout());
+ LOG.debug("Notification available group about {}", notification.getGroupAbout());
if (notification.isActive()) {
final Set<String> events = new HashSet<>(notification.getEvents());
@@ -301,11 +301,11 @@ public class NotificationManagerImpl implements NotificationManager {
if (events.isEmpty()) {
LOG.debug("No events found about {}", subject);
} else if (subjectType == null || subject == null
- || notification.getUserAbout() == null || notification.getRoleAbout() == null
+ || notification.getUserAbout() == null || notification.getGroupAbout() == null
|| searchDAO.matches(subject,
SearchCondConverter.convert(notification.getUserAbout()), subjectType)
|| searchDAO.matches(subject,
- SearchCondConverter.convert(notification.getRoleAbout()), subjectType)) {
+ SearchCondConverter.convert(notification.getGroupAbout()), subjectType)) {
LOG.debug("Creating notification task for events {} about {}", events, subject);
@@ -321,16 +321,16 @@ public class NotificationManagerImpl implements NotificationManager {
if (subject instanceof User) {
model.put("user", userDataBinder.getUserTO((User) subject));
- } else if (subject instanceof Role) {
- model.put("role", roleDataBinder.getRoleTO((Role) subject));
+ } else if (subject instanceof Group) {
+ model.put("group", groupDataBinder.getGroupTO((Group) subject));
}
taskDAO.save(getNotificationTask(notification, subject, model));
}
} else {
- LOG.debug("Notification {}, userAbout {}, roleAbout {} is deactivated, "
+ LOG.debug("Notification {}, userAbout {}, groupAbout {} is deactivated, "
+ "notification task will not be created", notification.getKey(),
- notification.getUserAbout(), notification.getRoleAbout());
+ notification.getUserAbout(), notification.getGroupAbout());
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
index 7114f44..4ff9f3e 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
@@ -31,7 +31,7 @@ import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.PropagationMode;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.syncope.common.lib.types.TraceLevel;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.TaskDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
@@ -94,7 +94,7 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
* User DAO.
*/
@Autowired
- protected RoleDAO roleDAO;
+ protected GroupDAO groupDAO;
/**
* Task DAO.
@@ -242,11 +242,11 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
}
break;
- case ROLE:
+ case GROUP:
try {
- subject = roleDAO.authFetch(task.getSubjectKey());
+ subject = groupDAO.authFetch(task.getSubjectKey());
} catch (Exception e) {
- LOG.error("Could not read role {}", task.getSubjectKey(), e);
+ LOG.error("Could not read group {}", task.getSubjectKey(), e);
}
break;
@@ -266,17 +266,17 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
} else {
/*
* We must choose here whether to
- * a. actually delete the provided user / role from the external resource
- * b. just update the provided user / role data onto the external resource
+ * a. actually delete the provided user / group from the external resource
+ * b. just update the provided user / group data onto the external resource
*
- * (a) happens when either there is no user / role associated with the PropagationTask (this takes place
- * when the task is generated via UserController.delete() / RoleController.delete()) or the provided updated
- * user / role hasn't the current resource assigned (when the task is generated via
- * UserController.update() / RoleController.update()).
+ * (a) happens when either there is no user / group associated with the PropagationTask (this takes place
+ * when the task is generated via UserLogic.delete() / GroupLogic.delete()) or the provided updated
+ * user / group hasn't the current resource assigned (when the task is generated via
+ * UserController.update() / GroupLogic.update()).
*
- * (b) happens when the provided updated user / role does have the current resource assigned (when the task
- * is generated via UserController.update() / RoleController.updae()): this basically means that before such
- * update, this user / role used to have the current resource assigned by more than one mean (for example,
+ * (b) happens when the provided updated user / group does have the current resource assigned (when the task
+ * is generated via UserLogic.update() / GroupLogic.updae()): this basically means that before such
+ * update, this user / group used to have the current resource assigned by more than one mean (for example,
* two different memberships with the same resource).
*/
Subject<?, ?, ?> subject = getSubject(task);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
index b3dfc69..0bd204f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPMembershipPropagationActions.java
@@ -27,7 +27,7 @@ import org.apache.commons.jexl2.MapContext;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.misc.jexl.JexlUtil;
@@ -41,8 +41,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
/**
- * Simple action for propagating role memberships to LDAP groups, when the same resource is configured for both users
- * and roles.
+ * Simple action for propagating group memberships to LDAP groups, when the same resource is configured for both users
+ * and groups.
*
* @see org.apache.syncope.core.sync.impl.LDAPMembershipSyncActions
*/
@@ -67,34 +67,34 @@ public class LDAPMembershipPropagationActions extends DefaultPropagationActions
public void before(final PropagationTask task, final ConnectorObject beforeObj) {
super.before(task, beforeObj);
- if (AttributableType.USER == task.getSubjectType() && task.getResource().getRmapping() != null) {
+ if (AttributableType.USER == task.getSubjectType() && task.getResource().getGmapping() != null) {
User user = userDAO.find(task.getSubjectKey());
if (user != null) {
- List<String> roleAccountLinks = new ArrayList<>();
- for (Role role : user.getRoles()) {
- if (role.getResourceNames().contains(task.getResource().getKey())
- && StringUtils.isNotBlank(task.getResource().getRmapping().getAccountLink())) {
+ List<String> groupAccountLinks = new ArrayList<>();
+ for (Group group : user.getGroups()) {
+ if (group.getResourceNames().contains(task.getResource().getKey())
+ && StringUtils.isNotBlank(task.getResource().getGmapping().getAccountLink())) {
- LOG.debug("Evaluating accountLink for {}", role);
+ LOG.debug("Evaluating accountLink for {}", group);
final JexlContext jexlContext = new MapContext();
- JexlUtil.addFieldsToContext(role, jexlContext);
- JexlUtil.addAttrsToContext(role.getPlainAttrs(), jexlContext);
- JexlUtil.addDerAttrsToContext(role.getDerAttrs(), role.getPlainAttrs(), jexlContext);
+ JexlUtil.addFieldsToContext(group, jexlContext);
+ JexlUtil.addAttrsToContext(group.getPlainAttrs(), jexlContext);
+ JexlUtil.addDerAttrsToContext(group.getDerAttrs(), group.getPlainAttrs(), jexlContext);
- final String roleAccountLink =
- JexlUtil.evaluate(task.getResource().getRmapping().getAccountLink(), jexlContext);
- LOG.debug("AccountLink for {} is '{}'", role, roleAccountLink);
- if (StringUtils.isNotBlank(roleAccountLink)) {
- roleAccountLinks.add(roleAccountLink);
+ final String groupAccountLink =
+ JexlUtil.evaluate(task.getResource().getGmapping().getAccountLink(), jexlContext);
+ LOG.debug("AccountLink for {} is '{}'", group, groupAccountLink);
+ if (StringUtils.isNotBlank(groupAccountLink)) {
+ groupAccountLinks.add(groupAccountLink);
}
}
}
- LOG.debug("Role accountLinks to propagate for membership: {}", roleAccountLinks);
+ LOG.debug("Group accountLinks to propagate for membership: {}", groupAccountLinks);
Set<Attribute> attributes = new HashSet<Attribute>(task.getAttributes());
- Set<String> groups = new HashSet<String>(roleAccountLinks);
+ Set<String> groups = new HashSet<String>(groupAccountLinks);
Attribute ldapGroups = AttributeUtil.find(getGroupMembershipAttrName(), attributes);
if (ldapGroups != null) {
@@ -107,7 +107,7 @@ public class LDAPMembershipPropagationActions extends DefaultPropagationActions
task.setAttributes(attributes);
}
} else {
- LOG.debug("Not about user, or role mapping missing for resource: not doing anything");
+ LOG.debug("Not about user, or group mapping missing for resource: not doing anything");
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
index ec4cc0e..3108368 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
@@ -37,7 +37,7 @@ import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.AttributableUtil;
import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
@@ -47,14 +47,14 @@ import org.apache.syncope.core.persistence.api.entity.MappingItem;
import org.apache.syncope.core.persistence.api.entity.Subject;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
import org.apache.syncope.core.provisioning.java.VirAttrHandler;
-import org.apache.syncope.core.misc.security.UnauthorizedRoleException;
+import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
import org.apache.syncope.core.misc.ConnObjectUtil;
import org.apache.syncope.core.misc.MappingUtil;
import org.apache.syncope.core.misc.jexl.JexlUtil;
@@ -84,10 +84,10 @@ public class PropagationManagerImpl implements PropagationManager {
protected UserDAO userDAO;
/**
- * Role DAO.
+ * Group DAO.
*/
@Autowired
- protected RoleDAO roleDAO;
+ protected GroupDAO groupDAO;
/**
* Resource DAO.
@@ -119,12 +119,12 @@ public class PropagationManagerImpl implements PropagationManager {
* @param membershipTOs user memberships
* @return list of propagation tasks
* @throws NotFoundException if user is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given user
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
*/
@Override
public List<PropagationTask> getUserCreateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
final String password, final List<AttrTO> vAttrs, final List<MembershipTO> membershipTOs)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
return getUserCreateTaskIds(wfResult, password, vAttrs, null, membershipTOs);
}
@@ -139,13 +139,13 @@ public class PropagationManagerImpl implements PropagationManager {
* @param membershipTOs user memberships
* @return list of propagation tasks
* @throws NotFoundException if user is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given user
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
*/
@Override
public List<PropagationTask> getUserCreateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
final String password, final Collection<AttrTO> vAttrs,
final Set<String> noPropResourceNames, final List<MembershipTO> membershipTOs)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
return getUserCreateTaskIds(
wfResult.getResult().getKey(),
@@ -166,7 +166,7 @@ public class PropagationManagerImpl implements PropagationManager {
final Collection<AttrTO> vAttrs,
final Collection<MembershipTO> membershipTOs,
final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
User user = userDAO.authFetch(key);
if (vAttrs != null && !vAttrs.isEmpty()) {
@@ -187,66 +187,66 @@ public class PropagationManagerImpl implements PropagationManager {
}
/**
- * Create the role on every associated resource.
+ * Create the group on every associated resource.
*
* @param wfResult user to be propagated (and info associated), as per result from workflow
* @param vAttrs virtual attributes to be set
* @return list of propagation tasks
- * @throws NotFoundException if role is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given role
+ * @throws NotFoundException if group is not found
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
*/
@Override
- public List<PropagationTask> getRoleCreateTaskIds(final WorkflowResult<Long> wfResult, final List<AttrTO> vAttrs)
- throws NotFoundException, UnauthorizedRoleException {
+ public List<PropagationTask> getGroupCreateTaskIds(final WorkflowResult<Long> wfResult, final List<AttrTO> vAttrs)
+ throws NotFoundException, UnauthorizedGroupException {
- return getRoleCreateTaskIds(wfResult, vAttrs, null);
+ return getGroupCreateTaskIds(wfResult, vAttrs, null);
}
/**
- * Create the role on every associated resource.
+ * Create the group on every associated resource.
*
- * @param wfResult role to be propagated (and info associated), as per result from workflow
+ * @param wfResult group to be propagated (and info associated), as per result from workflow
* @param vAttrs virtual attributes to be set
* @param noPropResourceNames external resources performing not to be considered for propagation
* @return list of propagation tasks
- * @throws NotFoundException if role is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given role
+ * @throws NotFoundException if group is not found
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
*/
@Override
- public List<PropagationTask> getRoleCreateTaskIds(
+ public List<PropagationTask> getGroupCreateTaskIds(
final WorkflowResult<Long> wfResult,
final Collection<AttrTO> vAttrs,
final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
- return getRoleCreateTaskIds(wfResult.getResult(), vAttrs, wfResult.getPropByRes(), noPropResourceNames);
+ return getGroupCreateTaskIds(wfResult.getResult(), vAttrs, wfResult.getPropByRes(), noPropResourceNames);
}
/**
- * Create the role on every associated resource.
+ * Create the group on every associated resource.
*
- * @param key role key
+ * @param key group key
* @param vAttrs virtual attributes to be set
* @param propByRes operation to be performed per resource
* @param noPropResourceNames external resources performing not to be considered for propagation
* @return list of propagation tasks
- * @throws NotFoundException if role is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given role
+ * @throws NotFoundException if group is not found
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
*/
@Override
- public List<PropagationTask> getRoleCreateTaskIds(
+ public List<PropagationTask> getGroupCreateTaskIds(
final Long key,
final Collection<AttrTO> vAttrs,
final PropagationByResource propByRes,
final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
- Role role = roleDAO.authFetch(key);
+ Group group = groupDAO.authFetch(key);
if (vAttrs != null && !vAttrs.isEmpty()) {
- virAttrHandler.fillVirtual(role, vAttrs, attrUtilFactory.getInstance(AttributableType.ROLE));
+ virAttrHandler.fillVirtual(group, vAttrs, attrUtilFactory.getInstance(AttributableType.GROUP));
}
- return getCreateTaskIds(role, null, null, propByRes, noPropResourceNames);
+ return getCreateTaskIds(group, null, null, propByRes, noPropResourceNames);
}
protected List<PropagationTask> getCreateTaskIds(final Subject<?, ?, ?> subject,
@@ -298,12 +298,12 @@ public class PropagationManagerImpl implements PropagationManager {
* @param noPropResourceNames external resources not to be considered for propagation
* @return list of propagation tasks
* @throws NotFoundException if user is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given user
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
*/
@Override
public List<PropagationTask> getUserUpdateTaskIds(final WorkflowResult<Map.Entry<UserMod, Boolean>> wfResult,
final boolean changePwd, final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
User user = userDAO.authFetch(wfResult.getResult().getKey().getKey());
return getUpdateTaskIds(user,
@@ -357,41 +357,41 @@ public class PropagationManagerImpl implements PropagationManager {
}
/**
- * Performs update on each resource associated to the role.
+ * Performs update on each resource associated to the group.
*
- * @param wfResult role to be propagated (and info associated), as per result from workflow
+ * @param wfResult group to be propagated (and info associated), as per result from workflow
* @param vAttrsToBeRemoved virtual attributes to be removed
* @param vAttrsToBeUpdated virtual attributes to be added
* @return list of propagation tasks
- * @throws NotFoundException if role is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given role
+ * @throws NotFoundException if group is not found
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
*/
@Override
- public List<PropagationTask> getRoleUpdateTaskIds(final WorkflowResult<Long> wfResult,
+ public List<PropagationTask> getGroupUpdateTaskIds(final WorkflowResult<Long> wfResult,
final Set<String> vAttrsToBeRemoved, final Set<AttrMod> vAttrsToBeUpdated)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
- return getRoleUpdateTaskIds(wfResult, vAttrsToBeRemoved, vAttrsToBeUpdated, null);
+ return getGroupUpdateTaskIds(wfResult, vAttrsToBeRemoved, vAttrsToBeUpdated, null);
}
/**
- * Performs update on each resource associated to the role.
+ * Performs update on each resource associated to the group.
*
- * @param wfResult role to be propagated (and info associated), as per result from workflow
+ * @param wfResult group to be propagated (and info associated), as per result from workflow
* @param vAttrsToBeRemoved virtual attributes to be removed
* @param vAttrsToBeUpdated virtual attributes to be added
* @param noPropResourceNames external resource names not to be considered for propagation
* @return list of propagation tasks
- * @throws NotFoundException if role is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given role
+ * @throws NotFoundException if group is not found
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
*/
- public List<PropagationTask> getRoleUpdateTaskIds(final WorkflowResult<Long> wfResult,
+ public List<PropagationTask> getGroupUpdateTaskIds(final WorkflowResult<Long> wfResult,
final Set<String> vAttrsToBeRemoved, final Set<AttrMod> vAttrsToBeUpdated,
final Set<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
- Role role = roleDAO.authFetch(wfResult.getResult());
- return getUpdateTaskIds(role, null, false, null,
+ Group group = groupDAO.authFetch(wfResult.getResult());
+ return getUpdateTaskIds(group, null, false, null,
vAttrsToBeRemoved, vAttrsToBeUpdated, wfResult.getPropByRes(), noPropResourceNames,
Collections.<MembershipMod>emptySet());
}
@@ -473,11 +473,11 @@ public class PropagationManagerImpl implements PropagationManager {
* @param userKey to be deleted
* @return list of propagation tasks
* @throws NotFoundException if user is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given user
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
*/
@Override
public List<PropagationTask> getUserDeleteTaskIds(final Long userKey)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
return getUserDeleteTaskIds(userKey, Collections.<String>emptySet());
}
@@ -491,11 +491,11 @@ public class PropagationManagerImpl implements PropagationManager {
* @param noPropResourceName name of external resource not to be considered for propagation
* @return list of propagation tasks
* @throws NotFoundException if user is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given user
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
*/
@Override
public List<PropagationTask> getUserDeleteTaskIds(final Long userKey, final String noPropResourceName)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
return getUserDeleteTaskIds(userKey, Collections.<String>singleton(noPropResourceName));
}
@@ -508,11 +508,11 @@ public class PropagationManagerImpl implements PropagationManager {
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
* @throws NotFoundException if user is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given user
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
*/
@Override
public List<PropagationTask> getUserDeleteTaskIds(final Long userKey, final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
User user = userDAO.authFetch(userKey);
return getDeleteTaskIds(user, user.getResourceNames(), noPropResourceNames);
@@ -528,12 +528,12 @@ public class PropagationManagerImpl implements PropagationManager {
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
* @throws NotFoundException if user is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given user
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given user
*/
@Override
public List<PropagationTask> getUserDeleteTaskIds(
final Long userKey, final Set<String> resourceNames, final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedRoleException {
+ throws NotFoundException, UnauthorizedGroupException {
User user = userDAO.authFetch(userKey);
return getDeleteTaskIds(user, resourceNames, noPropResourceNames);
@@ -554,38 +554,38 @@ public class PropagationManagerImpl implements PropagationManager {
}
/**
- * Perform delete on each resource associated to the role. It is possible to ask for a mandatory provisioning for
+ * Perform delete on each resource associated to the group. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param roleKey to be deleted
+ * @param groupKey to be deleted
* @return list of propagation tasks
- * @throws NotFoundException if role is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given role
+ * @throws NotFoundException if group is not found
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
*/
@Override
- public List<PropagationTask> getRoleDeleteTaskIds(final Long roleKey)
- throws NotFoundException, UnauthorizedRoleException {
+ public List<PropagationTask> getGroupDeleteTaskIds(final Long groupKey)
+ throws NotFoundException, UnauthorizedGroupException {
- return getRoleDeleteTaskIds(roleKey, Collections.<String>emptySet());
+ return getGroupDeleteTaskIds(groupKey, Collections.<String>emptySet());
}
/**
- * Perform delete on each resource associated to the role. It is possible to ask for a mandatory provisioning for
+ * Perform delete on each resource associated to the group. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param roleKey to be deleted
+ * @param groupKey to be deleted
* @param noPropResourceName name of external resource not to be considered for propagation
* @return list of propagation tasks
- * @throws NotFoundException if role is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given role
+ * @throws NotFoundException if group is not found
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
*/
@Override
- public List<PropagationTask> getRoleDeleteTaskIds(final Long roleKey, final String noPropResourceName)
- throws NotFoundException, UnauthorizedRoleException {
+ public List<PropagationTask> getGroupDeleteTaskIds(final Long groupKey, final String noPropResourceName)
+ throws NotFoundException, UnauthorizedGroupException {
- return getRoleDeleteTaskIds(roleKey, Collections.<String>singleton(noPropResourceName));
+ return getGroupDeleteTaskIds(groupKey, Collections.<String>singleton(noPropResourceName));
}
/**
@@ -593,18 +593,19 @@ public class PropagationManagerImpl implements PropagationManager {
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param roleKey to be deleted
+ * @param groupKey to be deleted
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
- * @throws NotFoundException if role is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given role
+ * @throws NotFoundException if group is not found
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
*/
@Override
- public List<PropagationTask> getRoleDeleteTaskIds(final Long roleKey, final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedRoleException {
+ public List<PropagationTask> getGroupDeleteTaskIds(
+ final Long groupKey, final Collection<String> noPropResourceNames)
+ throws NotFoundException, UnauthorizedGroupException {
- Role role = roleDAO.authFetch(roleKey);
- return getDeleteTaskIds(role, role.getResourceNames(), noPropResourceNames);
+ Group group = groupDAO.authFetch(groupKey);
+ return getDeleteTaskIds(group, group.getResourceNames(), noPropResourceNames);
}
/**
@@ -612,20 +613,20 @@ public class PropagationManagerImpl implements PropagationManager {
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
- * @param roleKey to be deleted
- * @param resourceNames resource from which role is to be deleted
+ * @param groupKey to be deleted
+ * @param resourceNames resource from which group is to be deleted
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
- * @throws NotFoundException if role is not found
- * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given role
+ * @throws NotFoundException if group is not found
+ * @throws UnauthorizedGroupException if caller doesn't own enough entitlements to administer the given group
*/
@Override
- public List<PropagationTask> getRoleDeleteTaskIds(
- final Long roleKey, final Set<String> resourceNames, final Collection<String> noPropResourceNames)
- throws NotFoundException, UnauthorizedRoleException {
+ public List<PropagationTask> getGroupDeleteTaskIds(
+ final Long groupKey, final Set<String> resourceNames, final Collection<String> noPropResourceNames)
+ throws NotFoundException, UnauthorizedGroupException {
- Role role = roleDAO.authFetch(roleKey);
- return getDeleteTaskIds(role, resourceNames, noPropResourceNames);
+ Group group = groupDAO.authFetch(groupKey);
+ return getDeleteTaskIds(group, resourceNames, noPropResourceNames);
}
protected List<PropagationTask> getDeleteTaskIds(
@@ -644,7 +645,7 @@ public class PropagationManagerImpl implements PropagationManager {
/**
* Create propagation tasks.
*
- * @param subject user / role to be provisioned
+ * @param subject user / group to be provisioned
* @param password cleartext password to be provisioned
* @param changePwd whether password should be included for propagation attributes or not
* @param vAttrsToBeRemoved virtual attributes to be removed
@@ -652,7 +653,7 @@ public class PropagationManagerImpl implements PropagationManager {
* @param membVAttrsToBeRemoved membership virtual attributes to be removed
* @param membVAttrsToBeUpdatedMap membership virtual attributes to be added
* @param enable whether user must be enabled or not
- * @param deleteOnResource whether user / role must be deleted anyway from external resource or not
+ * @param deleteOnResource whether user / group must be deleted anyway from external resource or not
* @param propByRes operation to be performed per resource
* @return list of propagation tasks created
*/
@@ -752,7 +753,7 @@ public class PropagationManagerImpl implements PropagationManager {
protected MembershipTO findMembershipTO(final Membership membership, final Collection<MembershipTO> memberships) {
for (MembershipTO membershipTO : memberships) {
- if (membershipTO.getRoleId() == membership.getRole().getKey()) {
+ if (membershipTO.getGroupId() == membership.getGroup().getKey()) {
return membershipTO;
}
}
@@ -762,7 +763,7 @@ public class PropagationManagerImpl implements PropagationManager {
protected MembershipMod findMembershipMod(final Membership membership, final Set<MembershipMod> membershipMods) {
for (MembershipMod membershipMod : membershipMods) {
- if (membershipMod.getRole() == membership.getRole().getKey()) {
+ if (membershipMod.getGroup() == membership.getGroup().getKey()) {
return membershipMod;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
index 59c665d..197d4d5 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJob.java
@@ -27,7 +27,7 @@ import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.role.RMapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMapping;
import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
import org.apache.syncope.core.persistence.api.entity.task.PushTask;
import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
@@ -136,7 +136,7 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
uSuccCreate.add(provResult);
break;
- case ROLE:
+ case GROUP:
rSuccCreate.add(provResult);
break;
@@ -150,7 +150,7 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
uSuccUpdate.add(provResult);
break;
- case ROLE:
+ case GROUP:
rSuccUpdate.add(provResult);
break;
@@ -164,7 +164,7 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
uSuccDelete.add(provResult);
break;
- case ROLE:
+ case GROUP:
rSuccDelete.add(provResult);
break;
@@ -178,7 +178,7 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
uSuccNone.add(provResult);
break;
- case ROLE:
+ case GROUP:
rSuccNone.add(provResult);
break;
@@ -198,7 +198,7 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
uFailCreate.add(provResult);
break;
- case ROLE:
+ case GROUP:
rFailCreate.add(provResult);
break;
@@ -212,7 +212,7 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
uFailUpdate.add(provResult);
break;
- case ROLE:
+ case GROUP:
rFailUpdate.add(provResult);
break;
@@ -226,7 +226,7 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
uFailDelete.add(provResult);
break;
- case ROLE:
+ case GROUP:
rFailDelete.add(provResult);
break;
@@ -251,7 +251,7 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
append("[deleted/failures]: ").append(uSuccDelete.size()).append('/').append(uFailDelete.size()).
append(' ').
append("[ignored]: ").append(uSuccNone.size()).append('\n');
- report.append("Roles ").
+ report.append("Groups ").
append("[created/failures]: ").append(rSuccCreate.size()).append('/').append(rFailCreate.size()).
append(' ').
append("[updated/failures]: ").append(rSuccUpdate.size()).append('/').append(rFailUpdate.size()).
@@ -276,15 +276,15 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
}
if (!rFailCreate.isEmpty()) {
- report.append("\n\nRoles failed to create: ");
+ report.append("\n\nGroups failed to create: ");
report.append(ProvisioningResult.produceReport(rFailCreate, syncTraceLevel));
}
if (!rFailUpdate.isEmpty()) {
- report.append("\nRoles failed to update: ");
+ report.append("\nGroups failed to update: ");
report.append(ProvisioningResult.produceReport(rFailUpdate, syncTraceLevel));
}
if (!rFailDelete.isEmpty()) {
- report.append("\nRoles failed to delete: ");
+ report.append("\nGroups failed to delete: ");
report.append(ProvisioningResult.produceReport(rFailDelete, syncTraceLevel));
}
}
@@ -299,13 +299,13 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
.append(ProvisioningResult.produceReport(uSuccDelete, syncTraceLevel))
.append("\nUsers ignored:\n")
.append(ProvisioningResult.produceReport(uSuccNone, syncTraceLevel));
- report.append("\n\nRoles created:\n")
+ report.append("\n\nGroups created:\n")
.append(ProvisioningResult.produceReport(rSuccCreate, syncTraceLevel))
- .append("\nRoles updated:\n")
+ .append("\nGroups updated:\n")
.append(ProvisioningResult.produceReport(rSuccUpdate, syncTraceLevel))
- .append("\nRoles deleted:\n")
+ .append("\nGroups deleted:\n")
.append(ProvisioningResult.produceReport(rSuccDelete, syncTraceLevel))
- .append("\nRoles ignored:\n")
+ .append("\nGroups ignored:\n")
.append(ProvisioningResult.produceReport(rSuccNone, syncTraceLevel));
}
@@ -350,13 +350,13 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
throw new JobExecutionException(
"Invalid user account id mapping for resource " + syncTask.getResource());
}
- final RMapping rMapping = syncTask.getResource().getRmapping();
+ final GMapping rMapping = syncTask.getResource().getGmapping();
if (rMapping != null && rMapping.getAccountIdItem() == null) {
throw new JobExecutionException(
- "Invalid role account id mapping for resource " + syncTask.getResource());
+ "Invalid group account id mapping for resource " + syncTask.getResource());
}
if (uMapping == null && rMapping == null) {
- return "No mapping configured for both users and roles: aborting...";
+ return "No mapping configured for both users and groups: aborting...";
}
return executeWithSecurityContext(
@@ -378,7 +378,7 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte
final T task,
final Connector connector,
final UMapping uMapping,
- final RMapping rMapping,
+ final GMapping rMapping,
final boolean dryRun) throws JobExecutionException;
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
index 42dfedd..de222bd 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
@@ -346,7 +346,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
for (Membership membership : User.class.cast(sbj).getMemberships()) {
final MembershipMod membershipMod = new MembershipMod();
membershipMod.setKey(membership.getKey());
- membershipMod.setRole(membership.getRole().getKey());
+ membershipMod.setGroup(membership.getGroup().getKey());
for (VirAttr vattr : membership.getVirAttrs()) {
membVattrToBeRemoved.remove(vattr.getSchema().getKey());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
index 02b9a1a..5b9b3a7 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
@@ -35,7 +35,7 @@ import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
import org.apache.syncope.core.provisioning.api.AttributableTransformer;
import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.sync.SyncActions;
-import org.apache.syncope.core.misc.security.UnauthorizedRoleException;
+import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
import org.apache.syncope.core.provisioning.api.sync.SyncopeSyncResultHandler;
import org.identityconnectors.framework.common.objects.SyncDelta;
@@ -60,7 +60,8 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
protected abstract AbstractSubjectMod getSubjectMod(AbstractSubjectTO subjectTO, SyncDelta delta);
- protected abstract AbstractSubjectTO create(AbstractSubjectTO subjectTO, SyncDelta _delta, ProvisioningResult result);
+ protected abstract AbstractSubjectTO create(
+ AbstractSubjectTO subjectTO, SyncDelta _delta, ProvisioningResult result);
protected abstract AbstractSubjectTO link(AbstractSubjectTO before, ProvisioningResult result, boolean unlink);
@@ -497,7 +498,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
} catch (NotFoundException e) {
LOG.error("Could not find {} {}", attrUtil.getType(), id, e);
- } catch (UnauthorizedRoleException e) {
+ } catch (UnauthorizedGroupException e) {
LOG.error("Not allowed to read {} {}", attrUtil.getType(), id, e);
} catch (Exception e) {
LOG.error("Could not delete {} {}", attrUtil.getType(), id, e);
@@ -532,7 +533,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
}
/**
- * Look into SyncDelta and take necessary profile.getActions() (create / update / delete) on user(s)/role(s).
+ * Look into SyncDelta and take necessary profile.getActions() (create / update / delete) on user(s)/group(s).
*
* @param delta returned by the underlying profile.getConnector()
* @throws JobExecutionException in case of synchronization failure.
[56/57] syncope git commit: [SYNCOPE-119] Merge from master
Posted by il...@apache.org.
[SYNCOPE-119] Merge from master
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4115c57b
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4115c57b
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4115c57b
Branch: refs/heads/master
Commit: 4115c57b93135ec0881cd99aa317440d0ae3f5c8
Parents: 65d652a bfa7172
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 21 09:43:54 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 21 09:43:54 2015 +0200
----------------------------------------------------------------------
.../client/lib/RestClientExceptionMapper.java | 17 +--
.../client/lib/RestClientFactoryBean.java | 2 +
.../syncope/client/lib/SyncopeClient.java | 2 +-
.../syncope/client/lib/ConcurrencyTest.java | 6 +-
.../apache/syncope/core/logic/UserLogic.java | 2 +-
.../syncope/core/misc/ConnObjectUtils.java | 73 +++++-----
.../apache/syncope/core/misc/MappingUtils.java | 13 +-
.../syncope/core/misc/security/Encryptor.java | 2 +-
.../api/entity/AttributableUtils.java | 2 -
.../jpa/entity/JPAAttributableUtils.java | 17 ---
.../core/persistence/jpa/entity/PolicyTest.java | 14 --
.../core/persistence/jpa/entity/RealmTest.java | 8 +-
.../core/persistence/jpa/entity/UserTest.java | 2 +-
core/rest-cxf/pom.xml | 6 +-
.../rest/cxf/RestServiceExceptionMapper.java | 53 +++++--
.../src/main/resources/errorMessages.properties | 17 +++
fit/core-reference/pom.xml | 7 +
.../fit/core/reference/ConnectorITCase.java | 2 +-
.../core/reference/ExceptionMapperITCase.java | 143 +++++++++++++++++++
.../fit/core/reference/SyncTaskITCase.java | 10 ++
pom.xml | 8 +-
21 files changed, 292 insertions(+), 114 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientExceptionMapper.java
----------------------------------------------------------------------
diff --cc client/lib/src/main/java/org/apache/syncope/client/lib/RestClientExceptionMapper.java
index bb772bc,bcf7d03..d334c30
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientExceptionMapper.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientExceptionMapper.java
@@@ -84,9 -85,9 +85,8 @@@ public class RestClientExceptionMapper
final SyncopeClientCompositeException compException = SyncopeClientException.buildComposite();
-- final Set<String> handledExceptions = new HashSet<String>();
- for (Object exceptionTypeValue : exTypesInHeaders) {
- final String exTypeAsString = (String) exceptionTypeValue;
- for (int i = 0; i < exTypesInHeaders.size(); i++) {
- String exTypeAsString = exTypesInHeaders.get(i);
++ Set<String> handledExceptions = new HashSet<>();
++ for (String exTypeAsString : exTypesInHeaders) {
ClientExceptionType exceptionType = null;
try {
exceptionType = ClientExceptionType.fromHeaderValue(exTypeAsString);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
----------------------------------------------------------------------
diff --cc client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
index ca1c5d2,04b3892..f7a00df
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
@@@ -62,6 -62,8 +62,8 @@@ public class RestClientFactoryBean exte
setServiceClass(serviceClass);
final T serviceInstance = create(serviceClass);
WebClient.client(serviceInstance).type(mediaType).accept(mediaType);
- WebClient.getConfig(WebClient.client(serviceInstance)).getRequestContext().
- put("org.apache.cxf.http.header.split", true);
++ WebClient.getConfig(WebClient.client(serviceInstance)).
++ getRequestContext().put("org.apache.cxf.http.header.split", true);
return serviceInstance;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
----------------------------------------------------------------------
diff --cc client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
index c3f4428,2034ce6..c921272
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
@@@ -108,28 -90,6 +108,28 @@@ public class SyncopeClient
}
}
+ @SuppressWarnings("unchecked")
+ public Pair<Map<Entitlement, Set<String>>, UserTO> self() {
+ Response response = getService(UserSelfService.class).read();
+ if (response.getStatusInfo().getStatusCode() != Response.Status.OK.getStatusCode()) {
+ Exception ex = exceptionMapper.fromResponse(response);
+ if (ex != null) {
+ throw (RuntimeException) ex;
+ }
+ }
+
+ try {
+ return new ImmutablePair<>(
+ (Map<Entitlement, Set<String>>) new ObjectMapper().readValue(
- response.getHeaderString(RESTHeaders.OWNED_ENTITLEMENTS),
++ response.getHeaderString(RESTHeaders.OWNED_ENTITLEMENTS).replaceAll("%2C", ","),
+ new TypeReference<HashMap<Entitlement, Set<String>>>() {
+ }),
+ response.readEntity(UserTO.class));
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
/**
* Sets the given header on the give service instance.
*
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
----------------------------------------------------------------------
diff --cc core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index 4929d62,17e577b..10a3650
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@@ -121,27 -120,31 +121,27 @@@ public class UserLogic extends Abstract
@PreAuthorize("hasRole('USER_LIST')")
@Transactional(readOnly = true, rollbackFor = { Throwable.class })
@Override
- public int searchCount(final SearchCond searchCondition) {
- return searchDAO.count(RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames()),
- searchCondition, SubjectType.USER);
- }
+ public List<UserTO> list(
+ final int page, final int size, final List<OrderByClause> orderBy, final List<String> realms) {
- @PreAuthorize("hasRole('USER_LIST')")
- @Transactional(readOnly = true, rollbackFor = { Throwable.class })
- @Override
- public List<UserTO> list(final int page, final int size, final List<OrderByClause> orderBy) {
- Set<Long> adminRoleIds = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
+ return CollectionUtils.collect(userDAO.findAll(
+ getEffectiveRealms(AuthContextUtils.getAuthorizations().get(Entitlement.USER_LIST), realms),
+ page, size, orderBy),
+ new Transformer<User, UserTO>() {
- List<User> users = userDAO.findAll(adminRoleIds, page, size, orderBy);
- List<UserTO> userTOs = new ArrayList<>(users.size());
- for (User user : users) {
- userTOs.add(binder.getUserTO(user));
- }
-
- return userTOs;
+ @Override
+ public UserTO transform(final User input) {
+ return binder.getUserTO(input);
+ }
+ }, new ArrayList<UserTO>());
}
- @PreAuthorize("isAuthenticated() "
- + "and not(hasRole(T(org.apache.syncope.common.lib.SyncopeConstants).ANONYMOUS_ENTITLEMENT))")
+ @PreAuthorize("isAuthenticated()")
@Transactional(readOnly = true)
- public UserTO readSelf() {
- return binder.getAuthenticatedUserTO();
+ public Pair<String, UserTO> readSelf() {
+ return ImmutablePair.of(
- POJOHelper.serialize(AuthContextUtils.getAuthorizations()),
++ POJOHelper.serialize(AuthContextUtils.getAuthorizations()).replaceAll(",", "%2C"),
+ binder.getAuthenticatedUserTO());
}
@PreAuthorize("hasRole('USER_READ')")
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java
----------------------------------------------------------------------
diff --cc core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java
index 2b10228,0000000..74c0b41
mode 100644,000000..100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java
@@@ -1,746 -1,0 +1,741 @@@
+/*
+ * 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.misc;
+
+import org.apache.syncope.core.misc.policy.InvalidPasswordPolicySpecException;
+import org.apache.syncope.core.misc.security.PasswordGenerator;
+import org.apache.syncope.core.misc.security.SecureRandomUtils;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.AttributableOperations;
+import org.apache.syncope.common.lib.mod.AbstractAttributableMod;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.MembershipTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.common.lib.types.PasswordPolicySpec;
+import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
+import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
+import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
+import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+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.Attributable;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.Subject;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+import org.apache.syncope.core.persistence.api.entity.membership.Membership;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.provisioning.api.Connector;
+import org.apache.syncope.core.provisioning.api.ConnectorFactory;
+import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
+import org.apache.syncope.core.provisioning.api.cache.VirAttrCacheValue;
+import org.apache.syncope.core.misc.security.Encryptor;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.identityconnectors.common.Base64;
+import org.identityconnectors.common.security.GuardedByteArray;
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.OperationOptions;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+public class ConnObjectUtils {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(ConnObjectUtils.class);
+
+ @Autowired
- private PolicyDAO policyDAO;
-
- @Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
+ private UserDAO userDAO;
+
+ @Autowired
+ private GroupDAO groupDAO;
+
+ @Autowired
+ private ExternalResourceDAO resourceDAO;
+
+ @Autowired
+ private PlainSchemaDAO plainSchemaDAO;
+
+ @Autowired
+ private PasswordGenerator pwdGen;
+
+ private final Encryptor encryptor = Encryptor.getInstance();
+
+ /**
+ * Virtual attribute cache.
+ */
+ @Autowired
+ private VirAttrCache virAttrCache;
+
+ public ObjectClass fromSubject(final Subject<?, ?, ?> subject) {
+ if (subject == null) {
+ throw new IllegalArgumentException("No ObjectClass could be provided for " + subject);
+ }
+
+ ObjectClass result = null;
+ if (subject instanceof User) {
+ result = ObjectClass.ACCOUNT;
+ }
+ if (subject instanceof Group) {
+ result = ObjectClass.GROUP;
+ }
+
+ return result;
+ }
+
+ /**
+ * Build a UserTO / GroupTO out of connector object attributes and schema mapping.
+ *
+ * @param obj connector object
+ * @param syncTask synchronization task
+ * @param attrUtils AttributableUtils
+ * @param <T> user/group
+ * @return UserTO for the user to be created
+ */
+ @Transactional(readOnly = true)
+ public <T extends AbstractSubjectTO> T getSubjectTO(final ConnectorObject obj, final SyncTask syncTask,
+ final AttributableUtils attrUtils) {
+
+ T subjectTO = getSubjectTOFromConnObject(obj, syncTask, attrUtils);
+
+ // (for users) if password was not set above, generate
+ if (subjectTO instanceof UserTO && StringUtils.isBlank(((UserTO) subjectTO).getPassword())) {
+ final UserTO userTO = (UserTO) subjectTO;
+
+ List<PasswordPolicySpec> ppSpecs = new ArrayList<>();
+
+ Realm realm = realmDAO.find(userTO.getRealm());
+ if (realm != null) {
+ for (Realm ancestor : realmDAO.findAncestors(realm)) {
+ if (ancestor.getPasswordPolicy() != null
+ && ancestor.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
+
+ ppSpecs.add(ancestor.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
+ }
+ }
+ }
+
+ for (String resName : userTO.getResources()) {
+ ExternalResource resource = resourceDAO.find(resName);
+ if (resource != null && resource.getPasswordPolicy() != null
+ && resource.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
+
+ ppSpecs.add(resource.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
+ }
+ }
+
+ String password;
+ try {
+ password = pwdGen.generate(ppSpecs);
+ } catch (InvalidPasswordPolicySpecException e) {
+ LOG.error("Could not generate policy-compliant random password for {}", userTO, e);
+
+ password = SecureRandomUtils.generateRandomPassword(16);
+ }
+ userTO.setPassword(password);
+ }
+
+ return subjectTO;
+ }
+
+ /**
+ * Build an UserMod out of connector object attributes and schema mapping.
+ *
+ * @param key user to be updated
+ * @param obj connector object
+ * @param original subject to get diff from
+ * @param syncTask synchronization task
+ * @param attrUtils AttributableUtil
+ * @param <T> user/group
+ * @return modifications for the user/group to be updated
+ */
+ @SuppressWarnings("unchecked")
+ @Transactional(readOnly = true)
+ public <T extends AbstractAttributableMod> T getAttributableMod(final Long key, final ConnectorObject obj,
+ final AbstractAttributableTO original, final SyncTask syncTask, final AttributableUtils attrUtils) {
+
+ final AbstractAttributableTO updated = getSubjectTOFromConnObject(obj, syncTask, attrUtils);
+ updated.setKey(key);
+
+ if (AttributableType.USER == attrUtils.getType()) {
+ // update password if and only if password is really changed
+ final User user = userDAO.authFetch(key);
+ if (StringUtils.isBlank(((UserTO) updated).getPassword())
+ || encryptor.verify(((UserTO) updated).getPassword(),
+ user.getCipherAlgorithm(), user.getPassword())) {
+
+ ((UserTO) updated).setPassword(null);
+ }
+
+ for (MembershipTO membTO : ((UserTO) updated).getMemberships()) {
+ Membership memb = user.getMembership(membTO.getGroupKey());
+ if (memb != null) {
+ membTO.setKey(memb.getKey());
+ }
+ }
+
+ return (T) AttributableOperations.diff(((UserTO) updated), ((UserTO) original), true);
+ }
+ if (AttributableType.GROUP == attrUtils.getType()) {
+ return (T) AttributableOperations.diff(((GroupTO) updated), ((GroupTO) original), true);
+ }
+
+ return null;
+ }
+
+ private <T extends AbstractSubjectTO> T getSubjectTOFromConnObject(final ConnectorObject obj,
+ final SyncTask syncTask, final AttributableUtils attrUtils) {
+
+ final T subjectTO = attrUtils.newSubjectTO();
+
+ // 1. fill with data from connector object
+ subjectTO.setRealm(syncTask.getDestinatioRealm().getFullPath());
- for (MappingItem item : attrUtils.getUidToMappingItems(
- syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)) {
-
- Attribute attribute = obj.getAttributeByName(item.getExtAttrName());
++ for (MappingItem item : attrUtils.getMappingItems(syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)) {
++ Attribute attr = obj.getAttributeByName(item.getExtAttrName());
+
- AttrTO attributeTO;
++ AttrTO attrTO;
+ switch (item.getIntMappingType()) {
+ case UserId:
+ case GroupId:
+ break;
+
+ case Password:
- if (subjectTO instanceof UserTO && attribute != null && attribute.getValue() != null
- && !attribute.getValue().isEmpty()) {
++ if (subjectTO instanceof UserTO && attr != null && attr.getValue() != null
++ && !attr.getValue().isEmpty()) {
+
- ((UserTO) subjectTO).setPassword(getPassword(attribute.getValue().get(0)));
++ ((UserTO) subjectTO).setPassword(getPassword(attr.getValue().get(0)));
+ }
+ break;
+
+ case Username:
+ if (subjectTO instanceof UserTO) {
- ((UserTO) subjectTO).setUsername(attribute == null || attribute.getValue().isEmpty()
- || attribute.getValue().get(0) == null
++ ((UserTO) subjectTO).setUsername(attr == null || attr.getValue().isEmpty()
++ || attr.getValue().get(0) == null
+ ? null
- : attribute.getValue().get(0).toString());
++ : attr.getValue().get(0).toString());
+ }
+ break;
+
+ case GroupName:
+ if (subjectTO instanceof GroupTO) {
- ((GroupTO) subjectTO).setName(attribute == null || attribute.getValue().isEmpty()
- || attribute.getValue().get(0) == null
++ ((GroupTO) subjectTO).setName(attr == null || attr.getValue().isEmpty()
++ || attr.getValue().get(0) == null
+ ? null
- : attribute.getValue().get(0).toString());
++ : attr.getValue().get(0).toString());
+ }
+ break;
+
+ case GroupOwnerSchema:
- if (subjectTO instanceof GroupTO && attribute != null) {
++ if (subjectTO instanceof GroupTO && attr != null) {
+ // using a special attribute (with schema "", that will be ignored) for carrying the
+ // GroupOwnerSchema value
- attributeTO = new AttrTO();
- attributeTO.setSchema(StringUtils.EMPTY);
- if (attribute.getValue().isEmpty() || attribute.getValue().get(0) == null) {
- attributeTO.getValues().add(StringUtils.EMPTY);
++ attrTO = new AttrTO();
++ attrTO.setSchema(StringUtils.EMPTY);
++ if (attr.getValue().isEmpty() || attr.getValue().get(0) == null) {
++ attrTO.getValues().add(StringUtils.EMPTY);
+ } else {
- attributeTO.getValues().add(attribute.getValue().get(0).toString());
++ attrTO.getValues().add(attr.getValue().get(0).toString());
+ }
+
- ((GroupTO) subjectTO).getPlainAttrs().add(attributeTO);
++ ((GroupTO) subjectTO).getPlainAttrs().add(attrTO);
+ }
+ break;
+
+ case UserPlainSchema:
+ case GroupPlainSchema:
- attributeTO = new AttrTO();
- attributeTO.setSchema(item.getIntAttrName());
++ attrTO = new AttrTO();
++ attrTO.setSchema(item.getIntAttrName());
+
+ PlainSchema schema = plainSchemaDAO.find(item.getIntAttrName(), attrUtils.plainSchemaClass());
+
- for (Object value : attribute == null || attribute.getValue() == null
++ for (Object value : attr == null || attr.getValue() == null
+ ? Collections.emptyList()
- : attribute.getValue()) {
++ : attr.getValue()) {
+
+ AttrSchemaType schemaType = schema == null ? AttrSchemaType.String : schema.getType();
+ if (value != null) {
+ final PlainAttrValue attrValue = attrUtils.newPlainAttrValue();
+ switch (schemaType) {
+ case String:
+ attrValue.setStringValue(value.toString());
+ break;
+
+ case Binary:
+ attrValue.setBinaryValue((byte[]) value);
+ break;
+
+ default:
+ try {
+ attrValue.parseValue(schema, value.toString());
+ } catch (ParsingValidationException e) {
+ LOG.error("While parsing provided value {}", value, e);
+ attrValue.setStringValue(value.toString());
+ schemaType = AttrSchemaType.String;
+ }
+ break;
+ }
- attributeTO.getValues().add(attrValue.getValueAsString(schemaType));
++ attrTO.getValues().add(attrValue.getValueAsString(schemaType));
+ }
+ }
+
- subjectTO.getPlainAttrs().add(attributeTO);
++ subjectTO.getPlainAttrs().add(attrTO);
+ break;
+
+ case UserDerivedSchema:
+ case GroupDerivedSchema:
- attributeTO = new AttrTO();
- attributeTO.setSchema(item.getIntAttrName());
- subjectTO.getDerAttrs().add(attributeTO);
++ attrTO = new AttrTO();
++ attrTO.setSchema(item.getIntAttrName());
++ subjectTO.getDerAttrs().add(attrTO);
+ break;
+
+ case UserVirtualSchema:
+ case GroupVirtualSchema:
- attributeTO = new AttrTO();
- attributeTO.setSchema(item.getIntAttrName());
++ attrTO = new AttrTO();
++ attrTO.setSchema(item.getIntAttrName());
+
- for (Object value : attribute == null || attribute.getValue() == null
++ for (Object value : attr == null || attr.getValue() == null
+ ? Collections.emptyList()
- : attribute.getValue()) {
++ : attr.getValue()) {
+
+ if (value != null) {
- attributeTO.getValues().add(value.toString());
++ attrTO.getValues().add(value.toString());
+ }
+ }
+
- subjectTO.getVirAttrs().add(attributeTO);
++ subjectTO.getVirAttrs().add(attrTO);
+ break;
+
+ default:
+ }
+ }
+
+ // 2. add data from defined template (if any)
+ AbstractSubjectTO template = AttributableType.USER == attrUtils.getType()
+ ? syncTask.getUserTemplate() : syncTask.getGroupTemplate();
+
+ if (template != null) {
+ if (template.getRealm() != null) {
+ subjectTO.setRealm(template.getRealm());
+ }
+
+ if (template instanceof UserTO) {
+ if (StringUtils.isNotBlank(((UserTO) template).getUsername())) {
+ String evaluated = JexlUtils.evaluate(((UserTO) template).getUsername(), subjectTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ ((UserTO) subjectTO).setUsername(evaluated);
+ }
+ }
+
+ if (StringUtils.isNotBlank(((UserTO) template).getPassword())) {
+ String evaluated = JexlUtils.evaluate(((UserTO) template).getPassword(), subjectTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ ((UserTO) subjectTO).setPassword(evaluated);
+ }
+ }
+
+ Map<Long, MembershipTO> currentMembs = ((UserTO) subjectTO).getMembershipMap();
+ for (MembershipTO membTO : ((UserTO) template).getMemberships()) {
+ MembershipTO membTBU;
+ if (currentMembs.containsKey(membTO.getGroupKey())) {
+ membTBU = currentMembs.get(membTO.getGroupKey());
+ } else {
+ membTBU = new MembershipTO();
+ membTBU.setGroupKey(membTO.getGroupKey());
+ ((UserTO) subjectTO).getMemberships().add(membTBU);
+ }
+ fillFromTemplate(membTBU, membTO);
+ }
+ }
+ if (template instanceof GroupTO) {
+ if (StringUtils.isNotBlank(((GroupTO) template).getName())) {
+ String evaluated = JexlUtils.evaluate(((GroupTO) template).getName(), subjectTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ ((GroupTO) subjectTO).setName(evaluated);
+ }
+ }
+
+ if (((GroupTO) template).getUserOwner() != null) {
+ final User userOwner = userDAO.find(((GroupTO) template).getUserOwner());
+ if (userOwner != null) {
+ ((GroupTO) subjectTO).setUserOwner(userOwner.getKey());
+ }
+ }
+ if (((GroupTO) template).getGroupOwner() != null) {
+ final Group groupOwner = groupDAO.find(((GroupTO) template).getGroupOwner());
+ if (groupOwner != null) {
+ ((GroupTO) subjectTO).setGroupOwner(groupOwner.getKey());
+ }
+ }
+
+ ((GroupTO) subjectTO).getGPlainAttrTemplates().addAll(((GroupTO) template).getGPlainAttrTemplates());
+ ((GroupTO) subjectTO).getGDerAttrTemplates().addAll(((GroupTO) template).getGDerAttrTemplates());
+ ((GroupTO) subjectTO).getGVirAttrTemplates().addAll(((GroupTO) template).getGVirAttrTemplates());
+ ((GroupTO) subjectTO).getMPlainAttrTemplates().addAll(((GroupTO) template).getMPlainAttrTemplates());
+ ((GroupTO) subjectTO).getMDerAttrTemplates().addAll(((GroupTO) template).getMDerAttrTemplates());
+ ((GroupTO) subjectTO).getMVirAttrTemplates().addAll(((GroupTO) template).getMVirAttrTemplates());
+ }
+
+ fillFromTemplate(subjectTO, template);
+
+ for (String resource : template.getResources()) {
+ subjectTO.getResources().add(resource);
+ }
+ }
+
+ return subjectTO;
+ }
+
+ /**
+ * Extract password value from passed value (if instance of GuardedString or GuardedByteArray).
+ *
+ * @param pwd received from the underlying connector
+ * @return password value
+ */
+ public String getPassword(final Object pwd) {
+ final StringBuilder result = new StringBuilder();
+
+ if (pwd instanceof GuardedString) {
+ ((GuardedString) pwd).access(new GuardedString.Accessor() {
+
+ @Override
+ public void access(final char[] clearChars) {
+ result.append(clearChars);
+ }
+ });
+ } else if (pwd instanceof GuardedByteArray) {
+ ((GuardedByteArray) pwd).access(new GuardedByteArray.Accessor() {
+
+ @Override
+ public void access(final byte[] clearBytes) {
+ result.append(new String(clearBytes));
+ }
+ });
+ } else if (pwd instanceof String) {
+ result.append((String) pwd);
+ } else {
+ result.append(pwd.toString());
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * Get connector object TO from a connector object.
+ *
+ * @param connObject connector object.
+ * @return connector object TO.
+ */
+ public ConnObjectTO getConnObjectTO(final ConnectorObject connObject) {
+ final ConnObjectTO connObjectTO = new ConnObjectTO();
+
+ for (Attribute attr : connObject.getAttributes()) {
+ AttrTO attrTO = new AttrTO();
+ attrTO.setSchema(attr.getName());
+
+ if (attr.getValue() != null) {
+ for (Object value : attr.getValue()) {
+ if (value != null) {
+ if (value instanceof GuardedString || value instanceof GuardedByteArray) {
+ attrTO.getValues().add(getPassword(value));
+ } else if (value instanceof byte[]) {
+ attrTO.getValues().add(Base64.encode((byte[]) value));
+ } else {
+ attrTO.getValues().add(value.toString());
+ }
+ }
+ }
+ }
+
+ connObjectTO.getPlainAttrs().add(attrTO);
+ }
+
+ return connObjectTO;
+ }
+
+ /**
+ * Query connected external resources for values to populated virtual attributes associated with the given owner.
+ *
+ * @param owner user or group
+ * @param attrUtils attributable util
+ */
+ public void retrieveVirAttrValues(final Attributable<?, ?, ?> owner, final AttributableUtils attrUtils) {
+ final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
+ final ConnectorFactory connFactory = context.getBean(ConnectorFactory.class);
+
+ final IntMappingType type = attrUtils.getType() == AttributableType.USER
+ ? IntMappingType.UserVirtualSchema : attrUtils.getType() == AttributableType.GROUP
+ ? IntMappingType.GroupVirtualSchema : IntMappingType.MembershipVirtualSchema;
+
+ final Map<String, ConnectorObject> externalResources = new HashMap<>();
+
+ // -----------------------
+ // Retrieve virtual attribute values if and only if they have not been retrieved yet
+ // -----------------------
+ for (VirAttr virAttr : owner.getVirAttrs()) {
+ // reset value set
+ if (virAttr.getValues().isEmpty()) {
+ retrieveVirAttrValue(owner, virAttr, attrUtils, type, externalResources, connFactory);
+ }
+ }
+ // -----------------------
+ }
+
+ private void retrieveVirAttrValue(
+ final Attributable<?, ?, ?> owner,
+ final VirAttr virAttr,
+ final AttributableUtils attrUtils,
+ final IntMappingType type,
+ final Map<String, ConnectorObject> externalResources,
+ final ConnectorFactory connFactory) {
+
+ final String schemaName = virAttr.getSchema().getKey();
+ final VirAttrCacheValue virAttrCacheValue = virAttrCache.get(attrUtils.getType(), owner.getKey(), schemaName);
+
+ LOG.debug("Retrieve values for virtual attribute {} ({})", schemaName, type);
+
+ if (virAttrCache.isValidEntry(virAttrCacheValue)) {
+ // cached ...
+ LOG.debug("Values found in cache {}", virAttrCacheValue);
+ virAttr.getValues().clear();
+ virAttr.getValues().addAll(new ArrayList<>(virAttrCacheValue.getValues()));
+ } else {
+ // not cached ...
+ LOG.debug("Need one or more remote connections");
+
+ final VirAttrCacheValue toBeCached = new VirAttrCacheValue();
+
+ // SYNCOPE-458 if virattr owner is a Membership, owner must become user involved in membership because
+ // membership mapping is contained in user mapping
+ final Subject<?, ?, ?> realOwner = owner instanceof Membership
+ ? ((Membership) owner).getUser()
+ : (Subject) owner;
+
+ final Set<ExternalResource> targetResources = owner instanceof Membership
+ ? getTargetResources(virAttr, type, attrUtils, realOwner.getResources())
+ : getTargetResources(virAttr, type, attrUtils);
+
+ for (ExternalResource resource : targetResources) {
+ LOG.debug("Search values into {}", resource.getKey());
+ try {
+ List<MappingItem> mappings = attrUtils.getMappingItems(resource, MappingPurpose.BOTH);
+
+ ConnectorObject connectorObject;
+ if (externalResources.containsKey(resource.getKey())) {
+ connectorObject = externalResources.get(resource.getKey());
+ } else {
+ LOG.debug("Perform connection to {}", resource.getKey());
+ final String accountId = attrUtils.getAccountIdItem(resource) == null
+ ? null
+ : MappingUtils.getAccountIdValue(
+ realOwner, resource, attrUtils.getAccountIdItem(resource));
+
+ if (StringUtils.isBlank(accountId)) {
+ throw new IllegalArgumentException("No AccountId found for " + resource.getKey());
+ }
+
+ Connector connector = connFactory.getConnector(resource);
+
+ OperationOptions oo =
+ connector.getOperationOptions(MappingUtils.getMatchingMappingItems(mappings, type));
+
+ connectorObject = connector.getObject(fromSubject(realOwner), new Uid(accountId), oo);
+ externalResources.put(resource.getKey(), connectorObject);
+ }
+
+ if (connectorObject != null) {
+ // ask for searched virtual attribute value
+ Collection<MappingItem> virAttrMappings =
+ MappingUtils.getMatchingMappingItems(mappings, schemaName, type);
+
+ // the same virtual attribute could be mapped with one or more external attribute
+ for (MappingItem mapping : virAttrMappings) {
+ final Attribute attribute = connectorObject.getAttributeByName(mapping.getExtAttrName());
+
+ if (attribute != null && attribute.getValue() != null) {
+ for (Object obj : attribute.getValue()) {
+ if (obj != null) {
+ virAttr.getValues().add(obj.toString());
+ }
+ }
+ }
+ }
+
+ toBeCached.setResourceValues(resource.getKey(), new HashSet<>(virAttr.getValues()));
+
+ LOG.debug("Retrieved values {}", virAttr.getValues());
+ }
+ } catch (Exception e) {
+ LOG.error("Error reading connector object from {}", resource.getKey(), e);
+
+ if (virAttrCacheValue != null) {
+ toBeCached.forceExpiring();
+ LOG.debug("Search for a cached value (even expired!) ...");
+ final Set<String> cachedValues = virAttrCacheValue.getValues(resource.getKey());
+ if (cachedValues != null) {
+ LOG.debug("Use cached value {}", cachedValues);
+ virAttr.getValues().addAll(cachedValues);
+ toBeCached.setResourceValues(resource.getKey(), new HashSet<>(cachedValues));
+ }
+ }
+ }
+ }
+
+ virAttrCache.put(attrUtils.getType(), owner.getKey(), schemaName, toBeCached);
+ }
+ }
+
+ private Set<ExternalResource> getTargetResources(
+ final VirAttr attr, final IntMappingType type, final AttributableUtils attrUtils) {
+
+ final Set<ExternalResource> resources = new HashSet<>();
+
+ if (attr.getOwner() instanceof Subject) {
+ for (ExternalResource res : ((Subject<?, ?, ?>) attr.getOwner()).getResources()) {
+ if (!MappingUtils.getMatchingMappingItems(
+ attrUtils.getMappingItems(res, MappingPurpose.BOTH),
+ attr.getSchema().getKey(), type).isEmpty()) {
+
+ resources.add(res);
+ }
+ }
+ }
+
+ return resources;
+ }
+
+ private Set<ExternalResource> getTargetResources(final VirAttr attr, final IntMappingType type,
+ final AttributableUtils attrUtils, final Set<? extends ExternalResource> ownerResources) {
+
+ final Set<ExternalResource> resources = new HashSet<>();
+
+ for (ExternalResource res : ownerResources) {
+ if (!MappingUtils.getMatchingMappingItems(
+ attrUtils.getMappingItems(res, MappingPurpose.BOTH),
+ attr.getSchema().getKey(), type).isEmpty()) {
+
+ resources.add(res);
+ }
+ }
+
+ return resources;
+ }
+
+ private void fillFromTemplate(final AbstractAttributableTO attributableTO, final AbstractAttributableTO template) {
+ Map<String, AttrTO> currentAttrMap = attributableTO.getPlainAttrMap();
+ for (AttrTO templateAttr : template.getPlainAttrs()) {
+ if (templateAttr.getValues() != null && !templateAttr.getValues().isEmpty()
+ && (!currentAttrMap.containsKey(templateAttr.getSchema())
+ || currentAttrMap.get(templateAttr.getSchema()).getValues().isEmpty())) {
+
+ attributableTO.getPlainAttrs().add(evaluateAttrTemplate(attributableTO, templateAttr));
+ }
+ }
+
+ currentAttrMap = attributableTO.getDerAttrMap();
+ for (AttrTO templateDerAttr : template.getDerAttrs()) {
+ if (!currentAttrMap.containsKey(templateDerAttr.getSchema())) {
+ attributableTO.getDerAttrs().add(templateDerAttr);
+ }
+ }
+
+ currentAttrMap = attributableTO.getVirAttrMap();
+ for (AttrTO templateVirAttr : template.getVirAttrs()) {
+ if (templateVirAttr.getValues() != null && !templateVirAttr.getValues().isEmpty()
+ && (!currentAttrMap.containsKey(templateVirAttr.getSchema())
+ || currentAttrMap.get(templateVirAttr.getSchema()).getValues().isEmpty())) {
+
+ attributableTO.getVirAttrs().add(evaluateAttrTemplate(attributableTO, templateVirAttr));
+ }
+ }
+ }
+
+ private AttrTO evaluateAttrTemplate(final AbstractAttributableTO attributableTO, final AttrTO template) {
+ AttrTO result = new AttrTO();
+ result.setSchema(template.getSchema());
+
+ if (template.getValues() != null && !template.getValues().isEmpty()) {
+ for (String value : template.getValues()) {
+ String evaluated = JexlUtils.evaluate(value, attributableTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ result.getValues().add(evaluated);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Transform a
+ * <code>Collection</code> of {@link Attribute} instances into a {@link Map}. The key to each element in the map is
+ * the <i>name</i> of an
+ * <code>Attribute</code>. The value of each element in the map is the
+ * <code>Attribute</code> instance with that name. <br/> Different from the original because: <ul> <li>map keys are
+ * transformed toUpperCase()</li> <li>returned map is mutable</li> </ul>
+ *
+ * @param attributes set of attribute to transform to a map.
+ * @return a map of string and attribute.
+ *
+ * @see org.identityconnectors.framework.common.objects.AttributeUtil#toMap(java.util.Collection)
+ */
+ public Map<String, Attribute> toMap(final Collection<? extends Attribute> attributes) {
+ final Map<String, Attribute> map = new HashMap<>();
+ for (Attribute attr : attributes) {
+ map.put(attr.getName().toUpperCase(), attr);
+ }
+ return map;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
----------------------------------------------------------------------
diff --cc core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
index db49c0f,0000000..535597a
mode 100644,000000..100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
@@@ -1,735 -1,0 +1,732 @@@
+/*
+ * 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.misc;
+
+import org.apache.syncope.core.misc.policy.InvalidPasswordPolicySpecException;
+import org.apache.syncope.core.misc.security.PasswordGenerator;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.jexl2.JexlContext;
+import org.apache.commons.jexl2.MapContext;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.syncope.common.lib.CollectionUtils2;
+import org.apache.syncope.common.lib.mod.AttrMod;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
+import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
+import org.apache.syncope.core.persistence.api.entity.Attributable;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
+import org.apache.syncope.core.persistence.api.entity.DerAttr;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.Subject;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.Membership;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
+import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.user.UVirSchema;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
+import org.apache.syncope.core.misc.security.Encryptor;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
+import org.identityconnectors.framework.common.FrameworkUtil;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.AttributeUtil;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.OperationalAttributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ConfigurableApplicationContext;
+
+public final class MappingUtils {
+
- /**
- * Logger.
- */
+ private static final Logger LOG = LoggerFactory.getLogger(MappingUtils.class);
+
+ private static final Encryptor ENCRYPTOR = Encryptor.getInstance();
+
+ public static <T extends MappingItem> Collection<T> getMatchingMappingItems(
+ final Collection<T> items, final IntMappingType type) {
+
+ return CollectionUtils2.find(items, new Predicate<T>() {
+
+ @Override
+ public boolean evaluate(final T item) {
+ return item.getIntMappingType() == type;
+ }
+ });
+ }
+
+ public static <T extends MappingItem> Collection<T> getMatchingMappingItems(
+ final Collection<T> items, final String intAttrName, final IntMappingType type) {
+
+ return CollectionUtils2.find(items, new Predicate<T>() {
+
+ @Override
+ public boolean evaluate(final T item) {
+ return item.getIntMappingType() == type && intAttrName.equals(item.getIntAttrName());
+ }
+ });
+ }
+
+ public static <T extends MappingItem> Collection<T> getMatchingMappingItems(
+ final Collection<T> items, final String intAttrName) {
+
+ return CollectionUtils2.find(items, new Predicate<T>() {
+
+ @Override
+ public boolean evaluate(final T item) {
+ return intAttrName.equals(item.getIntAttrName());
+ }
+ });
+ }
+
+ /**
+ * Prepare attributes for sending to a connector instance.
+ *
+ * @param attrUtils user / group
+ * @param subject given user / group
+ * @param password clear-text password
+ * @param changePwd whether password should be included for propagation attributes or not
+ * @param vAttrsToBeRemoved virtual attributes to be removed
+ * @param vAttrsToBeUpdated virtual attributes to be added
+ * @param membVAttrsToBeRemoved membership virtual attributes to be removed
+ * @param membVAttrsToBeUpdated membership virtual attributes to be added
+ * @param enable whether user must be enabled or not
+ * @param resource target resource
+ * @return account link + prepared attributes
+ */
+ public static Pair<String, Set<Attribute>> prepareAttributes(
+ final AttributableUtils attrUtils, final Subject<?, ?, ?> subject,
+ final String password,
+ final boolean changePwd,
+ final Set<String> vAttrsToBeRemoved,
+ final Map<String, AttrMod> vAttrsToBeUpdated,
+ final Set<String> membVAttrsToBeRemoved,
+ final Map<String, AttrMod> membVAttrsToBeUpdated,
+ final Boolean enable,
+ final ExternalResource resource) {
+
+ LOG.debug("Preparing resource attributes for {} on resource {} with attributes {}",
+ subject, resource, subject.getPlainAttrs());
+
+ final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
+ final VirAttrCache virAttrCache = context.getBean(VirAttrCache.class);
+ final PasswordGenerator passwordGenerator = context.getBean(PasswordGenerator.class);
+
+ Set<Attribute> attributes = new HashSet<>();
+ String accountId = null;
+
+ for (MappingItem mapping : attrUtils.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
+ LOG.debug("Processing schema {}", mapping.getIntAttrName());
+
+ try {
+ if ((attrUtils.getType() == AttributableType.USER
+ && mapping.getIntMappingType() == IntMappingType.UserVirtualSchema)
+ || (attrUtils.getType() == AttributableType.GROUP
+ && mapping.getIntMappingType() == IntMappingType.GroupVirtualSchema)) {
+
+ LOG.debug("Expire entry cache {}-{}", subject.getKey(), mapping.getIntAttrName());
+ virAttrCache.expire(attrUtils.getType(), subject.getKey(), mapping.getIntAttrName());
+ }
+
+ // SYNCOPE-458 expire cache also for membership virtual schemas
+ if (attrUtils.getType() == AttributableType.USER && mapping.getIntMappingType()
+ == IntMappingType.MembershipVirtualSchema && (subject instanceof User)) {
+
+ final User user = (User) subject;
+ for (Membership membership : user.getMemberships()) {
+ LOG.debug("Expire entry cache {}-{} for membership {}", subject.getKey(),
+ mapping.getIntAttrName(), membership);
+ virAttrCache.expire(AttributableType.MEMBERSHIP, membership.getKey(),
+ mapping.getIntAttrName());
+ }
+ }
+
+ Pair<String, Attribute> preparedAttr = prepareAttr(
+ resource, mapping, subject, password, passwordGenerator, vAttrsToBeRemoved, vAttrsToBeUpdated,
+ membVAttrsToBeRemoved, membVAttrsToBeUpdated);
+
+ if (preparedAttr != null && preparedAttr.getKey() != null) {
+ accountId = preparedAttr.getKey();
+ }
+
+ if (preparedAttr != null && preparedAttr.getValue() != null) {
+ Attribute alreadyAdded = AttributeUtil.find(preparedAttr.getValue().getName(), attributes);
+
+ if (alreadyAdded == null) {
+ attributes.add(preparedAttr.getValue());
+ } else {
+ attributes.remove(alreadyAdded);
+
+ Set<Object> values = new HashSet<>(alreadyAdded.getValue());
+ values.addAll(preparedAttr.getValue().getValue());
+
+ attributes.add(AttributeBuilder.build(preparedAttr.getValue().getName(), values));
+ }
+ }
+ } catch (Exception e) {
+ LOG.debug("Attribute '{}' processing failed", mapping.getIntAttrName(), e);
+ }
+ }
+
+ final Attribute accountIdExtAttr =
+ AttributeUtil.find(attrUtils.getAccountIdItem(resource).getExtAttrName(), attributes);
+ if (accountIdExtAttr != null) {
+ attributes.remove(accountIdExtAttr);
+ attributes.add(AttributeBuilder.build(attrUtils.getAccountIdItem(resource).getExtAttrName(), accountId));
+ }
- attributes.add(MappingUtils.evaluateNAME(subject, resource, accountId));
++ attributes.add(evaluateNAME(subject, resource, accountId));
+
+ if (enable != null) {
+ attributes.add(AttributeBuilder.buildEnabled(enable));
+ }
+ if (!changePwd) {
+ Attribute pwdAttr = AttributeUtil.find(OperationalAttributes.PASSWORD_NAME, attributes);
+ if (pwdAttr != null) {
+ attributes.remove(pwdAttr);
+ }
+ }
+
+ return new ImmutablePair<>(accountId, attributes);
+ }
+
+ /**
+ * Prepare an attribute to be sent to a connector instance.
+ *
+ * @param resource target resource
+ * @param mapItem mapping item for the given attribute
+ * @param subject given user
+ * @param password clear-text password
+ * @param passwordGenerator password generator
+ * @param vAttrsToBeRemoved virtual attributes to be removed
+ * @param vAttrsToBeUpdated virtual attributes to be added
+ * @return account link + prepared attribute
+ */
+ @SuppressWarnings("unchecked")
+ private static Pair<String, Attribute> prepareAttr(
+ final ExternalResource resource, final MappingItem mapItem,
+ final Subject<?, ?, ?> subject, final String password, final PasswordGenerator passwordGenerator,
+ final Set<String> vAttrsToBeRemoved, final Map<String, AttrMod> vAttrsToBeUpdated,
+ final Set<String> membVAttrsToBeRemoved, final Map<String, AttrMod> membVAttrsToBeUpdated) {
+
+ List<Attributable<?, ?, ?>> attributables = new ArrayList<>();
+
+ ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
+ AttributableUtilsFactory attrUtilsFactory = context.getBean(AttributableUtilsFactory.class);
+ ConnObjectUtils connObjectUtils = context.getBean(ConnObjectUtils.class);
+
+ switch (mapItem.getIntMappingType().getAttributableType()) {
+ case USER:
+ if (subject instanceof User) {
+ attributables.add(subject);
+ }
+ break;
+
+ case GROUP:
+ if (subject instanceof User) {
+ for (Group group : ((User) subject).getGroups()) {
+ connObjectUtils.retrieveVirAttrValues(group, attrUtilsFactory.getInstance(group));
+ attributables.add(group);
+ }
+ }
+ if (subject instanceof Group) {
+ attributables.add(subject);
+ }
+ break;
+
+ case MEMBERSHIP:
+ if (subject instanceof User) {
+ attributables.addAll(((User) subject).getMemberships());
+ }
+ break;
+
+ default:
+ }
+
+ List<PlainAttrValue> values = getIntValues(
+ resource, mapItem, attributables, vAttrsToBeRemoved, vAttrsToBeUpdated, membVAttrsToBeRemoved,
+ membVAttrsToBeUpdated);
+
+ PlainSchema schema = null;
+ boolean readOnlyVirSchema = false;
+ AttrSchemaType schemaType;
+ final Pair<String, Attribute> result;
+
+ switch (mapItem.getIntMappingType()) {
+ case UserPlainSchema:
+ case GroupPlainSchema:
+ case MembershipPlainSchema:
+ final PlainSchemaDAO plainSchemaDAO = context.getBean(PlainSchemaDAO.class);
- schema = plainSchemaDAO.find(mapItem.getIntAttrName(),
- MappingUtils.getIntMappingTypeClass(mapItem.getIntMappingType()));
++ schema = plainSchemaDAO.find(
++ mapItem.getIntAttrName(), getIntMappingTypeClass(mapItem.getIntMappingType()));
+ schemaType = schema == null ? AttrSchemaType.String : schema.getType();
+ break;
+
+ case UserVirtualSchema:
+ case GroupVirtualSchema:
+ case MembershipVirtualSchema:
+ VirSchemaDAO virSchemaDAO = context.getBean(VirSchemaDAO.class);
- VirSchema virSchema = virSchemaDAO.find(mapItem.getIntAttrName(),
- MappingUtils.getIntMappingTypeClass(mapItem.getIntMappingType()));
++ VirSchema virSchema = virSchemaDAO.find(
++ mapItem.getIntAttrName(), getIntMappingTypeClass(mapItem.getIntMappingType()));
+ readOnlyVirSchema = (virSchema != null && virSchema.isReadonly());
+ schemaType = AttrSchemaType.String;
+ break;
+
+ default:
+ schemaType = AttrSchemaType.String;
+ }
+
+ final String extAttrName = mapItem.getExtAttrName();
+
+ LOG.debug("Define mapping for: "
+ + "\n* ExtAttrName " + extAttrName
+ + "\n* is accountId " + mapItem.isAccountid()
+ + "\n* is password " + (mapItem.isPassword() || mapItem.getIntMappingType() == IntMappingType.Password)
+ + "\n* mandatory condition " + mapItem.getMandatoryCondition()
+ + "\n* Schema " + mapItem.getIntAttrName()
+ + "\n* IntMappingType " + mapItem.getIntMappingType().toString()
+ + "\n* ClassType " + schemaType.getType().getName()
+ + "\n* Values " + values);
+
+ if (readOnlyVirSchema) {
+ result = null;
+ } else {
+ final List<Object> objValues = new ArrayList<>();
+
+ for (PlainAttrValue value : values) {
+ if (FrameworkUtil.isSupportedAttributeType(schemaType.getType())) {
+ objValues.add(value.getValue());
+ } else {
+ objValues.add(value.getValueAsString());
+ }
+ }
+
+ if (mapItem.isAccountid()) {
+ result = new ImmutablePair<>(objValues.iterator().next().toString(), null);
+ } else if (mapItem.isPassword() && subject instanceof User) {
+ String passwordAttrValue = password;
+ if (StringUtils.isBlank(passwordAttrValue)) {
+ User user = (User) subject;
+ if (user.canDecodePassword()) {
+ try {
+ passwordAttrValue = ENCRYPTOR.decode(user.getPassword(), user.getCipherAlgorithm());
+ } catch (Exception e) {
+ LOG.error("Could not decode password for {}", user, e);
+ }
+ } else if (resource.isRandomPwdIfNotProvided()) {
+ try {
+ passwordAttrValue = passwordGenerator.generate(user);
+ } catch (InvalidPasswordPolicySpecException e) {
+ LOG.error("Could not generate policy-compliant random password for {}", user, e);
+ }
+ }
+ }
+
+ if (passwordAttrValue == null) {
+ result = null;
+ } else {
+ result = new ImmutablePair<>(
+ null,
+ AttributeBuilder.buildPassword(passwordAttrValue.toCharArray()));
+ }
+ } else {
+ if ((schema != null && schema.isMultivalue()) || attrUtilsFactory.getInstance(subject).getType()
+ != mapItem.getIntMappingType().getAttributableType()) {
+
+ result = new ImmutablePair<>(
+ null,
+ AttributeBuilder.build(extAttrName, objValues));
+ } else {
+ result = new ImmutablePair<>(
+ null, objValues.isEmpty()
+ ? AttributeBuilder.build(extAttrName)
+ : AttributeBuilder.build(extAttrName, objValues.iterator().next()));
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Build __NAME__ for propagation. First look if there ia a defined accountLink for the given resource (and in this
+ * case evaluate as JEXL); otherwise, take given accountId.
+ *
+ * @param subject given user / group
+ * @param resource target resource
+ * @param accountId accountId
+ * @return the value to be propagated as __NAME__
+ */
+ public static Name evaluateNAME(final Subject<?, ?, ?> subject,
+ final ExternalResource resource, final String accountId) {
+
+ final AttributableUtilsFactory attrUtilsFactory =
+ ApplicationContextProvider.getApplicationContext().getBean(AttributableUtilsFactory.class);
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(subject);
+
+ if (StringUtils.isBlank(accountId)) {
+ // LOG error but avoid to throw exception: leave it to the external resource
+ LOG.error("Missing accountId for '{}': ", resource.getKey());
+ }
+
+ // Evaluate AccountLink expression
+ String evalAccountLink = null;
+ if (StringUtils.isNotBlank(attrUtils.getAccountLink(resource))) {
+ final JexlContext jexlContext = new MapContext();
+ JexlUtils.addFieldsToContext(subject, jexlContext);
+ JexlUtils.addAttrsToContext(subject.getPlainAttrs(), jexlContext);
+ JexlUtils.addDerAttrsToContext(subject.getDerAttrs(), subject.getPlainAttrs(), jexlContext);
+ evalAccountLink = JexlUtils.evaluate(attrUtils.getAccountLink(resource), jexlContext);
+ }
+
+ // If AccountLink evaluates to an empty string, just use the provided AccountId as Name(),
+ // otherwise evaluated AccountLink expression is taken as Name().
+ Name name;
+ if (StringUtils.isBlank(evalAccountLink)) {
+ // add AccountId as __NAME__ attribute ...
+ LOG.debug("Add AccountId [{}] as __NAME__", accountId);
+ name = new Name(accountId);
+ } else {
+ LOG.debug("Add AccountLink [{}] as __NAME__", evalAccountLink);
+ name = new Name(evalAccountLink);
+
+ // AccountId not propagated: it will be used to set the value for __UID__ attribute
+ LOG.debug("AccountId will be used just as __UID__ attribute");
+ }
+
+ return name;
+ }
+
+ private static String getGroupOwnerValue(
+ final ExternalResource resource, final Subject<?, ?, ?> subject) {
+
+ AttributableUtilsFactory attrUtilsFactory =
+ ApplicationContextProvider.getApplicationContext().getBean(AttributableUtilsFactory.class);
+
+ Pair<String, Attribute> preparedAttr = prepareAttr(
+ resource, attrUtilsFactory.getInstance(subject).getAccountIdItem(resource), subject, null, null,
+ Collections.<String>emptySet(), Collections.<String, AttrMod>emptyMap(),
+ Collections.<String>emptySet(), Collections.<String, AttrMod>emptyMap());
+ String accountId = preparedAttr.getKey();
+
+ final Name groupOwnerName = evaluateNAME(subject, resource, accountId);
+ return groupOwnerName.getNameValue();
+ }
+
+ /**
+ * Get attribute values.
+ *
+ * @param resource target resource
+ * @param mappingItem mapping item
+ * @param attributables list of attributables
+ * @param vAttrsToBeRemoved virtual attributes to be removed
+ * @param vAttrsToBeUpdated virtual attributes to be added
+ * @param membVAttrsToBeRemoved membership virtual attributes to be removed
+ * @param membVAttrsToBeUpdated membership virtual attributes to be added
+ * @return attribute values.
+ */
+ public static List<PlainAttrValue> getIntValues(final ExternalResource resource,
+ final MappingItem mappingItem, final List<Attributable<?, ?, ?>> attributables,
+ final Set<String> vAttrsToBeRemoved, final Map<String, AttrMod> vAttrsToBeUpdated,
+ final Set<String> membVAttrsToBeRemoved, final Map<String, AttrMod> membVAttrsToBeUpdated) {
+
+ LOG.debug("Get attributes for '{}' and mapping type '{}'", attributables, mappingItem.getIntMappingType());
+
+ final EntityFactory entityFactory =
+ ApplicationContextProvider.getApplicationContext().getBean(EntityFactory.class);
+ List<PlainAttrValue> values = new ArrayList<>();
+ PlainAttrValue attrValue;
+ switch (mappingItem.getIntMappingType()) {
+ case UserPlainSchema:
+ case GroupPlainSchema:
+ case MembershipPlainSchema:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ final PlainAttr attr = attributable.getPlainAttr(mappingItem.getIntAttrName());
+ if (attr != null) {
+ if (attr.getUniqueValue() != null) {
+ values.add(attr.getUniqueValue());
+ } else if (attr.getValues() != null) {
+ values.addAll(attr.getValues());
+ }
+ }
+
+ LOG.debug("Retrieved attribute {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ attr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
+ }
+
+ break;
+
+ case UserVirtualSchema:
+ case GroupVirtualSchema:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ VirAttr virAttr = attributable.getVirAttr(mappingItem.getIntAttrName());
+ if (virAttr != null) {
+ if (vAttrsToBeRemoved != null && vAttrsToBeUpdated != null) {
+ if (vAttrsToBeUpdated.containsKey(mappingItem.getIntAttrName())) {
+ virAttr.getValues().clear();
+ virAttr.getValues().addAll(
+ vAttrsToBeUpdated.get(mappingItem.getIntAttrName()).getValuesToBeAdded());
+ } else if (vAttrsToBeRemoved.contains(mappingItem.getIntAttrName())) {
+ virAttr.getValues().clear();
+ } else {
+ throw new IllegalArgumentException("Don't need to update virtual attribute '"
+ + mappingItem.getIntAttrName() + "'");
+ }
+ }
+ if (virAttr.getValues() != null) {
+ for (String value : virAttr.getValues()) {
+ attrValue = entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(value);
+ values.add(attrValue);
+ }
+ }
+ }
+
+ LOG.debug("Retrieved {} virtual attribute {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ attributable.getClass().getSimpleName(),
+ virAttr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
+ }
+ break;
+
+ case MembershipVirtualSchema:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ VirAttr virAttr = attributable.getVirAttr(mappingItem.getIntAttrName());
+ if (virAttr != null) {
+ if (membVAttrsToBeRemoved != null && membVAttrsToBeUpdated != null) {
+ if (membVAttrsToBeUpdated.containsKey(mappingItem.getIntAttrName())) {
+ virAttr.getValues().clear();
+ virAttr.getValues().addAll(
+ membVAttrsToBeUpdated.get(mappingItem.getIntAttrName()).getValuesToBeAdded());
+ } else if (membVAttrsToBeRemoved.contains(mappingItem.getIntAttrName())) {
+ virAttr.getValues().clear();
+ } else {
+ throw new IllegalArgumentException("Don't need to update membership virtual attribute '"
+ + mappingItem.getIntAttrName() + "'");
+ }
+ }
+ if (virAttr.getValues() != null) {
+ for (String value : virAttr.getValues()) {
+ attrValue = entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(value);
+ values.add(attrValue);
+ }
+ }
+ }
+
+ LOG.debug("Retrieved {} virtual attribute {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ attributable.getClass().getSimpleName(),
+ virAttr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
+ }
+ break;
+
+ case UserDerivedSchema:
+ case GroupDerivedSchema:
+ case MembershipDerivedSchema:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ DerAttr derAttr = attributable.getDerAttr(mappingItem.getIntAttrName());
+ if (derAttr != null) {
+ attrValue = attributable instanceof Group
+ ? entityFactory.newEntity(GPlainAttrValue.class)
+ : entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(derAttr.getValue(attributable.getPlainAttrs()));
+ values.add(attrValue);
+ }
+
+ LOG.debug("Retrieved attribute {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ derAttr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
+ }
+ break;
+
+ case UserId:
+ case GroupId:
+ case MembershipId:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ attrValue = entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(attributable.getKey().toString());
+ values.add(attrValue);
+ }
+ break;
+
+ case Username:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ if (attributable instanceof User) {
+ attrValue = entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(((User) attributable).getUsername());
+ values.add(attrValue);
+ }
+ }
+ break;
+
+ case GroupName:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ if (attributable instanceof Group) {
+ attrValue = entityFactory.newEntity(GPlainAttrValue.class);
+ attrValue.setStringValue(((Group) attributable).getName());
+ values.add(attrValue);
+ }
+ }
+ break;
+
+ case GroupOwnerSchema:
+ for (Attributable<?, ?, ?> attributable : attributables) {
+ if (attributable instanceof Group) {
+ Group group = (Group) attributable;
+ String groupOwnerValue = null;
+ if (group.getUserOwner() != null && resource.getUmapping() != null) {
+ groupOwnerValue = getGroupOwnerValue(resource, group.getUserOwner());
+ }
+ if (group.getGroupOwner() != null && resource.getGmapping() != null) {
+ groupOwnerValue = getGroupOwnerValue(resource, group.getGroupOwner());
+ }
+
+ if (StringUtils.isNotBlank(groupOwnerValue)) {
+ attrValue = entityFactory.newEntity(GPlainAttrValue.class);
+ attrValue.setStringValue(groupOwnerValue);
+ values.add(attrValue);
+ }
+ }
+ }
+ break;
+
+ default:
+ }
+
+ LOG.debug("Retrieved values '{}'", values);
+
+ return values;
+ }
+
+ /**
+ * Get accountId internal value.
+ *
+ * @param attributable attributable
+ * @param accountIdItem accountId mapping item
+ * @param resource external resource
+ * @return accountId internal value
+ */
+ public static String getAccountIdValue(final Attributable<?, ?, ?> attributable,
+ final ExternalResource resource, final MappingItem accountIdItem) {
+
+ List<PlainAttrValue> values = getIntValues(resource, accountIdItem,
+ Collections.<Attributable<?, ?, ?>>singletonList(attributable), null, null, null, null);
+ return values == null || values.isEmpty()
+ ? null
+ : values.get(0).getValueAsString();
+ }
+
+ /**
+ * For given source mapping type, return the corresponding Class object.
+ *
+ * @param intMappingType source mapping type
+ * @return corresponding Class object, if any (can be null)
+ */
+ @SuppressWarnings("rawtypes")
+ public static Class getIntMappingTypeClass(final IntMappingType intMappingType) {
+ Class result;
+
+ switch (intMappingType) {
+ case UserPlainSchema:
+ result = UPlainSchema.class;
+ break;
+
+ case GroupPlainSchema:
+ result = GPlainSchema.class;
+ break;
+
+ case MembershipPlainSchema:
+ result = MPlainSchema.class;
+ break;
+
+ case UserDerivedSchema:
+ result = UDerSchema.class;
+ break;
+
+ case GroupDerivedSchema:
+ result = GDerSchema.class;
+ break;
+
+ case MembershipDerivedSchema:
+ result = MDerSchema.class;
+ break;
+
+ case UserVirtualSchema:
+ result = UVirSchema.class;
+ break;
+
+ case GroupVirtualSchema:
+ result = GVirSchema.class;
+ break;
+
+ case MembershipVirtualSchema:
+ result = MVirSchema.class;
+ break;
+
+ default:
+ result = null;
+ }
+
+ return result;
+ }
+
+ /**
+ * Private default constructor, for static-only classes.
+ */
+ private MappingUtils() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/core/misc/src/main/java/org/apache/syncope/core/misc/security/Encryptor.java
----------------------------------------------------------------------
diff --cc core/misc/src/main/java/org/apache/syncope/core/misc/security/Encryptor.java
index ce3b36c,aac337a..4c55513
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/Encryptor.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/Encryptor.java
@@@ -46,7 -46,7 +46,7 @@@ public final class Encryptor
private static final Logger LOG = LoggerFactory.getLogger(Encryptor.class);
-- private static final Map<String, Encryptor> INSTANCES = new ConcurrentHashMap<String, Encryptor>();
++ private static final Map<String, Encryptor> INSTANCES = new ConcurrentHashMap<>();
private static final String DEFAULT_SECRET_KEY = "1abcdefghilmnopqrstuvz2!";
http://git-wip-us.apache.org/repos/asf/syncope/blob/4115c57b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtils.java
----------------------------------------------------------------------
diff --cc core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtils.java
index b36cd18,0000000..9539604
mode 100644,000000..100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtils.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AttributableUtils.java
@@@ -1,91 -1,0 +1,89 @@@
+/*
+ * 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 org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+
+public interface AttributableUtils {
+
+ AttributableType getType();
+
+ <T extends Attributable<?, ?, ?>> Class<T> attributableClass();
+
+ <T extends PlainSchema> Class<T> plainSchemaClass();
+
+ <T extends PlainSchema> T newPlainSchema();
+
+ <T extends PlainAttr> Class<T> plainAttrClass();
+
+ <T extends PlainAttr> T newPlainAttr();
+
+ <T extends PlainAttrValue> Class<T> plainAttrValueClass();
+
+ <T extends PlainAttrValue> T newPlainAttrValue();
+
+ <T extends AttrTemplate<PlainSchema>> Class<T> plainAttrTemplateClass();
+
+ <T extends PlainAttrValue> Class<T> plainAttrUniqueValueClass();
+
+ <T extends PlainAttrValue> T newPlainAttrUniqueValue();
+
+ <T extends DerSchema> Class<T> derSchemaClass();
+
+ <T extends DerSchema> T newDerSchema();
+
+ <T extends DerAttr> Class<T> derAttrClass();
+
+ <T extends DerAttr> T newDerAttr();
+
+ <T extends AttrTemplate<DerSchema>> Class<T> derAttrTemplateClass();
+
+ <T extends VirSchema> Class<T> virSchemaClass();
+
+ <T extends VirSchema> T newVirSchema();
+
+ <T extends VirAttr> Class<T> virAttrClass();
+
+ <T extends VirAttr> T newVirAttr();
+
+ <T extends AttrTemplate<VirSchema>> Class<T> virAttrTemplateClass();
+
+ <T extends MappingItem> T getAccountIdItem(ExternalResource resource);
+
+ String getAccountLink(ExternalResource resource);
+
+ <T extends MappingItem> List<T> getMappingItems(ExternalResource resource, MappingPurpose purpose);
+
- <T extends MappingItem> List<T> getUidToMappingItems(ExternalResource resource, MappingPurpose purpose);
-
+ IntMappingType plainIntMappingType();
+
+ IntMappingType derIntMappingType();
+
+ IntMappingType virIntMappingType();
+
+ <T extends MappingItem> Class<T> mappingItemClass();
+
+ <T extends AbstractAttributableTO> T newAttributableTO();
+
+ <T extends AbstractSubjectTO> T newSubjectTO();
+}
[46/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
deleted file mode 100644
index 0ccf030..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
+++ /dev/null
@@ -1,879 +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 java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.apache.syncope.common.lib.to.AbstractAttributableTO;
-import org.apache.syncope.common.lib.to.AbstractSubjectTO;
-import org.apache.syncope.common.lib.to.ConfTO;
-import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.VirAttr;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttr;
-import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.conf.JPAConf;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttr;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttr;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttr;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttr;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMappingItem;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirAttr;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
-import org.apache.syncope.core.misc.spring.BeanUtils;
-import org.identityconnectors.framework.common.objects.Uid;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings({ "unchecked", "rawtypes" })
-public class JPAAttributableUtil implements AttributableUtil {
-
- /**
- * Logger.
- */
- private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(AttributableUtil.class);
-
- private final AttributableType type;
-
- protected JPAAttributableUtil(final AttributableType type) {
- this.type = type;
- }
-
- @Override
- public AttributableType getType() {
- return type;
- }
-
- @Override
- public <T extends Attributable<?, ?, ?>> Class<T> attributableClass() {
- Class result;
-
- switch (type) {
- case GROUP:
- result = JPAGroup.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMembership.class;
- break;
-
- case CONFIGURATION:
- result = JPAConf.class;
- break;
-
- case USER:
- default:
- result = JPAUser.class;
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainSchema> Class<T> plainSchemaClass() {
- Class result;
-
- switch (type) {
- case GROUP:
- result = JPAGPlainSchema.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMPlainSchema.class;
- break;
-
- case CONFIGURATION:
- result = JPACPlainSchema.class;
- break;
-
- case USER:
- default:
- result = JPAUPlainSchema.class;
- break;
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainSchema> T newPlainSchema() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUPlainSchema();
- break;
-
- case GROUP:
- result = (T) new JPAGPlainSchema();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMPlainSchema();
- break;
-
- case CONFIGURATION:
- result = (T) new JPACPlainSchema();
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttr> Class<T> plainAttrClass() {
- Class result = null;
-
- switch (type) {
- case GROUP:
- result = JPAGPlainAttr.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMPlainAttr.class;
- break;
-
- case CONFIGURATION:
- result = JPACPlainAttr.class;
- break;
-
- case USER:
- default:
- result = JPAUPlainAttr.class;
- break;
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttr> T newPlainAttr() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUPlainAttr();
- break;
-
- case GROUP:
- result = (T) new JPAGPlainAttr();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMPlainAttr();
- break;
-
- case CONFIGURATION:
- result = (T) new JPACPlainAttr();
-
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttrValue> Class<T> plainAttrValueClass() {
- Class result;
-
- switch (type) {
- case GROUP:
- result = JPAGPlainAttrValue.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMPlainAttrValue.class;
- break;
-
- case CONFIGURATION:
- result = JPACPlainAttrValue.class;
- break;
-
- case USER:
- default:
- result = JPAUPlainAttrValue.class;
- break;
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttrValue> T newPlainAttrValue() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUPlainAttrValue();
- break;
-
- case GROUP:
- result = (T) new JPAGPlainAttrValue();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMPlainAttrValue();
- break;
-
- case CONFIGURATION:
- result = (T) new JPACPlainAttrValue();
- break;
-
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttrValue> Class<T> plainAttrUniqueValueClass() {
- Class result;
-
- switch (type) {
- case GROUP:
- result = JPAGPlainAttrUniqueValue.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMPlainAttrUniqueValue.class;
- break;
-
- case CONFIGURATION:
- result = JPACPlainAttrUniqueValue.class;
- break;
-
- case USER:
- default:
- result = JPAUPlainAttrUniqueValue.class;
- break;
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttrValue> T newPlainAttrUniqueValue() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUPlainAttrUniqueValue();
- break;
-
- case GROUP:
- result = (T) new JPAGPlainAttrUniqueValue();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMPlainAttrUniqueValue();
- break;
-
- case CONFIGURATION:
- result = (T) new JPACPlainAttrUniqueValue();
- break;
-
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AttrTemplate<PlainSchema>> Class<T> plainAttrTemplateClass() {
- Class result;
-
- switch (type) {
- case GROUP:
- result = JPAGPlainAttrTemplate.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMPlainAttrTemplate.class;
- break;
-
- case USER:
- case CONFIGURATION:
- default:
- result = null;
- }
-
- return result;
- }
-
- @Override
- public <T extends DerSchema> Class<T> derSchemaClass() {
- Class result;
-
- switch (type) {
- case USER:
- result = JPAUDerSchema.class;
- break;
-
- case GROUP:
- result = JPAGDerSchema.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMDerSchema.class;
- break;
-
- case CONFIGURATION:
- default:
- result = null;
- }
-
- return result;
- }
-
- @Override
- public <T extends DerSchema> T newDerSchema() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUDerSchema();
- break;
-
- case GROUP:
- result = (T) new JPAGDerSchema();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMDerSchema();
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends DerAttr> Class<T> derAttrClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- result = JPAUDerAttr.class;
- break;
-
- case GROUP:
- result = JPAGDerAttr.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMDerAttr.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends DerAttr> T newDerAttr() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUDerAttr();
- break;
-
- case GROUP:
- result = (T) new JPAGDerAttr();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMDerAttr();
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AttrTemplate<DerSchema>> Class<T> derAttrTemplateClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- break;
-
- case GROUP:
- result = JPAGDerAttrTemplate.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMDerAttrTemplate.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends VirSchema> Class<T> virSchemaClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- result = JPAUVirSchema.class;
- break;
-
- case GROUP:
- result = JPAGVirSchema.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMVirSchema.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends VirSchema> T newVirSchema() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUVirSchema();
- break;
-
- case GROUP:
- result = (T) new JPAGVirSchema();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMVirSchema();
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends VirAttr> Class<T> virAttrClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- result = JPAUVirAttr.class;
- break;
-
- case GROUP:
- result = JPAGVirAttr.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMVirAttr.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends VirAttr> T newVirAttr() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUVirAttr();
- break;
-
- case GROUP:
- result = (T) new JPAGVirAttr();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMVirAttr();
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AttrTemplate<VirSchema>> Class<T> virAttrTemplateClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- break;
-
- case GROUP:
- result = JPAGVirAttrTemplate.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMVirAttrTemplate.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends MappingItem> T getAccountIdItem(final ExternalResource resource) {
- T result = null;
-
- if (resource != null) {
- switch (type) {
- case GROUP:
- if (resource.getGmapping() != null) {
- result = (T) resource.getGmapping().getAccountIdItem();
- }
- break;
-
- case MEMBERSHIP:
- case USER:
- if (resource.getUmapping() != null) {
- result = (T) resource.getUmapping().getAccountIdItem();
- }
- break;
-
- default:
- }
- }
-
- return result;
- }
-
- @Override
- public String getAccountLink(final ExternalResource resource) {
- String result = null;
-
- if (resource != null) {
- switch (type) {
- case USER:
- if (resource.getUmapping() != null) {
- result = resource.getUmapping().getAccountLink();
- }
- break;
-
- case GROUP:
- if (resource.getGmapping() != null) {
- result = resource.getGmapping().getAccountLink();
- }
- break;
-
- case MEMBERSHIP:
- case CONFIGURATION:
- default:
- }
- }
-
- return result;
- }
-
- @Override
- public <T extends MappingItem> List<T> getMappingItems(
- final ExternalResource resource, final MappingPurpose purpose) {
-
- List<T> items = Collections.<T>emptyList();
-
- if (resource != null) {
- switch (type) {
- case GROUP:
- if (resource.getGmapping() != null) {
- items = (List<T>) resource.getGmapping().getItems();
- }
- break;
-
- case MEMBERSHIP:
- case USER:
- if (resource.getUmapping() != null) {
- items = (List<T>) resource.getUmapping().getItems();
- }
- break;
-
- default:
- }
- }
-
- final List<T> result = new ArrayList<>();
-
- switch (purpose) {
- case SYNCHRONIZATION:
- for (T item : items) {
- if (MappingPurpose.PROPAGATION != item.getPurpose()
- && MappingPurpose.NONE != item.getPurpose()) {
-
- result.add(item);
- }
- }
- break;
-
- case PROPAGATION:
- for (T item : items) {
- if (MappingPurpose.SYNCHRONIZATION != item.getPurpose()
- && MappingPurpose.NONE != item.getPurpose()) {
-
- result.add(item);
- }
- }
- break;
-
- case BOTH:
- for (T item : items) {
- if (MappingPurpose.NONE != item.getPurpose()) {
- result.add(item);
- }
- }
- break;
-
- case NONE:
- for (T item : items) {
- if (MappingPurpose.NONE == item.getPurpose()) {
- result.add(item);
- }
- }
- break;
- default:
- LOG.error("You requested not existing purpose {}", purpose);
- }
-
- return result;
- }
-
- @Override
- public <T extends MappingItem> List<T> getUidToMappingItems(
- final ExternalResource resource, final MappingPurpose purpose) {
-
- List<T> items = getMappingItems(resource, purpose);
-
- MappingItem uidItem = type == AttributableType.USER ? new JPAUMappingItem() : new JPAGMappingItem();
- BeanUtils.copyProperties(getAccountIdItem(resource), uidItem);
- uidItem.setExtAttrName(Uid.NAME);
- uidItem.setAccountid(false);
- items.add((T) uidItem);
-
- return items;
- }
-
- @Override
- public IntMappingType plainIntMappingType() {
- IntMappingType result = null;
-
- switch (type) {
- case GROUP:
- result = IntMappingType.GroupPlainSchema;
- break;
-
- case MEMBERSHIP:
- result = IntMappingType.MembershipPlainSchema;
- break;
-
- case USER:
- result = IntMappingType.UserPlainSchema;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public IntMappingType derIntMappingType() {
- IntMappingType result = null;
-
- switch (type) {
- case GROUP:
- result = IntMappingType.GroupDerivedSchema;
- break;
-
- case MEMBERSHIP:
- result = IntMappingType.MembershipDerivedSchema;
- break;
-
- case USER:
- result = IntMappingType.UserDerivedSchema;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public IntMappingType virIntMappingType() {
- IntMappingType result = null;
-
- switch (type) {
- case GROUP:
- result = IntMappingType.GroupVirtualSchema;
- break;
-
- case MEMBERSHIP:
- result = IntMappingType.MembershipVirtualSchema;
- break;
-
- case USER:
- result = IntMappingType.UserVirtualSchema;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends MappingItem> Class<T> mappingItemClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- result = JPAUMappingItem.class;
- break;
-
- case GROUP:
- result = JPAGMappingItem.class;
- break;
-
- case MEMBERSHIP:
- result = AbstractMappingItem.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AbstractAttributableTO> T newAttributableTO() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new UserTO();
- break;
- case GROUP:
- result = (T) new GroupTO();
- break;
- case MEMBERSHIP:
- result = (T) new MembershipTO();
- break;
- case CONFIGURATION:
- result = (T) new ConfTO();
- break;
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AbstractSubjectTO> T newSubjectTO() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new UserTO();
- break;
- case GROUP:
- result = (T) new GroupTO();
- break;
- case MEMBERSHIP:
- case CONFIGURATION:
- default:
- break;
- }
-
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtils.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtils.java
new file mode 100644
index 0000000..a635207
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtils.java
@@ -0,0 +1,879 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.to.ConfTO;
+import org.apache.syncope.common.lib.to.MembershipTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.Attributable;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.DerAttr;
+import org.apache.syncope.core.persistence.api.entity.DerSchema;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPAConf;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
+import org.apache.syncope.core.misc.spring.BeanUtils;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class JPAAttributableUtils implements AttributableUtils {
+
+ /**
+ * Logger.
+ */
+ private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(AttributableUtils.class);
+
+ private final AttributableType type;
+
+ protected JPAAttributableUtils(final AttributableType type) {
+ this.type = type;
+ }
+
+ @Override
+ public AttributableType getType() {
+ return type;
+ }
+
+ @Override
+ public <T extends Attributable<?, ?, ?>> Class<T> attributableClass() {
+ Class result;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGroup.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMembership.class;
+ break;
+
+ case CONFIGURATION:
+ result = JPAConf.class;
+ break;
+
+ case USER:
+ default:
+ result = JPAUser.class;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainSchema> Class<T> plainSchemaClass() {
+ Class result;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGPlainSchema.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMPlainSchema.class;
+ break;
+
+ case CONFIGURATION:
+ result = JPACPlainSchema.class;
+ break;
+
+ case USER:
+ default:
+ result = JPAUPlainSchema.class;
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainSchema> T newPlainSchema() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUPlainSchema();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGPlainSchema();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMPlainSchema();
+ break;
+
+ case CONFIGURATION:
+ result = (T) new JPACPlainSchema();
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttr> Class<T> plainAttrClass() {
+ Class result = null;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGPlainAttr.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMPlainAttr.class;
+ break;
+
+ case CONFIGURATION:
+ result = JPACPlainAttr.class;
+ break;
+
+ case USER:
+ default:
+ result = JPAUPlainAttr.class;
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttr> T newPlainAttr() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUPlainAttr();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGPlainAttr();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMPlainAttr();
+ break;
+
+ case CONFIGURATION:
+ result = (T) new JPACPlainAttr();
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttrValue> Class<T> plainAttrValueClass() {
+ Class result;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGPlainAttrValue.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMPlainAttrValue.class;
+ break;
+
+ case CONFIGURATION:
+ result = JPACPlainAttrValue.class;
+ break;
+
+ case USER:
+ default:
+ result = JPAUPlainAttrValue.class;
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttrValue> T newPlainAttrValue() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUPlainAttrValue();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGPlainAttrValue();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMPlainAttrValue();
+ break;
+
+ case CONFIGURATION:
+ result = (T) new JPACPlainAttrValue();
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttrValue> Class<T> plainAttrUniqueValueClass() {
+ Class result;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGPlainAttrUniqueValue.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMPlainAttrUniqueValue.class;
+ break;
+
+ case CONFIGURATION:
+ result = JPACPlainAttrUniqueValue.class;
+ break;
+
+ case USER:
+ default:
+ result = JPAUPlainAttrUniqueValue.class;
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends PlainAttrValue> T newPlainAttrUniqueValue() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUPlainAttrUniqueValue();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGPlainAttrUniqueValue();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMPlainAttrUniqueValue();
+ break;
+
+ case CONFIGURATION:
+ result = (T) new JPACPlainAttrUniqueValue();
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AttrTemplate<PlainSchema>> Class<T> plainAttrTemplateClass() {
+ Class result;
+
+ switch (type) {
+ case GROUP:
+ result = JPAGPlainAttrTemplate.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMPlainAttrTemplate.class;
+ break;
+
+ case USER:
+ case CONFIGURATION:
+ default:
+ result = null;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends DerSchema> Class<T> derSchemaClass() {
+ Class result;
+
+ switch (type) {
+ case USER:
+ result = JPAUDerSchema.class;
+ break;
+
+ case GROUP:
+ result = JPAGDerSchema.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMDerSchema.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ result = null;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends DerSchema> T newDerSchema() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUDerSchema();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGDerSchema();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMDerSchema();
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends DerAttr> Class<T> derAttrClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ result = JPAUDerAttr.class;
+ break;
+
+ case GROUP:
+ result = JPAGDerAttr.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMDerAttr.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends DerAttr> T newDerAttr() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUDerAttr();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGDerAttr();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMDerAttr();
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AttrTemplate<DerSchema>> Class<T> derAttrTemplateClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ break;
+
+ case GROUP:
+ result = JPAGDerAttrTemplate.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMDerAttrTemplate.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends VirSchema> Class<T> virSchemaClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ result = JPAUVirSchema.class;
+ break;
+
+ case GROUP:
+ result = JPAGVirSchema.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMVirSchema.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends VirSchema> T newVirSchema() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUVirSchema();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGVirSchema();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMVirSchema();
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends VirAttr> Class<T> virAttrClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ result = JPAUVirAttr.class;
+ break;
+
+ case GROUP:
+ result = JPAGVirAttr.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMVirAttr.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends VirAttr> T newVirAttr() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new JPAUVirAttr();
+ break;
+
+ case GROUP:
+ result = (T) new JPAGVirAttr();
+ break;
+
+ case MEMBERSHIP:
+ result = (T) new JPAMVirAttr();
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AttrTemplate<VirSchema>> Class<T> virAttrTemplateClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ break;
+
+ case GROUP:
+ result = JPAGVirAttrTemplate.class;
+ break;
+
+ case MEMBERSHIP:
+ result = JPAMVirAttrTemplate.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends MappingItem> T getAccountIdItem(final ExternalResource resource) {
+ T result = null;
+
+ if (resource != null) {
+ switch (type) {
+ case GROUP:
+ if (resource.getGmapping() != null) {
+ result = (T) resource.getGmapping().getAccountIdItem();
+ }
+ break;
+
+ case MEMBERSHIP:
+ case USER:
+ if (resource.getUmapping() != null) {
+ result = (T) resource.getUmapping().getAccountIdItem();
+ }
+ break;
+
+ default:
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public String getAccountLink(final ExternalResource resource) {
+ String result = null;
+
+ if (resource != null) {
+ switch (type) {
+ case USER:
+ if (resource.getUmapping() != null) {
+ result = resource.getUmapping().getAccountLink();
+ }
+ break;
+
+ case GROUP:
+ if (resource.getGmapping() != null) {
+ result = resource.getGmapping().getAccountLink();
+ }
+ break;
+
+ case MEMBERSHIP:
+ case CONFIGURATION:
+ default:
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends MappingItem> List<T> getMappingItems(
+ final ExternalResource resource, final MappingPurpose purpose) {
+
+ List<T> items = Collections.<T>emptyList();
+
+ if (resource != null) {
+ switch (type) {
+ case GROUP:
+ if (resource.getGmapping() != null) {
+ items = (List<T>) resource.getGmapping().getItems();
+ }
+ break;
+
+ case MEMBERSHIP:
+ case USER:
+ if (resource.getUmapping() != null) {
+ items = (List<T>) resource.getUmapping().getItems();
+ }
+ break;
+
+ default:
+ }
+ }
+
+ final List<T> result = new ArrayList<>();
+
+ switch (purpose) {
+ case SYNCHRONIZATION:
+ for (T item : items) {
+ if (MappingPurpose.PROPAGATION != item.getPurpose()
+ && MappingPurpose.NONE != item.getPurpose()) {
+
+ result.add(item);
+ }
+ }
+ break;
+
+ case PROPAGATION:
+ for (T item : items) {
+ if (MappingPurpose.SYNCHRONIZATION != item.getPurpose()
+ && MappingPurpose.NONE != item.getPurpose()) {
+
+ result.add(item);
+ }
+ }
+ break;
+
+ case BOTH:
+ for (T item : items) {
+ if (MappingPurpose.NONE != item.getPurpose()) {
+ result.add(item);
+ }
+ }
+ break;
+
+ case NONE:
+ for (T item : items) {
+ if (MappingPurpose.NONE == item.getPurpose()) {
+ result.add(item);
+ }
+ }
+ break;
+ default:
+ LOG.error("You requested not existing purpose {}", purpose);
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends MappingItem> List<T> getUidToMappingItems(
+ final ExternalResource resource, final MappingPurpose purpose) {
+
+ List<T> items = getMappingItems(resource, purpose);
+
+ MappingItem uidItem = type == AttributableType.USER ? new JPAUMappingItem() : new JPAGMappingItem();
+ BeanUtils.copyProperties(getAccountIdItem(resource), uidItem);
+ uidItem.setExtAttrName(Uid.NAME);
+ uidItem.setAccountid(false);
+ items.add((T) uidItem);
+
+ return items;
+ }
+
+ @Override
+ public IntMappingType plainIntMappingType() {
+ IntMappingType result = null;
+
+ switch (type) {
+ case GROUP:
+ result = IntMappingType.GroupPlainSchema;
+ break;
+
+ case MEMBERSHIP:
+ result = IntMappingType.MembershipPlainSchema;
+ break;
+
+ case USER:
+ result = IntMappingType.UserPlainSchema;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public IntMappingType derIntMappingType() {
+ IntMappingType result = null;
+
+ switch (type) {
+ case GROUP:
+ result = IntMappingType.GroupDerivedSchema;
+ break;
+
+ case MEMBERSHIP:
+ result = IntMappingType.MembershipDerivedSchema;
+ break;
+
+ case USER:
+ result = IntMappingType.UserDerivedSchema;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public IntMappingType virIntMappingType() {
+ IntMappingType result = null;
+
+ switch (type) {
+ case GROUP:
+ result = IntMappingType.GroupVirtualSchema;
+ break;
+
+ case MEMBERSHIP:
+ result = IntMappingType.MembershipVirtualSchema;
+ break;
+
+ case USER:
+ result = IntMappingType.UserVirtualSchema;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends MappingItem> Class<T> mappingItemClass() {
+ Class result = null;
+
+ switch (type) {
+ case USER:
+ result = JPAUMappingItem.class;
+ break;
+
+ case GROUP:
+ result = JPAGMappingItem.class;
+ break;
+
+ case MEMBERSHIP:
+ result = AbstractMappingItem.class;
+ break;
+
+ case CONFIGURATION:
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AbstractAttributableTO> T newAttributableTO() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new UserTO();
+ break;
+ case GROUP:
+ result = (T) new GroupTO();
+ break;
+ case MEMBERSHIP:
+ result = (T) new MembershipTO();
+ break;
+ case CONFIGURATION:
+ result = (T) new ConfTO();
+ break;
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends AbstractSubjectTO> T newSubjectTO() {
+ T result = null;
+
+ switch (type) {
+ case USER:
+ result = (T) new UserTO();
+ break;
+ case GROUP:
+ result = (T) new GroupTO();
+ break;
+ case MEMBERSHIP:
+ case CONFIGURATION:
+ default:
+ break;
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntitlement.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntitlement.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntitlement.java
deleted file mode 100644
index 0ff7e05..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntitlement.java
+++ /dev/null
@@ -1,62 +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 javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-
-@Entity
-@Table(name = JPAEntitlement.TABLE)
-@Cacheable
-public class JPAEntitlement extends AbstractEntity<String> implements Entitlement {
-
- private static final long serialVersionUID = 8044745999246422483L;
-
- public static final String TABLE = "Entitlement";
-
- @Id
- private String name;
-
- @Column(nullable = true)
- private String description;
-
- @Override
- public String getKey() {
- return name;
- }
-
- @Override
- public void setKey(final String key) {
- this.name = key;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public void setDescription(final String description) {
- this.description = description;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
index 4d83b7c..3002dcc 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -21,14 +21,12 @@ package org.apache.syncope.core.persistence.jpa.entity;
import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.ConnPoolConf;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
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;
import org.apache.syncope.core.persistence.api.entity.Logger;
import org.apache.syncope.core.persistence.api.entity.Notification;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.Policy;
import org.apache.syncope.core.persistence.api.entity.PushPolicy;
import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.Report;
@@ -145,6 +143,14 @@ public class JPAEntityFactory implements EntityFactory {
if (reference.equals(Realm.class)) {
result = (T) new JPARealm();
+ } else if (reference.equals(AccountPolicy.class)) {
+ result = (T) new JPAAccountPolicy();
+ } else if (reference.equals(PasswordPolicy.class)) {
+ result = (T) new JPAPasswordPolicy();
+ } else if (reference.equals(PushPolicy.class)) {
+ result = (T) new JPAPushPolicy();
+ } else if (reference.equals(SyncPolicy.class)) {
+ result = (T) new JPASyncPolicy();
} else if (reference.equals(Role.class)) {
result = (T) new JPARole();
} else if (reference.equals(User.class)) {
@@ -157,8 +163,6 @@ public class JPAEntityFactory implements EntityFactory {
result = (T) new JPAConf();
} else if (reference.equals(Notification.class)) {
result = (T) new JPANotification();
- } else if (reference.equals(Entitlement.class)) {
- result = (T) new JPAEntitlement();
} else if (reference.equals(ExternalResource.class)) {
result = (T) new JPAExternalResource();
} else if (reference.equals(ConnInstance.class)) {
@@ -268,26 +272,6 @@ public class JPAEntityFactory implements EntityFactory {
return result;
}
- @SuppressWarnings("unchecked")
- @Override
- public <T extends Policy> T newPolicy(final Class<T> reference, final boolean global) {
- T result;
-
- if (reference.equals(AccountPolicy.class)) {
- result = (T) new JPAAccountPolicy(global);
- } else if (reference.equals(PasswordPolicy.class)) {
- result = (T) new JPAPasswordPolicy(global);
- } else if (reference.equals(PushPolicy.class)) {
- result = (T) new JPAPushPolicy(global);
- } else if (reference.equals(SyncPolicy.class)) {
- result = (T) new JPASyncPolicy(global);
- } else {
- throw new IllegalArgumentException("Could not find a JPA implementation of " + reference.getName());
- }
-
- return result;
- }
-
@Override
public ConnPoolConf newConnPoolConf() {
return new JPAConnPoolConf();
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
index 2f28485..5836dec 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
@@ -148,13 +148,13 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
@Column(nullable = false)
private TraceLevel syncTraceLevel;
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @ManyToOne(fetch = FetchType.EAGER)
private JPAPasswordPolicy passwordPolicy;
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @ManyToOne(fetch = FetchType.EAGER)
private JPAAccountPolicy accountPolicy;
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @ManyToOne(fetch = FetchType.EAGER)
private JPASyncPolicy syncPolicy;
/**
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPasswordPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPasswordPolicy.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPasswordPolicy.java
index d46575a..51f55a5 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPasswordPolicy.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPasswordPolicy.java
@@ -30,14 +30,7 @@ public class JPAPasswordPolicy extends JPAPolicy implements PasswordPolicy {
private static final long serialVersionUID = 9138550910385232849L;
public JPAPasswordPolicy() {
- this(false);
- }
-
- public JPAPasswordPolicy(final boolean global) {
super();
-
- this.type = global
- ? PolicyType.GLOBAL_PASSWORD
- : PolicyType.PASSWORD;
+ this.type = PolicyType.PASSWORD;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPushPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPushPolicy.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPushPolicy.java
index fe8868f..f4be722 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPushPolicy.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPushPolicy.java
@@ -33,10 +33,7 @@ public class JPAPushPolicy extends JPAPolicy implements PushPolicy {
public JPAPushPolicy(final boolean global) {
super();
-
- this.type = global
- ? PolicyType.GLOBAL_PUSH
- : PolicyType.PUSH;
+ this.type = PolicyType.PUSH;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java
index 22c48f6..a813535 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java
@@ -27,6 +27,7 @@ import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Realm;
@@ -49,13 +50,13 @@ public class JPARealm extends AbstractEntity<Long> implements Realm {
@Size(min = 1)
private String name;
- @ManyToOne(optional = true)
+ @ManyToOne
private JPARealm parent;
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @ManyToOne(fetch = FetchType.EAGER)
private JPAPasswordPolicy passwordPolicy;
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @ManyToOne(fetch = FetchType.EAGER)
private JPAAccountPolicy accountPolicy;
@Override
@@ -76,8 +77,8 @@ public class JPARealm extends AbstractEntity<Long> implements Realm {
@Override
public String getFullPath() {
return getParent() == null
- ? StringUtils.EMPTY
- : getParent().getFullPath() + "/" + getName();
+ ? SyncopeConstants.ROOT_REALM
+ : StringUtils.appendIfMissing(getParent().getFullPath(), "/") + getName();
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARole.java
----------------------------------------------------------------------
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 3d7ac29..e0ada80 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
@@ -73,8 +73,6 @@ public class JPARole extends AbstractEntity<Long> implements Role {
@Valid
private List<JPARealm> realms = new ArrayList<>();
- private String criteria;
-
@Override
public Long getKey() {
return id;
@@ -91,16 +89,6 @@ public class JPARole extends AbstractEntity<Long> implements Role {
}
@Override
- public String getCriteria() {
- return criteria;
- }
-
- @Override
- public void setCriteria(final String criteria) {
- this.criteria = criteria;
- }
-
- @Override
public Set<Entitlement> getEntitlements() {
return entitlements;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASyncPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASyncPolicy.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASyncPolicy.java
index b96a4c4..39b7565 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASyncPolicy.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASyncPolicy.java
@@ -30,14 +30,7 @@ public class JPASyncPolicy extends JPAPolicy implements SyncPolicy {
private static final long serialVersionUID = -6090413855809521279L;
public JPASyncPolicy() {
- this(false);
- }
-
- public JPASyncPolicy(final boolean global) {
super();
-
- this.type = global
- ? PolicyType.GLOBAL_SYNC
- : PolicyType.SYNC;
+ this.type = PolicyType.SYNC;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
deleted file mode 100644
index d81981a..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
+++ /dev/null
@@ -1,81 +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 org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
-import org.apache.syncope.core.persistence.api.entity.conf.Conf;
-import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.springframework.stereotype.Component;
-
-@Component
-public class JPAttributableUtilFactory implements AttributableUtilFactory {
-
- @Override
- public AttributableUtil getInstance(final AttributableType type) {
- return new JPAAttributableUtil(type);
- }
-
- @Override
- public AttributableUtil getInstance(final String attributableType) {
- return new JPAAttributableUtil(AttributableType.valueOf(attributableType));
- }
-
- @Override
- public AttributableUtil getInstance(final ObjectClass objectClass) {
- AttributableType type = null;
- if (ObjectClass.ACCOUNT.equals(objectClass)) {
- type = AttributableType.USER;
- } else if (ObjectClass.GROUP.equals(objectClass)) {
- type = AttributableType.GROUP;
- }
-
- if (type == null) {
- throw new IllegalArgumentException("ObjectClass not supported: " + objectClass);
- }
-
- return new JPAAttributableUtil(type);
- }
-
- @Override
- public AttributableUtil getInstance(final Attributable<?, ?, ?> attributable) {
- AttributableType type = null;
- if (attributable instanceof User) {
- type = AttributableType.USER;
- } else if (attributable instanceof Group) {
- type = AttributableType.GROUP;
- } else if (attributable instanceof Membership) {
- type = AttributableType.MEMBERSHIP;
- } else if (attributable instanceof Conf) {
- type = AttributableType.CONFIGURATION;
- }
-
- if (type == null) {
- throw new IllegalArgumentException("Attributable type not supported: " + attributable.getClass().getName());
- }
-
- return new JPAAttributableUtil(type);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilsFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilsFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilsFactory.java
new file mode 100644
index 0000000..e132601
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilsFactory.java
@@ -0,0 +1,81 @@
+/*
+ * 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 org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.core.persistence.api.entity.Attributable;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
+import org.apache.syncope.core.persistence.api.entity.conf.Conf;
+import org.apache.syncope.core.persistence.api.entity.membership.Membership;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.springframework.stereotype.Component;
+
+@Component
+public class JPAttributableUtilsFactory implements AttributableUtilsFactory {
+
+ @Override
+ public AttributableUtils getInstance(final AttributableType type) {
+ return new JPAAttributableUtils(type);
+ }
+
+ @Override
+ public AttributableUtils getInstance(final String attributableType) {
+ return new JPAAttributableUtils(AttributableType.valueOf(attributableType));
+ }
+
+ @Override
+ public AttributableUtils getInstance(final ObjectClass objectClass) {
+ AttributableType type = null;
+ if (ObjectClass.ACCOUNT.equals(objectClass)) {
+ type = AttributableType.USER;
+ } else if (ObjectClass.GROUP.equals(objectClass)) {
+ type = AttributableType.GROUP;
+ }
+
+ if (type == null) {
+ throw new IllegalArgumentException("ObjectClass not supported: " + objectClass);
+ }
+
+ return new JPAAttributableUtils(type);
+ }
+
+ @Override
+ public AttributableUtils getInstance(final Attributable<?, ?, ?> attributable) {
+ AttributableType type = null;
+ if (attributable instanceof User) {
+ type = AttributableType.USER;
+ } else if (attributable instanceof Group) {
+ type = AttributableType.GROUP;
+ } else if (attributable instanceof Membership) {
+ type = AttributableType.MEMBERSHIP;
+ } else if (attributable instanceof Conf) {
+ type = AttributableType.CONFIGURATION;
+ }
+
+ if (type == null) {
+ throw new IllegalArgumentException("Attributable type not supported: " + attributable.getClass().getName());
+ }
+
+ return new JPAAttributableUtils(type);
+ }
+
+}
[47/57] syncope git commit: [SYNCOPE-119] New security model
implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConfDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConfDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConfDAO.java
index e7db7cf..48e9f5e 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConfDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConfDAO.java
@@ -22,7 +22,7 @@ import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.core.persistence.api.dao.ConfDAO;
import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainSchema;
import org.apache.syncope.core.persistence.api.entity.conf.Conf;
@@ -42,7 +42,7 @@ public class JPAConfDAO extends AbstractDAO<Conf, Long> implements ConfDAO {
private PlainAttrDAO attrDAO;
@Autowired
- private AttributableUtilFactory attrUtilFactory;
+ private AttributableUtilsFactory attrUtilsFactory;
@Override
public Conf get() {
@@ -71,7 +71,7 @@ public class JPAConfDAO extends AbstractDAO<Conf, Long> implements ConfDAO {
result = new JPACPlainAttr();
result.setSchema(schemaDAO.find(key, CPlainSchema.class));
- result.addValue(defaultValue, attrUtilFactory.getInstance(AttributableType.CONFIGURATION));
+ result.addValue(defaultValue, attrUtilsFactory.getInstance(AttributableType.CONFIGURATION));
}
return result;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
index 18f7e68..be0ec94 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
@@ -27,7 +27,7 @@ import org.apache.syncope.core.persistence.api.dao.AttrTemplateDAO;
import org.apache.syncope.core.persistence.api.dao.DerAttrDAO;
import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
@@ -101,7 +101,7 @@ public class JPADerSchemaDAO extends AbstractDAO<DerSchema, String> implements D
@Override
@SuppressWarnings("unchecked")
- public void delete(final String key, final AttributableUtil attributableUtil) {
+ public void delete(final String key, final AttributableUtils attributableUtil) {
final DerSchema schema = find(key, attributableUtil.derSchemaClass());
if (schema == null) {
return;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAEntitlementDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAEntitlementDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAEntitlementDAO.java
deleted file mode 100644
index 18c0776..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAEntitlementDAO.java
+++ /dev/null
@@ -1,88 +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;
-
-import java.util.List;
-import javax.persistence.TypedQuery;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.jpa.entity.JPAEntitlement;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public class JPAEntitlementDAO extends AbstractDAO<Entitlement, String> implements EntitlementDAO {
-
- @Autowired
- private GroupDAO groupDAO;
-
- @Override
- public Entitlement find(final String name) {
- return entityManager.find(JPAEntitlement.class, name);
- }
-
- @Override
- public List<Entitlement> findAll() {
- TypedQuery<Entitlement> query = entityManager.createQuery(
- "SELECT e FROM " + JPAEntitlement.class.getSimpleName() + " e", Entitlement.class);
-
- return query.getResultList();
- }
-
- @Override
- public Entitlement save(final Entitlement entitlement) {
- return entityManager.merge(entitlement);
- }
-
- @Override
- public Entitlement saveGroupEntitlement(final Group group) {
- Entitlement groupEnt = new JPAEntitlement();
- groupEnt.setKey(GroupEntitlementUtil.getEntitlementNameFromGroupKey(group.getKey()));
- groupEnt.setDescription("Entitlement for managing group " + group.getKey());
-
- return save(groupEnt);
- }
-
- @Override
- public void delete(final String name) {
- Entitlement entitlement = find(name);
- if (entitlement == null) {
- return;
- }
-
- delete(entitlement);
- }
-
- @Override
- public void delete(final Entitlement entitlement) {
- if (entitlement == null) {
- return;
- }
-
- for (Group group : groupDAO.findByEntitlement(entitlement)) {
- group.removeEntitlement(entitlement);
- groupDAO.save(group);
- }
-
- entityManager.remove(entitlement);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
index c79d1e8..c32324e 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
@@ -38,9 +38,6 @@ import org.apache.syncope.core.persistence.api.entity.Mapping;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
import org.apache.syncope.core.persistence.api.entity.Policy;
import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.persistence.api.entity.task.PushTask;
-import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
import org.apache.syncope.core.persistence.api.entity.user.UMappingItem;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.jpa.entity.AbstractMappingItem;
@@ -92,17 +89,14 @@ public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource, String
append(" e WHERE e.");
switch (type) {
case ACCOUNT:
- case GLOBAL_ACCOUNT:
query.append("accountPolicy");
break;
case PASSWORD:
- case GLOBAL_PASSWORD:
query.append("passwordPolicy");
break;
case SYNC:
- case GLOBAL_SYNC:
query.append("syncPolicy");
break;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
index 1dff1f2..73fc456 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
@@ -18,7 +18,6 @@
*/
package org.apache.syncope.core.persistence.jpa.dao;
-import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -31,11 +30,9 @@ import javax.persistence.TypedQuery;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.DerAttrDAO;
-import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
@@ -43,12 +40,10 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.VirAttrDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.persistence.api.entity.Entitlement;
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.Policy;
import org.apache.syncope.core.persistence.api.entity.Subject;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MDerAttr;
@@ -70,8 +65,10 @@ import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
+import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.core.misc.RealmUtils;
+import org.apache.syncope.core.misc.security.AuthContextUtils;
+import org.apache.syncope.core.misc.security.UnauthorizedException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@@ -92,10 +89,7 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
private VirAttrDAO virAttrDAO;
@Autowired
- private EntitlementDAO entitlementDAO;
-
- @Autowired
- private AttributableUtilFactory attrUtilFactory;
+ private AttributableUtilsFactory attrUtilsFactory;
@Override
protected Subject<GPlainAttr, GDerAttr, GVirAttr> findInternal(final Long key) {
@@ -119,46 +113,19 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
}
@Override
- public List<Group> find(final String name) {
+ public Group find(final String name) {
TypedQuery<Group> query = entityManager.createQuery(
"SELECT e FROM " + JPAGroup.class.getSimpleName() + " e WHERE e.name = :name", Group.class);
query.setParameter("name", name);
- return query.getResultList();
- }
-
- @Override
- public Group find(final String name, final Long parentId) {
- TypedQuery<Group> query;
- if (parentId == null) {
- query = entityManager.createQuery("SELECT r FROM " + JPAGroup.class.getSimpleName() + " r WHERE "
- + "r.name=:name AND r.parent IS NULL", Group.class);
- } else {
- query = entityManager.createQuery("SELECT r FROM " + JPAGroup.class.getSimpleName() + " r WHERE "
- + "r.name=:name AND r.parent.id=:parentId", Group.class);
- query.setParameter("parentId", parentId);
+ Group result = null;
+ try {
+ result = query.getSingleResult();
+ } catch (NoResultException e) {
+ LOG.debug("No group found with name {}", name, e);
}
- query.setParameter("name", name);
-
- List<Group> result = query.getResultList();
- return result.isEmpty()
- ? null
- : result.get(0);
- }
-
- private void findSameOwnerDescendants(final List<Group> result, final Group group) {
- List<Group> children = findChildren(group);
- if (children != null) {
- for (Group child : children) {
- if ((child.getUserOwner() == null && child.getGroupOwner() == null && child.isInheritOwner())
- || (child.getUserOwner() != null && child.getUserOwner().equals(group.getUserOwner()))
- || (child.getGroupOwner() != null && child.getGroupOwner().equals(group.getGroupOwner()))) {
- findDescendants(result, child);
- }
- }
- }
- result.add(group);
+ return result;
}
@Transactional(readOnly = true)
@@ -178,12 +145,7 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
TypedQuery<Group> query = entityManager.createQuery(queryString.toString(), Group.class);
query.setParameter("owner", owner);
- List<Group> result = new ArrayList<>();
- for (Group group : query.getResultList()) {
- findSameOwnerDescendants(result, group);
- }
-
- return result;
+ return query.getResultList();
}
@Transactional(readOnly = true)
@@ -200,187 +162,57 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
TypedQuery<Group> query = entityManager.createQuery(queryString.toString(), Group.class);
query.setParameter("owner", owner);
- List<Group> result = new ArrayList<>();
- for (Group group : query.getResultList()) {
- findSameOwnerDescendants(result, group);
- }
-
- return result;
- }
-
- @Override
- public List<Group> findByEntitlement(final Entitlement entitlement) {
- TypedQuery<Group> query = entityManager.createQuery("SELECT e FROM " + JPAGroup.class.getSimpleName() + " e "
- + "WHERE :entitlement MEMBER OF e.entitlements", Group.class);
- query.setParameter("entitlement", entitlement);
-
return query.getResultList();
}
- private Map.Entry<String, String> getPolicyFields(final PolicyType type) {
- String policyField;
- String inheritPolicyField;
- if (type == PolicyType.GLOBAL_ACCOUNT || type == PolicyType.ACCOUNT) {
- policyField = "accountPolicy";
- inheritPolicyField = "inheritAccountPolicy";
- } else {
- policyField = "passwordPolicy";
- inheritPolicyField = "inheritPasswordPolicy";
- }
-
- return new AbstractMap.SimpleEntry<>(policyField, inheritPolicyField);
- }
-
- private List<Group> findSamePolicyChildren(final Group group, final PolicyType type) {
- List<Group> result = new ArrayList<>();
-
- for (Group child : findChildren(group)) {
- boolean inherit = type == PolicyType.GLOBAL_ACCOUNT || type == PolicyType.ACCOUNT
- ? child.isInheritAccountPolicy()
- : child.isInheritPasswordPolicy();
- if (inherit) {
- result.add(child);
- result.addAll(findSamePolicyChildren(child, type));
- }
- }
-
- return result;
- }
-
- @Override
- public List<Group> findByPolicy(final Policy policy) {
- if (policy.getType() == PolicyType.GLOBAL_SYNC || policy.getType() == PolicyType.SYNC) {
- return Collections.<Group>emptyList();
- }
-
- Map.Entry<String, String> policyFields = getPolicyFields(policy.getType());
- StringBuilder queryString = new StringBuilder("SELECT e FROM ").
- append(JPAGroup.class.getSimpleName()).append(" e WHERE e.").
- append(policyFields.getKey()).append(" = :policy AND (e.").
- append(policyFields.getValue()).append(" IS NULL OR e.").
- append(policyFields.getValue()).append(" = 0)");
-
- TypedQuery<Group> query = entityManager.createQuery(queryString.toString(), Group.class);
- query.setParameter("policy", policy);
-
- List<Group> result = new ArrayList<>();
- for (Group group : query.getResultList()) {
- result.add(group);
- result.addAll(findSamePolicyChildren(group, policy.getType()));
- }
- return result;
- }
-
- @Override
- public List<Group> findWithoutPolicy(final PolicyType type) {
- if (type == PolicyType.GLOBAL_SYNC || type == PolicyType.SYNC) {
- return Collections.<Group>emptyList();
- }
-
- Map.Entry<String, String> policyFields = getPolicyFields(type);
- StringBuilder queryString = new StringBuilder("SELECT e FROM ").
- append(JPAGroup.class.getSimpleName()).append(" e WHERE e.").
- append(policyFields.getKey()).append(" IS NULL AND (e.").
- append(policyFields.getValue()).append(" IS NULL OR e.").
- append(policyFields.getValue()).append(" = 0)");
-
- TypedQuery<Group> query = entityManager.createQuery(queryString.toString(), Group.class);
- return query.getResultList();
- }
-
- private void findAncestors(final List<Group> result, final Group group) {
- if (group.getParent() != null && !result.contains(group.getParent())) {
- result.add(group.getParent());
- findAncestors(result, group.getParent());
- }
- }
-
- @Override
- public List<Group> findAncestors(final Group group) {
- List<Group> result = new ArrayList<>();
- findAncestors(result, group);
- return result;
- }
-
- @Override
- public List<Group> findChildren(final Group group) {
- TypedQuery<Group> query = entityManager.createQuery(
- "SELECT g FROM " + JPAGroup.class.getSimpleName() + " g WHERE g.parent=:group", Group.class);
- query.setParameter("group", group);
-
- return query.getResultList();
- }
-
- private void findDescendants(final List<Group> result, final Group group) {
- List<Group> children = findChildren(group);
- if (children != null) {
- for (Group child : children) {
- findDescendants(result, child);
- }
- }
- result.add(group);
- }
-
- @Override
- public List<Group> findDescendants(final Group group) {
- List<Group> result = new ArrayList<>();
- findDescendants(result, group);
- return result;
- }
-
@SuppressWarnings("unchecked")
@Override
public List<Group> findByAttrValue(final String schemaName, final GPlainAttrValue attrValue) {
return (List<Group>) findByAttrValue(
- schemaName, attrValue, attrUtilFactory.getInstance(AttributableType.GROUP));
+ schemaName, attrValue, attrUtilsFactory.getInstance(AttributableType.GROUP));
}
@SuppressWarnings("unchecked")
@Override
public Group findByAttrUniqueValue(final String schemaName, final GPlainAttrValue attrUniqueValue) {
- return (Group) findByAttrUniqueValue(schemaName, attrUniqueValue,
- attrUtilFactory.getInstance(AttributableType.GROUP));
+ return (Group) findByAttrUniqueValue(
+ schemaName, attrUniqueValue, attrUtilsFactory.getInstance(AttributableType.GROUP));
}
@SuppressWarnings("unchecked")
@Override
public List<Group> findByDerAttrValue(final String schemaName, final String value) {
return (List<Group>) findByDerAttrValue(
- schemaName, value, attrUtilFactory.getInstance(AttributableType.GROUP));
+ schemaName, value, attrUtilsFactory.getInstance(AttributableType.GROUP));
}
@SuppressWarnings("unchecked")
@Override
public List<Group> findByResource(final ExternalResource resource) {
- return (List<Group>) findByResource(resource, attrUtilFactory.getInstance(AttributableType.GROUP));
+ return (List<Group>) findByResource(resource, attrUtilsFactory.getInstance(AttributableType.GROUP));
}
@Override
- public List<Group> findAll() {
- return findAll(-1, -1, Collections.<OrderByClause>emptyList());
+ public final List<Group> findAll(final Set<String> adminRealms, final int page, final int itemsPerPage) {
+ return findAll(adminRealms, page, itemsPerPage, Collections.<OrderByClause>emptyList());
}
@Override
- public List<Group> findAll(final int page, final int itemsPerPage, final List<OrderByClause> orderBy) {
- TypedQuery<Group> query = entityManager.createQuery("SELECT e FROM " + JPAGroup.class.getSimpleName() + " e "
- + toOrderByStatement(Group.class, "e", orderBy), Group.class);
-
- query.setFirstResult(itemsPerPage * (page <= 0
- ? 0
- : page - 1));
+ public List<Group> findAll(final Set<String> adminRealms,
+ final int page, final int itemsPerPage, final List<OrderByClause> orderBy) {
- if (itemsPerPage > 0) {
- query.setMaxResults(itemsPerPage);
- }
+ return searchDAO.search(adminRealms, getAllMatchingCond(), page, itemsPerPage, orderBy, SubjectType.GROUP);
+ }
- return query.getResultList();
+ @Override
+ public final int count(final Set<String> adminRealms) {
+ return searchDAO.count(adminRealms, getAllMatchingCond(), SubjectType.GROUP);
}
@Override
public List<Membership> findMemberships(final Group group) {
TypedQuery<Membership> query = entityManager.createQuery(
- "SELECT e FROM " + JPAMembership.class.getSimpleName() + " e"
- + " WHERE e.group=:group", Membership.class);
+ "SELECT e FROM " + JPAMembership.class.getSimpleName() + " e WHERE e.group=:group", Membership.class);
query.setParameter("group", group);
return query.getResultList();
@@ -406,28 +238,11 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
}
@Override
- public final int count() {
- Query countQuery = entityManager.createNativeQuery("SELECT COUNT(e.id) FROM " + JPAGroup.TABLE + " e");
-
- return ((Number) countQuery.getSingleResult()).intValue();
- }
-
- @Override
public Group save(final Group group) {
- // reset account policy in case of inheritance
- if (group.isInheritAccountPolicy()) {
- group.setAccountPolicy(null);
- }
-
- // reset password policy in case of inheritance
- if (group.isInheritPasswordPolicy()) {
- group.setPasswordPolicy(null);
- }
-
// remove plain attributes without a valid template
List<GPlainAttr> rToBeDeleted = new ArrayList<>();
for (final PlainAttr attr : group.getPlainAttrs()) {
- boolean found = CollectionUtils.exists(group.findInheritedTemplates(GPlainAttrTemplate.class),
+ boolean found = CollectionUtils.exists(group.getAttrTemplates(GPlainAttrTemplate.class),
new Predicate<GPlainAttrTemplate>() {
@Override
@@ -447,7 +262,7 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
// remove derived attributes without a valid template
List<GDerAttr> rDerToBeDeleted = new ArrayList<>();
for (final DerAttr attr : group.getDerAttrs()) {
- boolean found = CollectionUtils.exists(group.findInheritedTemplates(GDerAttrTemplate.class),
+ boolean found = CollectionUtils.exists(group.getAttrTemplates(GDerAttrTemplate.class),
new Predicate<GDerAttrTemplate>() {
@Override
@@ -467,7 +282,7 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
// remove virtual attributes without a valid template
List<GVirAttr> rVirToBeDeleted = new ArrayList<>();
for (final VirAttr attr : group.getVirAttrs()) {
- boolean found = CollectionUtils.exists(group.findInheritedTemplates(GVirAttrTemplate.class),
+ boolean found = CollectionUtils.exists(group.getAttrTemplates(GVirAttrTemplate.class),
new Predicate<GVirAttrTemplate>() {
@Override
@@ -508,30 +323,19 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
attr.getValues().addAll(group.getVirAttr(attr.getSchema().getKey()).getValues());
}
- entitlementDAO.saveGroupEntitlement(merged);
-
return merged;
}
@Override
public void delete(final Group group) {
- for (Group groupToBeDeleted : findDescendants(group)) {
- for (Membership membership : findMemberships(groupToBeDeleted)) {
- membership.getUser().removeMembership(membership);
- userDAO.save(membership.getUser());
-
- entityManager.remove(membership);
- }
-
- groupToBeDeleted.getEntitlements().clear();
-
- groupToBeDeleted.setParent(null);
- groupToBeDeleted.setUserOwner(null);
- groupToBeDeleted.setGroupOwner(null);
- entityManager.remove(groupToBeDeleted);
+ for (Membership membership : findMemberships(group)) {
+ membership.getUser().removeMembership(membership);
+ userDAO.save(membership.getUser());
- entitlementDAO.delete(GroupEntitlementUtil.getEntitlementNameFromGroupKey(groupToBeDeleted.getKey()));
+ entityManager.remove(membership);
}
+
+ entityManager.remove(group);
}
@Override
@@ -545,20 +349,29 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
}
@Override
- public Group authFetch(Long key) {
+ public Group authFetch(final Long key) {
if (key == null) {
throw new NotFoundException("Null group id");
}
- Group group = find(key);
+ final Group group = find(key);
if (group == null) {
throw new NotFoundException("Group " + key);
}
- Set<Long> allowedGroupKeys = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
- if (!allowedGroupKeys.contains(group.getKey())) {
- throw new UnauthorizedGroupException(group.getKey());
+ Set<String> authRealms = AuthContextUtils.getAuthorizations().get(Entitlement.GROUP_READ);
+ boolean authorized = CollectionUtils.exists(authRealms, new Predicate<String>() {
+
+ @Override
+ public boolean evaluate(final String realm) {
+ return group.getRealm().getFullPath().startsWith(realm)
+ || realm.equals(RealmUtils.getGroupOwnerRealm(group.getRealm().getFullPath(), group.getKey()));
+ }
+ });
+ if (authRealms == null || authRealms.isEmpty() || !authorized) {
+ throw new UnauthorizedException(SubjectType.GROUP, group.getKey());
}
+
return group;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
index 9b3ae5b..cc7df33 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
@@ -27,7 +27,7 @@ import org.apache.syncope.core.persistence.api.dao.AttrTemplateDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.conf.CPlainSchema;
@@ -107,7 +107,7 @@ public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema, String> implemen
@Override
@SuppressWarnings("unchecked")
- public void delete(final String key, final AttributableUtil attributableUtil) {
+ public void delete(final String key, final AttributableUtils attributableUtil) {
PlainSchema schema = find(key, attributableUtil.plainSchemaClass());
if (schema == null) {
return;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
index 68c5677..1007ac4 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
@@ -21,23 +21,25 @@ package org.apache.syncope.core.persistence.jpa.dao;
import java.util.List;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
-import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Policy;
-import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
+import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.jpa.entity.JPAPolicy;
import org.apache.syncope.core.persistence.jpa.entity.JPAAccountPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.JPARealm;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
public class JPAPolicyDAO extends AbstractDAO<Policy, Long> implements PolicyDAO {
+ @Autowired
+ private RealmDAO realmDAO;
+
@Override
@SuppressWarnings("unchecked")
public <T extends Policy> T find(final Long key) {
@@ -72,30 +74,6 @@ public class JPAPolicyDAO extends AbstractDAO<Policy, Long> implements PolicyDAO
}
@Override
- public PasswordPolicy getGlobalPasswordPolicy() {
- List<? extends Policy> policies = find(PolicyType.GLOBAL_PASSWORD);
- return policies == null || policies.isEmpty()
- ? null
- : (PasswordPolicy) policies.get(0);
- }
-
- @Override
- public AccountPolicy getGlobalAccountPolicy() {
- List<? extends Policy> policies = find(PolicyType.GLOBAL_ACCOUNT);
- return policies == null || policies.isEmpty()
- ? null
- : (AccountPolicy) policies.get(0);
- }
-
- @Override
- public SyncPolicy getGlobalSyncPolicy() {
- List<? extends Policy> policies = find(PolicyType.GLOBAL_SYNC);
- return policies == null || policies.isEmpty()
- ? null
- : (SyncPolicy) policies.get(0);
- }
-
- @Override
public List<Policy> findAll() {
TypedQuery<Policy> query = entityManager.createQuery(
"SELECT e FROM " + JPAPolicy.class.getSimpleName() + " e", Policy.class);
@@ -104,55 +82,17 @@ public class JPAPolicyDAO extends AbstractDAO<Policy, Long> implements PolicyDAO
@Override
public <T extends Policy> T save(final T policy) {
- switch (policy.getType()) {
- case GLOBAL_PASSWORD:
- // just one GLOBAL_PASSWORD policy
- final PasswordPolicy passwordPolicy = getGlobalPasswordPolicy();
-
- if (passwordPolicy != null && !passwordPolicy.getKey().equals(policy.getKey())) {
- throw new InvalidEntityException(PasswordPolicy.class, EntityViolationType.InvalidPasswordPolicy,
- "Global Password policy already exists");
- }
- break;
-
- case GLOBAL_ACCOUNT:
- // just one GLOBAL_ACCOUNT policy
- final AccountPolicy accountPolicy = getGlobalAccountPolicy();
-
- if (accountPolicy != null && !accountPolicy.getKey().equals(policy.getKey())) {
- throw new InvalidEntityException(PasswordPolicy.class, EntityViolationType.InvalidAccountPolicy,
- "Global Account policy already exists");
- }
- break;
-
- case GLOBAL_SYNC:
- // just one GLOBAL_SYNC policy
- final SyncPolicy syncPolicy = getGlobalSyncPolicy();
-
- if (syncPolicy != null && !syncPolicy.getKey().equals(policy.getKey())) {
- throw new InvalidEntityException(PasswordPolicy.class, EntityViolationType.InvalidSyncPolicy,
- "Global Synchronization policy already exists");
- }
- break;
-
- case PASSWORD:
- case ACCOUNT:
- case SYNC:
- default:
- }
-
return entityManager.merge(policy);
}
@Override
public <T extends Policy> void delete(final T policy) {
- if (policy instanceof AccountPolicy || policy instanceof PasswordPolicy) {
- final String field = policy instanceof AccountPolicy ? "accountPolicy" : "passwordPolicy";
- entityManager.createQuery(
- "UPDATE " + JPARealm.class.getSimpleName() + " e SET e." + field + " = NULL "
- + "WHERE e." + field + "=:policy").
- setParameter("policy", policy).
- executeUpdate();
+ for (Realm realm : realmDAO.findByPolicy(policy)) {
+ if (policy instanceof AccountPolicy) {
+ realm.setAccountPolicy(null);
+ } else if (policy instanceof PasswordPolicy) {
+ realm.setPasswordPolicy(null);
+ }
}
entityManager.remove(policy);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
index 0921d8c..f5625ee 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
@@ -19,15 +19,21 @@
package org.apache.syncope.core.persistence.jpa.dao;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.types.PolicyType;
import org.apache.syncope.core.persistence.api.dao.MalformedPathException;
import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.Policy;
import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.Role;
import org.apache.syncope.core.persistence.jpa.entity.JPARealm;
@@ -64,11 +70,11 @@ public class JPARealmDAO extends AbstractDAO<Realm, Long> implements RealmDAO {
@Override
public Realm find(final String fullPath) {
- if ("/".equals(fullPath)) {
+ if (SyncopeConstants.ROOT_REALM.equals(fullPath)) {
return getRoot();
}
- if (!PATH_PATTERN.matcher(fullPath).matches()) {
+ if (StringUtils.isBlank(fullPath) || !PATH_PATTERN.matcher(fullPath).matches()) {
throw new MalformedPathException(fullPath);
}
@@ -93,6 +99,59 @@ public class JPARealmDAO extends AbstractDAO<Realm, Long> implements RealmDAO {
return current;
}
+ private <T extends Policy> List<Realm> findSamePolicyChildren(final Realm realm, final T policy) {
+ List<Realm> result = new ArrayList<>();
+
+ for (Realm child : findChildren(realm)) {
+ if ((policy.getType() == PolicyType.ACCOUNT
+ && child.getAccountPolicy() == null || policy.equals(child.getAccountPolicy()))
+ || (policy.getType() == PolicyType.PASSWORD
+ && child.getPasswordPolicy() == null || policy.equals(child.getPasswordPolicy()))) {
+
+ result.add(child);
+ result.addAll(findSamePolicyChildren(child, policy));
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T extends Policy> List<Realm> findByPolicy(final T policy) {
+ if (policy.getType() == PolicyType.SYNC) {
+ return Collections.<Realm>emptyList();
+ }
+
+ StringBuilder queryString = new StringBuilder("SELECT e FROM ").
+ append(JPARealm.class.getSimpleName()).append(" e WHERE e.").
+ append(policy instanceof AccountPolicy ? "accountPolicy" : "passwordPolicy").append("=:policy");
+
+ TypedQuery<Realm> query = entityManager.createQuery(queryString.toString(), Realm.class);
+ query.setParameter("policy", policy);
+
+ List<Realm> result = new ArrayList<>();
+ for (Realm realm : query.getResultList()) {
+ result.add(realm);
+ result.addAll(findSamePolicyChildren(realm, policy));
+ }
+ return result;
+ }
+
+ private void findAncestors(final List<Realm> result, final Realm realm) {
+ if (realm.getParent() != null && !result.contains(realm.getParent())) {
+ result.add(realm.getParent());
+ findAncestors(result, realm.getParent());
+ }
+ }
+
+ @Override
+ public List<Realm> findAncestors(final Realm realm) {
+ List<Realm> result = new ArrayList<>();
+ result.add(realm);
+ findAncestors(result, realm);
+ return result;
+ }
+
@Override
public List<Realm> findChildren(final Realm realm) {
TypedQuery<Realm> query = entityManager.createQuery(
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
index f240850..61be20f 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
@@ -22,14 +22,19 @@ import java.util.List;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.Role;
import org.apache.syncope.core.persistence.jpa.entity.JPARole;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
public class JPARoleDAO extends AbstractDAO<Role, Long> implements RoleDAO {
+ @Autowired
+ private SubjectSearchDAO searchDAO;
+
@Override
public Role find(final Long key) {
return entityManager.find(JPARole.class, key);
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPASubjectSearchDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPASubjectSearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPASubjectSearchDAO.java
index 3e30b7c..8908209 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPASubjectSearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPASubjectSearchDAO.java
@@ -24,6 +24,7 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.Entity;
@@ -32,12 +33,16 @@ import javax.persistence.TemporalType;
import javax.validation.ValidationException;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.core.misc.RealmUtils;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
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.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
@@ -47,10 +52,11 @@ import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.dao.search.ResourceCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.dao.search.SubjectCond;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@@ -62,6 +68,9 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
private static final String EMPTY_ATTR_QUERY = "SELECT subject_id FROM user_search_attr WHERE 1=2";
@Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
private UserDAO userDAO;
@Autowired
@@ -71,52 +80,57 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
private PlainSchemaDAO schemaDAO;
@Autowired
- private AttributableUtilFactory attrUtilFactory;
-
- private String getAdminGroupsFilter(final Set<Long> adminGroups, final SubjectType type) {
- final StringBuilder adminGroupFilter = new StringBuilder();
+ private AttributableUtilsFactory attrUtilsFactory;
+
+ private String getAdminRealmsFilter(final Set<String> adminRealms, final SearchSupport svs) {
+ Set<Long> realmKeys = new HashSet<>();
+ for (String realmPath : RealmUtils.normalize(adminRealms)) {
+ Realm realm = realmDAO.find(realmPath);
+ if (realm == null) {
+ LOG.warn("Ignoring invalid realm {}", realmPath);
+ } else {
+ CollectionUtils.collect(realmDAO.findDescendants(realm), new Transformer<Realm, Long>() {
- if (type == SubjectType.USER) {
- adminGroupFilter.append("SELECT user_id AS subject_id FROM Membership M1 WHERE group_id IN (").
- append("SELECT group_id FROM Membership M2 WHERE M2.user_id=M1.user_id ").
- append("AND group_id NOT IN (");
+ @Override
+ public Long transform(final Realm descendant) {
+ return descendant.getKey();
+ }
+ }, realmKeys);
+ }
}
- adminGroupFilter.append("SELECT id AS ").
- append(type == SubjectType.USER ? "group" : "subject").
- append("_id FROM SyncopeGroup");
-
- boolean firstGroup = true;
+ StringBuilder adminRealmFilter = new StringBuilder().
+ append("SELECT subject_id FROM ").append(svs.field().name).
+ append(" WHERE realm_id IN (SELECT id AS realm_id FROM Realm");
- for (Long adminGroupId : adminGroups) {
- if (firstGroup) {
- adminGroupFilter.append(" WHERE");
- firstGroup = false;
+ boolean firstRealm = true;
+ for (Long realmKey : realmKeys) {
+ if (firstRealm) {
+ adminRealmFilter.append(" WHERE");
+ firstRealm = false;
} else {
- adminGroupFilter.append(type == SubjectType.USER ? " OR" : " AND");
+ adminRealmFilter.append(" OR");
}
- adminGroupFilter.append(type == SubjectType.USER ? " id = " : " id <> ").append(adminGroupId);
+ adminRealmFilter.append(" id = ").append(realmKey);
}
- if (type == SubjectType.USER) {
- adminGroupFilter.append("))");
- }
+ adminRealmFilter.append(')');
- return adminGroupFilter.toString();
+ return adminRealmFilter.toString();
}
@Override
- public int count(final Set<Long> adminGroups, final SearchCond searchCondition, final SubjectType type) {
+ public int count(final Set<String> adminRealms, final SearchCond searchCondition, final SubjectType type) {
List<Object> parameters = Collections.synchronizedList(new ArrayList<>());
// 1. get the query string from the search condition
SearchSupport svs = new SearchSupport(type);
StringBuilder queryString = getQuery(searchCondition, parameters, type, svs);
- // 2. take into account administrative groups
+ // 2. take into account administrative realms
queryString.insert(0, "SELECT u.subject_id FROM (");
- queryString.append(") u WHERE subject_id NOT IN (");
- queryString.append(getAdminGroupsFilter(adminGroups, type)).append(')');
+ queryString.append(") u WHERE subject_id IN (");
+ queryString.append(getAdminRealmsFilter(adminRealms, svs)).append(')');
// 3. prepare the COUNT query
queryString.insert(0, "SELECT COUNT(subject_id) FROM (");
@@ -135,32 +149,32 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
@Override
public <T extends Subject<?, ?, ?>> List<T> search(
- final Set<Long> adminGroups, final SearchCond searchCondition, final SubjectType type) {
+ final Set<String> adminRealms, final SearchCond searchCondition, final SubjectType type) {
- return search(adminGroups, searchCondition, Collections.<OrderByClause>emptyList(), type);
+ return search(adminRealms, searchCondition, Collections.<OrderByClause>emptyList(), type);
}
@Override
public <T extends Subject<?, ?, ?>> List<T> search(
- final Set<Long> adminGroups, final SearchCond searchCondition, final List<OrderByClause> orderBy,
+ final Set<String> adminRealms, final SearchCond searchCondition, final List<OrderByClause> orderBy,
final SubjectType type) {
- return search(adminGroups, searchCondition, -1, -1, orderBy, type);
+ return search(adminRealms, searchCondition, -1, -1, orderBy, type);
}
@Override
public <T extends Subject<?, ?, ?>> List<T> search(
- final Set<Long> adminGroups, final SearchCond searchCondition, final int page, final int itemsPerPage,
+ final Set<String> adminRealms, final SearchCond searchCondition, final int page, final int itemsPerPage,
final List<OrderByClause> orderBy, final SubjectType type) {
List<T> result = Collections.<T>emptyList();
- if (adminGroups != null && (!adminGroups.isEmpty() || groupDAO.findAll().isEmpty())) {
+ if (adminRealms != null && !adminRealms.isEmpty()) {
LOG.debug("Search condition:\n{}", searchCondition);
if (searchCondition != null && searchCondition.isValid()) {
try {
- result = doSearch(adminGroups, searchCondition, page, itemsPerPage, orderBy, type);
+ result = doSearch(adminRealms, searchCondition, page, itemsPerPage, orderBy, type);
} catch (Exception e) {
LOG.error("While searching for {}", type, e);
}
@@ -239,7 +253,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
return select;
}
- private StringBuilder buildWhere(final OrderBySupport orderBySupport, final SubjectType type) {
+ private StringBuilder buildWhere(final OrderBySupport orderBySupport) {
final StringBuilder where = new StringBuilder(" u");
for (SearchSupport.SearchView searchView : orderBySupport.views) {
where.append(',').append(searchView.name).append(' ').append(searchView.alias);
@@ -254,7 +268,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
where.append(obs.where).append(" AND ");
}
}
- where.append("u.subject_id NOT IN (");
+ where.append("u.subject_id IN (");
return where;
}
@@ -276,7 +290,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
private OrderBySupport parseOrderBy(final SubjectType type, final SearchSupport svs,
final List<OrderByClause> orderByClauses) {
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(type.asAttributableType());
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(type.asAttributableType());
OrderBySupport orderBySupport = new OrderBySupport();
@@ -286,9 +300,9 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
// Manage difference among external key attribute and internal JPA @Id
String fieldName = "key".equals(clause.getField()) ? "id" : clause.getField();
- Field subjectField = ReflectionUtils.findField(attrUtil.attributableClass(), fieldName);
+ Field subjectField = ReflectionUtils.findField(attrUtils.attributableClass(), fieldName);
if (subjectField == null) {
- PlainSchema schema = schemaDAO.find(fieldName, attrUtil.plainSchemaClass());
+ PlainSchema schema = schemaDAO.find(fieldName, attrUtils.plainSchemaClass());
if (schema != null) {
if (schema.isUniqueConstraint()) {
orderBySupport.views.add(svs.uniqueAttr());
@@ -331,7 +345,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
}
@SuppressWarnings("unchecked")
- private <T extends Subject<?, ?, ?>> List<T> doSearch(final Set<Long> adminGroups,
+ private <T extends Subject<?, ?, ?>> List<T> doSearch(final Set<String> adminRealms,
final SearchCond nodeCond, final int page, final int itemsPerPage, final List<OrderByClause> orderBy,
final SubjectType type) {
@@ -345,13 +359,13 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
OrderBySupport orderBySupport = parseOrderBy(type, svs, orderBy);
if (queryString.charAt(0) == '(') {
queryString.insert(0, buildSelect(orderBySupport));
- queryString.append(buildWhere(orderBySupport, type));
+ queryString.append(buildWhere(orderBySupport));
} else {
queryString.insert(0, buildSelect(orderBySupport).append('('));
- queryString.append(')').append(buildWhere(orderBySupport, type));
+ queryString.append(')').append(buildWhere(orderBySupport));
}
queryString.
- append(getAdminGroupsFilter(adminGroups, type)).append(')').
+ append(getAdminRealmsFilter(adminRealms, svs)).append(')').
append(buildOrderBy(orderBySupport));
// 3. prepare the search query
@@ -605,15 +619,15 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
private String getQuery(final AttributeCond cond, final boolean not, final List<Object> parameters,
final SubjectType type, final SearchSupport svs) {
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(type.asAttributableType());
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(type.asAttributableType());
- PlainSchema schema = schemaDAO.find(cond.getSchema(), attrUtil.plainSchemaClass());
+ PlainSchema schema = schemaDAO.find(cond.getSchema(), attrUtils.plainSchemaClass());
if (schema == null) {
LOG.warn("Ignoring invalid schema '{}'", cond.getSchema());
return EMPTY_ATTR_QUERY;
}
- PlainAttrValue attrValue = attrUtil.newPlainAttrValue();
+ PlainAttrValue attrValue = attrUtils.newPlainAttrValue();
try {
if (cond.getType() != AttributeCond.Type.LIKE && cond.getType() != AttributeCond.Type.ISNULL
&& cond.getType() != AttributeCond.Type.ISNOTNULL) {
@@ -654,20 +668,20 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
private String getQuery(final SubjectCond cond, final boolean not, final List<Object> parameters,
final SubjectType type, final SearchSupport svs) {
- final AttributableUtil attrUtil = attrUtilFactory.getInstance(type.asAttributableType());
+ final AttributableUtils attrUtils = attrUtilsFactory.getInstance(type.asAttributableType());
// Keeps track of difference between entity's getKey() and JPA @Id fields
if ("key".equals(cond.getSchema())) {
cond.setSchema("id");
}
- Field subjectField = ReflectionUtils.findField(attrUtil.attributableClass(), cond.getSchema());
+ Field subjectField = ReflectionUtils.findField(attrUtils.attributableClass(), cond.getSchema());
if (subjectField == null) {
LOG.warn("Ignoring invalid schema '{}'", cond.getSchema());
return EMPTY_ATTR_QUERY;
}
- PlainSchema schema = attrUtil.newPlainSchema();
+ PlainSchema schema = attrUtils.newPlainSchema();
schema.setKey(subjectField.getName());
for (AttrSchemaType attrSchemaType : AttrSchemaType.values()) {
if (subjectField.getType().isAssignableFrom(attrSchemaType.getType())) {
@@ -713,7 +727,7 @@ public class JPASubjectSearchDAO extends AbstractDAO<Subject<?, ?, ?>, Long> imp
}
}
- PlainAttrValue attrValue = attrUtil.newPlainAttrValue();
+ PlainAttrValue attrValue = attrUtils.newPlainAttrValue();
if (cond.getType() != AttributeCond.Type.LIKE
&& cond.getType() != AttributeCond.Type.ISNULL
&& cond.getType() != AttributeCond.Type.ISNOTNULL) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
index 5e48aac..5264fcd 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
@@ -24,18 +24,16 @@ import java.util.Set;
import javax.annotation.Resource;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.dao.SubjectSearchDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.core.persistence.api.dao.search.SubjectCond;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.Subject;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
@@ -47,8 +45,8 @@ import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.misc.security.UnauthorizedGroupException;
+import org.apache.syncope.core.misc.security.AuthContextUtils;
+import org.apache.syncope.core.misc.security.UnauthorizedException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@@ -57,16 +55,13 @@ import org.springframework.transaction.annotation.Transactional;
public class JPAUserDAO extends AbstractSubjectDAO<UPlainAttr, UDerAttr, UVirAttr> implements UserDAO {
@Autowired
- private SubjectSearchDAO searchDAO;
-
- @Autowired
private GroupDAO groupDAO;
@Resource(name = "anonymousUser")
private String anonymousUser;
@Autowired
- private AttributableUtilFactory attrUtilFactory;
+ private AttributableUtilsFactory attrUtilsFactory;
@Override
protected Subject<UPlainAttr, UDerAttr, UVirAttr> findInternal(final Long key) {
@@ -150,51 +145,44 @@ public class JPAUserDAO extends AbstractSubjectDAO<UPlainAttr, UDerAttr, UVirAtt
@Override
public List<User> findByAttrValue(final String schemaName, final UPlainAttrValue attrValue) {
return (List<User>) findByAttrValue(
- schemaName, attrValue, attrUtilFactory.getInstance(AttributableType.USER));
+ schemaName, attrValue, attrUtilsFactory.getInstance(AttributableType.USER));
}
@SuppressWarnings("unchecked")
@Override
public User findByAttrUniqueValue(final String schemaName, final UPlainAttrValue attrUniqueValue) {
return (User) findByAttrUniqueValue(schemaName, attrUniqueValue,
- attrUtilFactory.getInstance(AttributableType.USER));
+ attrUtilsFactory.getInstance(AttributableType.USER));
}
@SuppressWarnings("unchecked")
@Override
public List<User> findByDerAttrValue(final String schemaName, final String value) {
return (List<User>) findByDerAttrValue(
- schemaName, value, attrUtilFactory.getInstance(AttributableType.USER));
+ schemaName, value, attrUtilsFactory.getInstance(AttributableType.USER));
}
@SuppressWarnings("unchecked")
@Override
public List<User> findByResource(final ExternalResource resource) {
- return (List<User>) findByResource(resource, attrUtilFactory.getInstance(AttributableType.USER));
+ return (List<User>) findByResource(resource, attrUtilsFactory.getInstance(AttributableType.USER));
}
@Override
- public final List<User> findAll(final Set<Long> adminGroups, final int page, final int itemsPerPage) {
- return findAll(adminGroups, page, itemsPerPage, Collections.<OrderByClause>emptyList());
- }
-
- private SearchCond getAllMatchingCond() {
- SubjectCond idCond = new SubjectCond(AttributeCond.Type.ISNOTNULL);
- idCond.setSchema("id");
- return SearchCond.getLeafCond(idCond);
+ public final List<User> findAll(final Set<String> adminRealms, final int page, final int itemsPerPage) {
+ return findAll(adminRealms, page, itemsPerPage, Collections.<OrderByClause>emptyList());
}
@Override
- public List<User> findAll(final Set<Long> adminGroups,
+ public List<User> findAll(final Set<String> adminRealms,
final int page, final int itemsPerPage, final List<OrderByClause> orderBy) {
- return searchDAO.search(
- adminGroups, getAllMatchingCond(), page, itemsPerPage, orderBy, SubjectType.USER);
+ return searchDAO.search(adminRealms, getAllMatchingCond(), page, itemsPerPage, orderBy, SubjectType.USER);
}
@Override
- public final int count(final Set<Long> adminGroups) {
- return searchDAO.count(adminGroups, getAllMatchingCond(), SubjectType.USER);
+ public final int count(final Set<String> adminRealms) {
+ return searchDAO.count(adminRealms, getAllMatchingCond(), SubjectType.USER);
}
@Override
@@ -237,15 +225,20 @@ public class JPAUserDAO extends AbstractSubjectDAO<UPlainAttr, UDerAttr, UVirAtt
private void securityChecks(final User user) {
// Allows anonymous (during self-registration) and self (during self-update) to read own user,
- // otherwise goes thorugh security checks to see if needed group entitlements are owned
- if (!AuthContextUtil.getAuthenticatedUsername().equals(anonymousUser)
- && !AuthContextUtil.getAuthenticatedUsername().equals(user.getUsername())) {
-
- Set<Long> groupKeys = user.getGroupKeys();
- Set<Long> adminGroupKeys = GroupEntitlementUtil.getGroupKeys(AuthContextUtil.getOwnedEntitlementNames());
- groupKeys.removeAll(adminGroupKeys);
- if (!groupKeys.isEmpty()) {
- throw new UnauthorizedGroupException(groupKeys);
+ // otherwise goes through security checks to see if required entitlements are owned
+ if (!AuthContextUtils.getAuthenticatedUsername().equals(anonymousUser)
+ && !AuthContextUtils.getAuthenticatedUsername().equals(user.getUsername())) {
+
+ Set<String> authRealms = AuthContextUtils.getAuthorizations().get(Entitlement.USER_READ);
+ boolean authorized = CollectionUtils.exists(authRealms, new Predicate<String>() {
+
+ @Override
+ public boolean evaluate(final String realm) {
+ return user.getRealm().getFullPath().startsWith(realm);
+ }
+ });
+ if (authRealms == null || authRealms.isEmpty() || !authorized) {
+ throw new UnauthorizedException(SubjectType.USER, user.getKey());
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
index 873e0c3..f0ce84b 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
@@ -27,7 +27,7 @@ import org.apache.syncope.core.persistence.api.dao.AttrTemplateDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.VirAttrDAO;
import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
@@ -100,7 +100,7 @@ public class JPAVirSchemaDAO extends AbstractDAO<VirSchema, String> implements V
}
@Override
- public void delete(final String key, final AttributableUtil attributableUtil) {
+ public void delete(final String key, final AttributableUtils attributableUtil) {
final VirSchema schema = find(key, attributableUtil.virSchemaClass());
if (schema == null) {
return;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttributable.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttributable.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttributable.java
index 6d4f6c3..b2e2b34 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttributable.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttributable.java
@@ -18,19 +18,12 @@
*/
package org.apache.syncope.core.persistence.jpa.entity;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.MapUtils;
import org.apache.commons.collections4.Predicate;
-import org.apache.commons.collections4.Transformer;
import org.apache.syncope.core.persistence.api.entity.Attributable;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
public abstract class AbstractAttributable<P extends PlainAttr, D extends DerAttr, V extends VirAttr>
extends AbstractAnnotatedEntity<Long> implements Attributable<P, D, V> {
@@ -72,34 +65,4 @@ public abstract class AbstractAttributable<P extends PlainAttr, D extends DerAtt
}
});
}
-
- protected Map<PlainSchema, P> getPlainAttrMap() {
- return MapUtils.lazyMap(new HashMap<PlainSchema, P>(), new Transformer<PlainSchema, P>() {
-
- @Override
- public P transform(final PlainSchema input) {
- return getPlainAttr(input.getKey());
- }
- });
- }
-
- protected Map<DerSchema, D> getDerAttrMap() {
- return MapUtils.lazyMap(new HashMap<DerSchema, D>(), new Transformer<DerSchema, D>() {
-
- @Override
- public D transform(final DerSchema input) {
- return getDerAttr(input.getKey());
- }
- });
- }
-
- protected Map<VirSchema, V> getVirAttrMap() {
- return MapUtils.lazyMap(new HashMap<VirSchema, V>(), new Transformer<VirSchema, V>() {
-
- @Override
- public V transform(final VirSchema input) {
- return getVirAttr(input.getKey());
- }
- });
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDerAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDerAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDerAttr.java
index c43e786..ae2ec1b 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDerAttr.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDerAttr.java
@@ -25,7 +25,7 @@ import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-import org.apache.syncope.core.misc.jexl.JexlUtil;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
@MappedSuperclass
public abstract class AbstractDerAttr extends AbstractEntity<Long> implements DerAttr {
@@ -47,6 +47,6 @@ public abstract class AbstractDerAttr extends AbstractEntity<Long> implements De
*/
@Override
public String getValue(final Collection<? extends PlainAttr> attributes) {
- return JexlUtil.evaluate(getSchema().getExpression(), getOwner(), attributes);
+ return JexlUtils.evaluate(getSchema().getExpression(), getOwner(), attributes);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
index aa7af95..56a37cc 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
@@ -26,7 +26,7 @@ import javax.persistence.MappedSuperclass;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
-import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtils;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
@@ -41,7 +41,7 @@ public abstract class AbstractPlainAttr extends AbstractEntity<Long> implements
protected abstract boolean addValue(PlainAttrValue attrValue);
@Override
- public void addValue(final String value, final AttributableUtil attributableUtil)
+ public void addValue(final String value, final AttributableUtils attributableUtil)
throws InvalidPlainAttrValueException {
PlainAttrValue attrValue;
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
index 14a33aa..b0a7ab4 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
@@ -20,19 +20,38 @@ package org.apache.syncope.core.persistence.jpa.entity;
import java.util.HashSet;
import java.util.Set;
+import javax.persistence.FetchType;
+import javax.persistence.ManyToOne;
+import javax.persistence.MappedSuperclass;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
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.Realm;
import org.apache.syncope.core.persistence.api.entity.Subject;
import org.apache.syncope.core.persistence.api.entity.VirAttr;
+@MappedSuperclass
public abstract class AbstractSubject<P extends PlainAttr, D extends DerAttr, V extends VirAttr>
extends AbstractAttributable<P, D, V> implements Subject<P, D, V> {
private static final long serialVersionUID = -6876467491398928855L;
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ protected JPARealm realm;
+
+ @Override
+ public Realm getRealm() {
+ return realm;
+ }
+
+ @Override
+ public void setRealm(final Realm realm) {
+ checkType(realm, JPARealm.class);
+ this.realm = (JPARealm) realm;
+ }
+
protected abstract Set<? extends ExternalResource> internalGetResources();
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AnnotatedEntityListener.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AnnotatedEntityListener.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AnnotatedEntityListener.java
index a86cbf4..f814033 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AnnotatedEntityListener.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AnnotatedEntityListener.java
@@ -22,7 +22,7 @@ import java.util.Date;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import org.apache.syncope.core.persistence.api.entity.AnnotatedEntity;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
+import org.apache.syncope.core.misc.security.AuthContextUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,7 +36,7 @@ public class AnnotatedEntityListener {
@PrePersist
@PreUpdate
public void setSysInfo(final AnnotatedEntity<?> entity) {
- final String username = AuthContextUtil.getAuthenticatedUsername();
+ final String username = AuthContextUtils.getAuthenticatedUsername();
LOG.debug("Set system properties for '{}'", entity);
final Date now = new Date();
http://git-wip-us.apache.org/repos/asf/syncope/blob/65d652af/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
index 068dd29..9509e38 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
@@ -48,19 +48,11 @@ public class JPAAccountPolicy extends JPAPolicy implements AccountPolicy {
inverseJoinColumns =
@JoinColumn(name = "resource_name"))
@Valid
- private Set<JPAExternalResource> resources;
+ private Set<JPAExternalResource> resources = new HashSet<>();
public JPAAccountPolicy() {
- this(false);
- this.resources = new HashSet<>();
- }
-
- public JPAAccountPolicy(final boolean global) {
super();
-
- this.type = global
- ? PolicyType.GLOBAL_ACCOUNT
- : PolicyType.ACCOUNT;
+ this.type = PolicyType.ACCOUNT;
}
@Override
[04/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
new file mode 100644
index 0000000..7953703
--- /dev/null
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.provisioning.camel.processor;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class GroupDeprovisionProcessor implements Processor {
+
+ private static final Logger LOG = LoggerFactory.getLogger(UserDeprovisionProcessor.class);
+
+ @Autowired
+ protected PropagationManager propagationManager;
+
+ @Autowired
+ protected PropagationTaskExecutor taskExecutor;
+
+ @Autowired
+ protected GroupDAO groupDAO;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void process(final Exchange exchange) {
+ Long groupKey = exchange.getIn().getBody(Long.class);
+ List<String> resources = exchange.getProperty("resources", List.class);
+
+ Group group = groupDAO.authFetch(groupKey);
+
+ Set<String> noPropResourceName = group.getResourceNames();
+ noPropResourceName.removeAll(resources);
+
+ List<PropagationTask> tasks =
+ propagationManager.getGroupDeleteTaskIds(groupKey, new HashSet<>(resources), noPropResourceName);
+ PropagationReporter propagationReporter =
+ ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+ try {
+ taskExecutor.execute(tasks, propagationReporter);
+ } catch (PropagationException e) {
+ LOG.error("Error propagation primary resource", e);
+ propagationReporter.onPrimaryResourceFailure(tasks);
+ }
+
+ exchange.getOut().setBody(propagationReporter.getStatuses());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
new file mode 100644
index 0000000..a4c073a
--- /dev/null
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.provisioning.camel.processor;
+
+import java.util.AbstractMap;
+import java.util.List;
+import java.util.Set;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.provisioning.api.WorkflowResult;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class GroupUpdateProcessor implements Processor {
+
+ private static final Logger LOG = LoggerFactory.getLogger(UserUpdateProcessor.class);
+
+ @Autowired
+ protected PropagationManager propagationManager;
+
+ @Autowired
+ protected PropagationTaskExecutor taskExecutor;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void process(final Exchange exchange) {
+ WorkflowResult<Long> updated = (WorkflowResult) exchange.getIn().getBody();
+ GroupMod subjectMod = exchange.getProperty("subjectMod", GroupMod.class);
+ Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
+
+ List<PropagationTask> tasks = propagationManager.getGroupUpdateTaskIds(updated,
+ subjectMod.getVirAttrsToRemove(), subjectMod.getVirAttrsToUpdate(), excludedResource);
+ PropagationReporter propagationReporter =
+ ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+ try {
+ taskExecutor.execute(tasks, propagationReporter);
+ } catch (PropagationException e) {
+ LOG.error("Error propagation primary resource", e);
+ propagationReporter.onPrimaryResourceFailure(tasks);
+ }
+
+ exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(updated.getResult(), propagationReporter.getStatuses()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleCreateInSyncProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleCreateInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleCreateInSyncProcessor.java
deleted file mode 100644
index 0e52082..0000000
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleCreateInSyncProcessor.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.apache.syncope.core.provisioning.camel.processor;
-
-/*
- * 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.
- */
-import java.util.AbstractMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.springframework.stereotype.Component;
-
-@Component
-public class RoleCreateInSyncProcessor implements Processor {
-
- @Autowired
- protected PropagationManager propagationManager;
-
- @Autowired
- protected PropagationTaskExecutor taskExecutor;
-
- @Override
- @SuppressWarnings("unchecked")
- public void process(final Exchange exchange) {
- WorkflowResult<Long> created = (WorkflowResult) exchange.getIn().getBody();
-
- RoleTO actual = exchange.getProperty("subject", RoleTO.class);
- Map<Long, String> roleOwnerMap = exchange.getProperty("roleOwnerMap", Map.class);
- Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
-
- AttrTO roleOwner = actual.getPlainAttrMap().get(StringUtils.EMPTY);
- if (roleOwner != null) {
- roleOwnerMap.put(created.getResult(), roleOwner.getValues().iterator().next());
- }
-
- AuthContextUtil.extendAuthContext(
- created.getResult(), RoleEntitlementUtil.getEntitlementNameFromRoleKey(created.getResult()));
-
- List<PropagationTask> tasks = propagationManager.getRoleCreateTaskIds(
- created, actual.getVirAttrs(), excludedResource);
-
- taskExecutor.execute(tasks);
-
- exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(created.getResult(), null));
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleCreateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleCreateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleCreateProcessor.java
deleted file mode 100644
index 76df9f6..0000000
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleCreateProcessor.java
+++ /dev/null
@@ -1,77 +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.provisioning.camel.processor;
-
-import java.util.AbstractMap;
-import java.util.List;
-import java.util.Set;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class RoleCreateProcessor implements Processor {
-
- private static final Logger LOG = LoggerFactory.getLogger(RoleCreateProcessor.class);
-
- @Autowired
- protected PropagationManager propagationManager;
-
- @Autowired
- protected PropagationTaskExecutor taskExecutor;
-
- @SuppressWarnings("unchecked")
- @Override
- public void process(final Exchange exchange) {
- WorkflowResult<Long> created = (WorkflowResult) exchange.getIn().getBody();
- RoleTO subject = exchange.getProperty("subject", RoleTO.class);
- Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
-
- AuthContextUtil.extendAuthContext(
- created.getResult(), RoleEntitlementUtil.getEntitlementNameFromRoleKey(created.getResult()));
-
- List<PropagationTask> tasks =
- propagationManager.getRoleCreateTaskIds(created, subject.getVirAttrs(), excludedResource);
- PropagationReporter propagationReporter =
- ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
-
- exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(
- created.getResult(), propagationReporter.getStatuses()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleDeleteProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleDeleteProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleDeleteProcessor.java
deleted file mode 100644
index 90a89d7..0000000
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleDeleteProcessor.java
+++ /dev/null
@@ -1,105 +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.provisioning.camel.processor;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.core.workflow.api.RoleWorkflowAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class RoleDeleteProcessor implements Processor {
-
- private static final Logger LOG = LoggerFactory.getLogger(RoleDeleteProcessor.class);
-
- @Autowired
- protected RoleWorkflowAdapter rwfAdapter;
-
- @Autowired
- protected PropagationManager propagationManager;
-
- @Autowired
- protected PropagationTaskExecutor taskExecutor;
-
- @Autowired
- protected RoleDAO roleDAO;
-
- @Override
- public void process(final Exchange exchange) throws Exception {
- final List<Role> toBeDeprovisioned = new ArrayList<>();
-
- Long subjectKey = exchange.getIn().getBody(Long.class);
- final Role syncopeRole = roleDAO.find(subjectKey);
-
- if (syncopeRole != null) {
- toBeDeprovisioned.add(syncopeRole);
-
- final List<Role> descendants = roleDAO.findDescendants(toBeDeprovisioned.get(0));
- if (descendants != null) {
- toBeDeprovisioned.addAll(descendants);
- }
- }
-
- final List<PropagationTask> tasks = new ArrayList<>();
-
- for (Role role : toBeDeprovisioned) {
- // Generate propagation tasks for deleting users from role resources, if they are on those resources only
- // because of the reason being deleted (see SYNCOPE-357)
- for (Map.Entry<Long, PropagationByResource> entry : roleDAO.findUsersWithIndirectResources(role.
- getKey()).entrySet()) {
-
- WorkflowResult<Long> wfResult =
- new WorkflowResult<>(entry.getKey(), entry.getValue(), Collections.<String>emptySet());
- tasks.addAll(propagationManager.getUserDeleteTaskIds(wfResult));
- }
-
- // Generate propagation tasks for deleting this role from resources
- tasks.addAll(propagationManager.getRoleDeleteTaskIds(role.getKey()));
- }
-
- PropagationReporter propagationReporter =
- ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
-
- exchange.setProperty("statuses", propagationReporter.getStatuses());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleDeprovisionProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleDeprovisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleDeprovisionProcessor.java
deleted file mode 100644
index c0aa4fd..0000000
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleDeprovisionProcessor.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.provisioning.camel.processor;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class RoleDeprovisionProcessor implements Processor {
-
- private static final Logger LOG = LoggerFactory.getLogger(UserDeprovisionProcessor.class);
-
- @Autowired
- protected PropagationManager propagationManager;
-
- @Autowired
- protected PropagationTaskExecutor taskExecutor;
-
- @Autowired
- protected RoleDAO roleDAO;
-
- @SuppressWarnings("unchecked")
- @Override
- public void process(final Exchange exchange) {
- Long roleKey = exchange.getIn().getBody(Long.class);
- List<String> resources = exchange.getProperty("resources", List.class);
-
- Role role = roleDAO.authFetch(roleKey);
-
- Set<String> noPropResourceName = role.getResourceNames();
- noPropResourceName.removeAll(resources);
-
- List<PropagationTask> tasks =
- propagationManager.getRoleDeleteTaskIds(roleKey, new HashSet<>(resources), noPropResourceName);
- PropagationReporter propagationReporter =
- ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
-
- exchange.getOut().setBody(propagationReporter.getStatuses());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleUpdateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleUpdateProcessor.java
deleted file mode 100644
index 74e377a..0000000
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/RoleUpdateProcessor.java
+++ /dev/null
@@ -1,71 +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.provisioning.camel.processor;
-
-import java.util.AbstractMap;
-import java.util.List;
-import java.util.Set;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class RoleUpdateProcessor implements Processor {
-
- private static final Logger LOG = LoggerFactory.getLogger(UserUpdateProcessor.class);
-
- @Autowired
- protected PropagationManager propagationManager;
-
- @Autowired
- protected PropagationTaskExecutor taskExecutor;
-
- @SuppressWarnings("unchecked")
- @Override
- public void process(final Exchange exchange) {
- WorkflowResult<Long> updated = (WorkflowResult) exchange.getIn().getBody();
- RoleMod subjectMod = exchange.getProperty("subjectMod", RoleMod.class);
- Set<String> excludedResource = exchange.getProperty("excludedResources", Set.class);
-
- List<PropagationTask> tasks = propagationManager.getRoleUpdateTaskIds(updated,
- subjectMod.getVirAttrsToRemove(), subjectMod.getVirAttrsToUpdate(), excludedResource);
- PropagationReporter propagationReporter =
- ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
-
- exchange.getOut().setBody(new AbstractMap.SimpleEntry<>(updated.getResult(), propagationReporter.getStatuses()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
index 600cdf8..1ff28c8 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
@@ -74,7 +74,7 @@ public class UserUpdateProcessor implements Processor {
for (MembershipMod membershipMod : actual.getMembershipsToAdd()) {
if (!virtAttrHandler.fillMembershipVirtual(
updated.getResult().getKey().getKey(),
- membershipMod.getRole(),
+ membershipMod.getGroup(),
null,
membershipMod.getVirAttrsToRemove(),
membershipMod.getVirAttrsToUpdate(),
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/resources/groupRoutes.xml
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/resources/groupRoutes.xml b/ext/camel/provisioning-camel/src/main/resources/groupRoutes.xml
new file mode 100644
index 0000000..63aa0d3
--- /dev/null
+++ b/ext/camel/provisioning-camel/src/main/resources/groupRoutes.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<routes>
+
+ <route id="createGroup">
+ <from uri="direct:createGroup"/>
+ <setProperty propertyName="subject">
+ <simple>${body}</simple>
+ </setProperty>
+ <doTry>
+ <bean ref="gwfAdapter" method="create(${body})"/>
+ <process ref="groupCreateProcessor"/>
+ <to uri="direct:createGroupPort"/>
+ <doCatch>
+ <exception>java.lang.RuntimeException</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="direct:createGroupPort"/>
+ </doCatch>
+ </doTry>
+ </route>
+
+ <route id="createGroupSync">
+ <from uri="direct:createGroupInSync"/>
+ <setProperty propertyName="subject">
+ <simple>${body}</simple>
+ </setProperty>
+ <doTry>
+ <bean ref="gwfAdapter" method="create(${body})"/>
+ <process ref="groupCreateInSyncProcessor"/>
+ <to uri="direct:createGroupInSyncPort"/>
+ <doCatch>
+ <exception>java.lang.RuntimeException</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="direct:createGroupInSyncPort"/>
+ </doCatch>
+ </doTry>
+ </route>
+
+ <route id="updateGroup">
+ <from uri="direct:updateGroup"/>
+ <setProperty propertyName="subjectMod">
+ <simple>${body}</simple>
+ </setProperty>
+ <doTry>
+ <bean ref="gwfAdapter" method="update(${body})"/>
+ <process ref="groupUpdateProcessor"/>
+ <to uri="direct:updateGroupPort"/>
+ <doCatch>
+ <exception>java.lang.RuntimeException</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="direct:updateGroupPort"/>
+ </doCatch>
+ </doTry>
+ </route>
+
+ <route id="deleteGroup">
+ <from uri="direct:deleteGroup"/>
+ <doTry>
+ <process ref="groupDeleteProcessor"/>
+ <bean ref="gwfAdapter" method="delete(${body})"/>
+ <setBody>
+ <simple>${property.statuses}</simple>
+ </setBody>
+ <to uri="direct:deleteGroupPort"/>
+ <doCatch>
+ <exception>java.lang.RuntimeException</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="direct:deleteGroupPort"/>
+ </doCatch>
+ </doTry>
+ </route>
+
+ <route id="unlinkGroup">
+ <from uri="direct:unlinkGroup"/>
+ <doTry>
+ <bean ref="gwfAdapter" method="update(${body})"/>
+ <setBody>
+ <simple>${body.getResult}</simple>
+ </setBody>
+ <to uri="direct:unlinkGroupPort"/>
+ <doCatch>
+ <exception>java.lang.RuntimeException</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="direct:unlinkGroupPort"/>
+ </doCatch>
+ </doTry>
+ </route>
+
+ <route id="linkGroup">
+ <from uri="direct:linkGroup"/>
+ <doTry>
+ <bean ref="gwfAdapter" method="update(${body})"/>
+ <setBody>
+ <simple>${body.getResult}</simple>
+ </setBody>
+ <to uri="direct:linkGroupPort"/>
+ <doCatch>
+ <exception>java.lang.RuntimeException</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="direct:linkGroupPort"/>
+ </doCatch>
+ </doTry>
+ </route>
+
+ <route id="deprovisionGroup">
+ <from uri="direct:deprovisionGroup"/>
+ <process ref="groupDeprovisionProcessor"/>
+ <to uri="direct:deprovisionGroupPort"/>
+ </route>
+
+</routes>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/resources/provisioning.properties b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
index 16a895b..40dd3ea 100644
--- a/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
+++ b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
@@ -16,4 +16,4 @@
# under the License.
camel.directory=${conf.directory}
userProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelUserProvisioningManager
-roleProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelRoleProvisioningManager
+groupProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelGroupProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/resources/provisioningCamelContext.xml
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/resources/provisioningCamelContext.xml b/ext/camel/provisioning-camel/src/main/resources/provisioningCamelContext.xml
index cb37941..8eec14d 100644
--- a/ext/camel/provisioning-camel/src/main/resources/provisioningCamelContext.xml
+++ b/ext/camel/provisioning-camel/src/main/resources/provisioningCamelContext.xml
@@ -29,9 +29,9 @@ under the License.
<property name="primary" value="file:${camel.directory}/userRoutes.xml"/>
<property name="fallback" value="classpath:userRoutes.xml"/>
</bean>
- <bean id="roleRoutes" class="org.apache.syncope.core.misc.spring.ResourceWithFallbackLoader">
- <property name="primary" value="file:${camel.directory}/roleRoutes.xml"/>
- <property name="fallback" value="classpath:roleRoutes.xml"/>
+ <bean id="groupRoutes" class="org.apache.syncope.core.misc.spring.ResourceWithFallbackLoader">
+ <property name="primary" value="file:${camel.directory}/groupRoutes.xml"/>
+ <property name="fallback" value="classpath:groupRoutes.xml"/>
</bean>
<context:component-scan base-package="org.apache.syncope.core.provisioning.camel"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/ext/camel/provisioning-camel/src/main/resources/roleRoutes.xml
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/resources/roleRoutes.xml b/ext/camel/provisioning-camel/src/main/resources/roleRoutes.xml
deleted file mode 100644
index 04c2dc4..0000000
--- a/ext/camel/provisioning-camel/src/main/resources/roleRoutes.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<routes>
-
- <route id="createRole">
- <from uri="direct:createRole"/>
- <setProperty propertyName="subject">
- <simple>${body}</simple>
- </setProperty>
- <doTry>
- <bean ref="rwfAdapter" method="create(${body})"/>
- <process ref="roleCreateProcessor"/>
- <to uri="direct:createRolePort"/>
- <doCatch>
- <exception>java.lang.RuntimeException</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to uri="direct:createRolePort"/>
- </doCatch>
- </doTry>
- </route>
-
- <route id="createRoleSync">
- <from uri="direct:createRoleInSync"/>
- <setProperty propertyName="subject">
- <simple>${body}</simple>
- </setProperty>
- <doTry>
- <bean ref="rwfAdapter" method="create(${body})"/>
- <process ref="roleCreateInSyncProcessor"/>
- <to uri="direct:createRoleInSyncPort"/>
- <doCatch>
- <exception>java.lang.RuntimeException</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to uri="direct:createRoleInSyncPort"/>
- </doCatch>
- </doTry>
- </route>
-
- <route id="updateRole">
- <from uri="direct:updateRole"/>
- <setProperty propertyName="subjectMod">
- <simple>${body}</simple>
- </setProperty>
- <doTry>
- <bean ref="rwfAdapter" method="update(${body})"/>
- <process ref="roleUpdateProcessor"/>
- <to uri="direct:updateRolePort"/>
- <doCatch>
- <exception>java.lang.RuntimeException</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to uri="direct:updateRolePort"/>
- </doCatch>
- </doTry>
- </route>
-
- <route id="deleteRole">
- <from uri="direct:deleteRole"/>
- <doTry>
- <process ref="roleDeleteProcessor"/>
- <bean ref="rwfAdapter" method="delete(${body})"/>
- <setBody>
- <simple>${property.statuses}</simple>
- </setBody>
- <to uri="direct:deleteRolePort"/>
- <doCatch>
- <exception>java.lang.RuntimeException</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to uri="direct:deleteRolePort"/>
- </doCatch>
- </doTry>
- </route>
-
- <route id="unlinkRole">
- <from uri="direct:unlinkRole"/>
- <doTry>
- <bean ref="rwfAdapter" method="update(${body})"/>
- <setBody>
- <simple>${body.getResult}</simple>
- </setBody>
- <to uri="direct:unlinkRolePort"/>
- <doCatch>
- <exception>java.lang.RuntimeException</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to uri="direct:unlinkRolePort"/>
- </doCatch>
- </doTry>
- </route>
-
- <route id="linkRole">
- <from uri="direct:linkRole"/>
- <doTry>
- <bean ref="rwfAdapter" method="update(${body})"/>
- <setBody>
- <simple>${body.getResult}</simple>
- </setBody>
- <to uri="direct:linkRolePort"/>
- <doCatch>
- <exception>java.lang.RuntimeException</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to uri="direct:linkRolePort"/>
- </doCatch>
- </doTry>
- </route>
-
- <route id="deprovisionRole">
- <from uri="direct:deprovisionRole"/>
- <process ref="roleDeprovisionProcessor"/>
- <to uri="direct:deprovisionRolePort"/>
- </route>
-
-</routes>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ApacheDSRootDseServlet.java
----------------------------------------------------------------------
diff --git a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ApacheDSRootDseServlet.java b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ApacheDSRootDseServlet.java
index bfdbdde..ab02040 100644
--- a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ApacheDSRootDseServlet.java
+++ b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ApacheDSRootDseServlet.java
@@ -19,7 +19,7 @@
package org.apache.syncope.fit.buildtools;
import java.io.PrintWriter;
-import java.util.Hashtable;
+import java.util.Properties;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.directory.Attribute;
@@ -80,12 +80,12 @@ public class ApacheDSRootDseServlet extends HttpServlet {
/**
* Creates an environment configuration for JNDI access.
*/
- private Hashtable<Object, Object> createEnv() {
+ private Properties createEnv() {
// Fetch directory service from servlet context
ServletContext servletContext = this.getServletContext();
DirectoryService directoryService = (DirectoryService) servletContext.getAttribute(DirectoryService.JNDI_KEY);
- Hashtable<Object, Object> env = new Hashtable<>();
+ Properties env = new Properties();
env.put(DirectoryService.JNDI_KEY, directoryService);
env.put(Context.PROVIDER_URL, "");
env.put(Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/AccessITCase.java
----------------------------------------------------------------------
diff --git a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/AccessITCase.java b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/AccessITCase.java
index 557e9af..3eb3aa7 100644
--- a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/AccessITCase.java
+++ b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/AccessITCase.java
@@ -35,21 +35,18 @@ public class AccessITCase extends AbstractITCase {
By.xpath("//div[@id='uschema']/div/div/span/ul/li[2]/a")));
seleniumDriver.findElement(By.xpath("//div[@id='uschema']/div/div/span/ul/li[2]/a")).click();
- seleniumDriver.findElement(By.xpath("//div[@id='uschema']/div/div/span/ul/li[3]/a")).click();
seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[3]/a")).click();
seleniumDriver.findElement(By.xpath("//div[@id='mschema']/div/div/span/ul/li[2]/a")).click();
- seleniumDriver.findElement(By.xpath("//div[@id='mschema']/div/div/span/ul/li[3]/a")).click();
seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[4]/a")).click();
- seleniumDriver.findElement(By.xpath("//div[@id='rschema']/div/div/span/ul/li[2]/a")).click();
- seleniumDriver.findElement(By.xpath("//div[@id='rschema']/div/div/span/ul/li[3]/a")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='gschema']/div/div/span/ul/li[2]/a")).click();
seleniumDriver.findElement(By.xpath("//img[@alt=\"Users\"]")).click();
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[3]/ul/li[2]/a/span")));
seleniumDriver.findElement(By.xpath("//div[3]/ul/li[2]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//img[@alt=\"Roles\"]")).click();
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Groups\"]")).click();
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt=\"Resources\"]")));
seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/ConfigurationITCase.java
----------------------------------------------------------------------
diff --git a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/ConfigurationITCase.java b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/ConfigurationITCase.java
index b4a06f5..c634d1d 100644
--- a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/ConfigurationITCase.java
+++ b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/ConfigurationITCase.java
@@ -161,11 +161,11 @@ public class ConfigurationITCase extends AbstractITCase {
wait.until(ExpectedConditions.presenceOfElementLocated(
By.xpath("//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
- + "/option[text()='role']")));
+ + "/option[text()='group']")));
select = new Select(seleniumDriver.findElement(By.xpath(
"//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']")));
- select.selectByVisibleText("role");
+ select.selectByVisibleText("group");
wait.until(ExpectedConditions.presenceOfElementLocated(
By.xpath("//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']"
@@ -256,12 +256,12 @@ public class ConfigurationITCase extends AbstractITCase {
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
"//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
- + "/option[text()='role']")));
+ + "/option[text()='group']")));
select = new Select(
seleniumDriver.findElement(By.xpath(
"//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']")));
- select.selectByVisibleText("role");
+ select.selectByVisibleText("group");
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
"//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']"
@@ -350,12 +350,12 @@ public class ConfigurationITCase extends AbstractITCase {
wait.until(ExpectedConditions.presenceOfElementLocated(
By.xpath("//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
- + "/option[text()='RoleLogic']")));
+ + "/option[text()='GroupLogic']")));
select = new Select(
seleniumDriver.findElement(By.xpath(
"//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']")));
- select.selectByVisibleText("RoleLogic");
+ select.selectByVisibleText("GroupLogic");
wait.until(ExpectedConditions.presenceOfElementLocated(
By.xpath("//input[@name='eventSelection:eventsContainer:eventsPanel:successGroup']")));
@@ -366,24 +366,24 @@ public class ConfigurationITCase extends AbstractITCase {
seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div[3]/span/div[4]/div/span/input")).click();
wait.until(ExpectedConditions.presenceOfElementLocated(
- By.xpath("//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:type']"
+ By.xpath("//select[@name='aboutContainer:groupAbout:searchFormContainer:searchView:0:type']"
+ "/option[text()='ENTITLEMENT']")));
wait.until(ExpectedConditions.elementToBeClickable(
- By.xpath("//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:type']")));
+ By.xpath("//select[@name='aboutContainer:groupAbout:searchFormContainer:searchView:0:type']")));
select = new Select(
seleniumDriver.findElement(By.xpath(
- "//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:type']")));
+ "//select[@name='aboutContainer:groupAbout:searchFormContainer:searchView:0:type']")));
select.selectByVisibleText("ENTITLEMENT");
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
- "//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:property']"
- + "/option[text()='ROLE_CREATE']")));
+ "//select[@name='aboutContainer:groupAbout:searchFormContainer:searchView:0:property']"
+ + "/option[text()='GROUP_CREATE']")));
select = new Select(seleniumDriver.findElement(By.xpath(
- "//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:property']")));
- select.selectByVisibleText("ROLE_CREATE");
+ "//select[@name='aboutContainer:groupAbout:searchFormContainer:searchView:0:property']")));
+ select.selectByVisibleText("GROUP_CREATE");
seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[4]/a/span")).click();
seleniumDriver.findElement(By.xpath("//input[@name='recipientsContainer:checkRecipients:checkboxField']")).
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/ConnectorITCase.java
----------------------------------------------------------------------
diff --git a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/ConnectorITCase.java b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/ConnectorITCase.java
index 17713fa..fc21e4b 100644
--- a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/ConnectorITCase.java
+++ b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/ConnectorITCase.java
@@ -49,7 +49,7 @@ public class ConnectorITCase extends AbstractITCase {
Select select = new Select(
seleniumDriver.findElement(By.xpath("//form/div[2]/div[1]/div[1]/div[2]/div[2]/span/select")));
- select.selectByValue("1");
+ select.selectByValue("0");
wait.until(ExpectedConditions.presenceOfElementLocated(
By.xpath("//select[@name='connectorName:dropDownChoiceField']/option[3]")));
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/GroupITCase.java b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/GroupITCase.java
new file mode 100644
index 0000000..a4f6ef2
--- /dev/null
+++ b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/GroupITCase.java
@@ -0,0 +1,211 @@
+/*
+ * 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.fit.console.reference;
+
+import static junit.framework.TestCase.assertTrue;
+import org.junit.Test;
+import org.openqa.selenium.Alert;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
+
+public class GroupITCase extends AbstractITCase {
+
+ @Test
+ public void createRootNodeModal() {
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Groups\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
+
+ seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div/span/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div/div/span[2]/span/div/p/span/span/a")));
+
+ seleniumDriver.findElement(By.xpath("//div/div/span[2]/span/div/p/span/span/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//span[contains(text(),'Plain attributes')]")));
+
+ seleniumDriver.switchTo().defaultContent();
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
+ }
+
+ @Test
+ public void browseCreateModal() {
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Groups\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
+
+ seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div[2]/div/div/span/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt='create icon']")));
+
+ seleniumDriver.findElement(By.xpath("//img[@alt='create icon']")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div/ul/li[1]/a/span")));
+
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[1]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[2]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[3]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[4]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[5]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[6]/a/span")).click();
+
+ seleniumDriver.switchTo().defaultContent();
+
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
+ }
+
+ @Test
+ public void browseEditModal() {
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Groups\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
+
+ seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div[2]/div/div/span/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt='edit icon']")));
+
+ seleniumDriver.findElement(By.xpath("//img[@alt='edit icon']")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div/ul/li[1]/a/span")));
+
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[2]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[3]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[4]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[5]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[6]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[7]/a/span")).click();
+
+ seleniumDriver.switchTo().defaultContent();
+
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
+ }
+
+ @Test
+ public void checkSecurityTab() {
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Groups\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
+
+ seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div[2]/div/div/span/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div/form/div[2]/ul/li[7]/a")));
+
+ seleniumDriver.findElement(By.xpath("//div/form/div[2]/ul/li[7]/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//form/div[2]/div/div[8]/span/div/div/div/label")));
+ }
+
+ @Test
+ public void browseUserEditModal() {
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Groups\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
+
+ seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div[2]/div/div/span/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div/div/span[2]/span/span/div/form/div[2]/ul/li[9]/a")));
+
+ seleniumDriver.findElement(By.xpath("//div/div/span[2]/span/span/div/form/div[2]/ul/li[9]/a")).click();
+
+ seleniumDriver.findElement(By.xpath("//input[@name=\"userListContainer:search\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//table/tbody/tr/td[5]/div/span[13]/a")));
+
+ seleniumDriver.findElement(By.xpath("//table/tbody/tr/td[5]/div/span[13]/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//form/div[3]/div/span/div/div/div[contains(text(),'Username')]")));
+
+ seleniumDriver.switchTo().defaultContent();
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
+ }
+
+ @Test
+ public void searchUsers() {
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Groups\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
+
+ seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div[2]/div/div/span/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div/div/span[2]/span/span/div/form/div[2]/ul/li[9]/a")));
+
+ seleniumDriver.findElement(By.xpath("//div/div/span[2]/span/span/div/form/div[2]/ul/li[9]/a")).click();
+
+ seleniumDriver.findElement(By.xpath("//input[@name=\"userListContainer:search\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[15]/a")));
+ }
+
+ @Test
+ public void deleteGroup() {
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Groups\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
+
+ seleniumDriver.findElement(By.xpath(
+ "//div/div/span/div/div/div/div/div[2]/div[2]/div[2]/div/div[2]/div[3]/div/span[2]/a/span")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt='delete icon']")));
+
+ seleniumDriver.findElement(By.xpath("//img[@alt='delete icon']")).click();
+
+ Alert alert = seleniumDriver.switchTo().alert();
+ assertTrue(alert.getText().equals("Do you really want to delete the selected item(s)?"));
+ alert.accept();
+ }
+
+ @Test
+ public void issueSYNCOPE510() {
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Groups\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[contains(text(),'Search')]")));
+
+ seleniumDriver.findElement(By.xpath("//span[contains(text(),'Search')]")).click() ;
+ Select select = new Select(seleniumDriver.findElement(By.xpath("//td[2]/select")));
+ select.selectByVisibleText("RESOURCE");
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//td[3]/select[option='ws-target-resource-2']")));
+
+ select = new Select(seleniumDriver.findElement(By.xpath("//td[3]/select")));
+ select.selectByVisibleText("ws-target-resource-2");
+ seleniumDriver.findElement(By.xpath("//form/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div[3]/div[2]/div[2]/span/div[1]/span[1]/span/form/span/table/tbody/tr/td[3]/div")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/RoleITCase.java
----------------------------------------------------------------------
diff --git a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/RoleITCase.java b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/RoleITCase.java
deleted file mode 100644
index 111ba5e..0000000
--- a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/RoleITCase.java
+++ /dev/null
@@ -1,211 +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.fit.console.reference;
-
-import static junit.framework.TestCase.assertTrue;
-import org.junit.Test;
-import org.openqa.selenium.Alert;
-import org.openqa.selenium.By;
-import org.openqa.selenium.support.ui.ExpectedConditions;
-import org.openqa.selenium.support.ui.Select;
-
-public class RoleITCase extends AbstractITCase {
-
- @Test
- public void createRootNodeModal() {
- seleniumDriver.findElement(By.xpath("//img[@alt=\"Roles\"]")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
-
- seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div/span/a")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div/div/span[2]/span/div/p/span/span/a")));
-
- seleniumDriver.findElement(By.xpath("//div/div/span[2]/span/div/p/span/span/a")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
- seleniumDriver.switchTo().frame(0);
-
- wait.until(ExpectedConditions.presenceOfElementLocated(
- By.xpath("//span[contains(text(),'Plain attributes')]")));
-
- seleniumDriver.switchTo().defaultContent();
- seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
- }
-
- @Test
- public void browseCreateModal() {
- seleniumDriver.findElement(By.xpath("//img[@alt=\"Roles\"]")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
-
- seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div[2]/div/div/span/a")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt='create icon']")));
-
- seleniumDriver.findElement(By.xpath("//img[@alt='create icon']")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
- seleniumDriver.switchTo().frame(0);
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div/ul/li[1]/a/span")));
-
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[1]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[2]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[3]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[4]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[5]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[6]/a/span")).click();
-
- seleniumDriver.switchTo().defaultContent();
-
- seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
- }
-
- @Test
- public void browseEditModal() {
- seleniumDriver.findElement(By.xpath("//img[@alt=\"Roles\"]")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
-
- seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div[2]/div/div/span/a")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt='edit icon']")));
-
- seleniumDriver.findElement(By.xpath("//img[@alt='edit icon']")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
- seleniumDriver.switchTo().frame(0);
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div/ul/li[1]/a/span")));
-
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[2]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[3]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[4]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[5]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[6]/a/span")).click();
- seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/ul/li[7]/a/span")).click();
-
- seleniumDriver.switchTo().defaultContent();
-
- seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
- }
-
- @Test
- public void checkSecurityTab() {
- seleniumDriver.findElement(By.xpath("//img[@alt=\"Roles\"]")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
-
- seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div[2]/div/div/span/a")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div/form/div[2]/ul/li[7]/a")));
-
- seleniumDriver.findElement(By.xpath("//div/form/div[2]/ul/li[7]/a")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(
- By.xpath("//form/div[2]/div/div[8]/span/div/div/div/label")));
- }
-
- @Test
- public void browseUserEditModal() {
- seleniumDriver.findElement(By.xpath("//img[@alt=\"Roles\"]")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
-
- seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div[2]/div/div/span/a")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(
- By.xpath("//div/div/span[2]/span/span/div/form/div[2]/ul/li[9]/a")));
-
- seleniumDriver.findElement(By.xpath("//div/div/span[2]/span/span/div/form/div[2]/ul/li[9]/a")).click();
-
- seleniumDriver.findElement(By.xpath("//input[@name=\"userListContainer:search\"]")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//table/tbody/tr/td[5]/div/span[13]/a")));
-
- seleniumDriver.findElement(By.xpath("//table/tbody/tr/td[5]/div/span[13]/a")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
- seleniumDriver.switchTo().frame(0);
-
- wait.until(ExpectedConditions.presenceOfElementLocated(
- By.xpath("//form/div[3]/div/span/div/div/div[contains(text(),'Username')]")));
-
- seleniumDriver.switchTo().defaultContent();
- seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
- }
-
- @Test
- public void searchUsers() {
- seleniumDriver.findElement(By.xpath("//img[@alt=\"Roles\"]")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
-
- seleniumDriver.findElement(By.xpath("//div/div/span/div/div/div/div/div[2]/div/div/span/a")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(
- By.xpath("//div/div/span[2]/span/span/div/form/div[2]/ul/li[9]/a")));
-
- seleniumDriver.findElement(By.xpath("//div/div/span[2]/span/span/div/form/div[2]/ul/li[9]/a")).click();
-
- seleniumDriver.findElement(By.xpath("//input[@name=\"userListContainer:search\"]")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[15]/a")));
- }
-
- @Test
- public void deleteRole() {
- seleniumDriver.findElement(By.xpath("//img[@alt=\"Roles\"]")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='navigationPane']")));
-
- seleniumDriver.findElement(By.xpath(
- "//div/div/span/div/div/div/div/div[2]/div[2]/div[2]/div/div[2]/div[3]/div/span[2]/a/span")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt='delete icon']")));
-
- seleniumDriver.findElement(By.xpath("//img[@alt='delete icon']")).click();
-
- Alert alert = seleniumDriver.switchTo().alert();
- assertTrue(alert.getText().equals("Do you really want to delete the selected item(s)?"));
- alert.accept();
- }
-
- @Test
- public void issueSYNCOPE510() {
- seleniumDriver.findElement(By.xpath("//img[@alt=\"Roles\"]")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[contains(text(),'Search')]")));
-
- seleniumDriver.findElement(By.xpath("//span[contains(text(),'Search')]")).click() ;
- Select select = new Select(seleniumDriver.findElement(By.xpath("//td[2]/select")));
- select.selectByVisibleText("RESOURCE");
-
- wait.until(ExpectedConditions.presenceOfElementLocated(
- By.xpath("//td[3]/select[option='ws-target-resource-2']")));
-
- select = new Select(seleniumDriver.findElement(By.xpath("//td[3]/select")));
- select.selectByVisibleText("ws-target-resource-2");
- seleniumDriver.findElement(By.xpath("//form/a")).click();
-
- wait.until(ExpectedConditions.presenceOfElementLocated(
- By.xpath("//div[3]/div[2]/div[2]/span/div[1]/span[1]/span/form/span/table/tbody/tr/td[3]/div")));
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/SchemaITCase.java
----------------------------------------------------------------------
diff --git a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/SchemaITCase.java b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/SchemaITCase.java
index 130d414..e02ddcb 100644
--- a/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/SchemaITCase.java
+++ b/fit/console-reference/src/test/java/org/apache/syncope/fit/console/reference/SchemaITCase.java
@@ -35,7 +35,7 @@ public class SchemaITCase extends AbstractITCase {
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[4]/a")).click();
- seleniumDriver.findElement(By.xpath("//div[@id='rschema']/div/div/div/a")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='gschema']/div/div/div/a")).click();
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
seleniumDriver.switchTo().frame(0);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java
index d9ef279..2103059 100644
--- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java
+++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java
@@ -27,6 +27,9 @@ import org.apache.syncope.core.provisioning.java.sync.DefaultSyncActions;
import org.identityconnectors.framework.common.objects.SyncDelta;
import org.quartz.JobExecutionException;
+/**
+ * Test synchronization action.
+ */
public class TestSyncActions extends DefaultSyncActions {
private int counter = 0;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncRule.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncRule.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncRule.java
index 50d6790..5cb8b10 100644
--- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncRule.java
+++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncRule.java
@@ -23,10 +23,13 @@ import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.provisioning.api.sync.SyncCorrelationRule;
import org.identityconnectors.framework.common.objects.ConnectorObject;
+/**
+ * Test synchronization rule relying on <tt>email</tt> attribute value.
+ */
public class TestSyncRule implements SyncCorrelationRule {
@Override
- public SearchCond getSearchCond(ConnectorObject connObj) {
+ public SearchCond getSearchCond(final ConnectorObject connObj) {
AttributeCond cond = new AttributeCond();
cond.setSchema("email");
cond.setType(AttributeCond.Type.EQ);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/package-info.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/package-info.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/package-info.java
new file mode 100644
index 0000000..d9e45f5
--- /dev/null
+++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * 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.fit.core.reference;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/main/resources/all/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/all/provisioning.properties b/fit/core-reference/src/main/resources/all/provisioning.properties
index 16a895b..40dd3ea 100644
--- a/fit/core-reference/src/main/resources/all/provisioning.properties
+++ b/fit/core-reference/src/main/resources/all/provisioning.properties
@@ -16,4 +16,4 @@
# under the License.
camel.directory=${conf.directory}
userProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelUserProvisioningManager
-roleProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelRoleProvisioningManager
+groupProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelGroupProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/main/resources/all/workflow.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/all/workflow.properties b/fit/core-reference/src/main/resources/all/workflow.properties
index 04e7d05..5a975cf 100644
--- a/fit/core-reference/src/main/resources/all/workflow.properties
+++ b/fit/core-reference/src/main/resources/all/workflow.properties
@@ -17,4 +17,4 @@
wf.directory=${conf.directory}
jobExecutorActivate=true
uwfAdapter=org.apache.syncope.core.workflow.activiti.ActivitiUserWorkflowAdapter
-rwfAdapter=org.apache.syncope.core.workflow.java.DefaultRoleWorkflowAdapter
\ No newline at end of file
+gwfAdapter=org.apache.syncope.core.workflow.java.DefaultGroupWorkflowAdapter
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/main/resources/connid.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/connid.properties b/fit/core-reference/src/main/resources/connid.properties
index 40d649c..a18252f 100644
--- a/fit/core-reference/src/main/resources/connid.properties
+++ b/fit/core-reference/src/main/resources/connid.properties
@@ -20,4 +20,5 @@ connid://${testconnectorserver.key}@localhost:${testconnectorserver.port}
## for test only
testdb.url=${testdb.url}
connid.soap.version=${connid.soap.version}
-connid.db.table.version=${connid.db.table.version}
\ No newline at end of file
+connid.db.table.version=${connid.db.table.version}
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/provisioning.properties b/fit/core-reference/src/main/resources/provisioning.properties
index af5deee..4b87d44 100644
--- a/fit/core-reference/src/main/resources/provisioning.properties
+++ b/fit/core-reference/src/main/resources/provisioning.properties
@@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
-roleProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultRoleProvisioningManager
+groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/main/resources/userWorkflow.bpmn20.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/userWorkflow.bpmn20.xml b/fit/core-reference/src/main/resources/userWorkflow.bpmn20.xml
index d26dbe3..d0b5604 100644
--- a/fit/core-reference/src/main/resources/userWorkflow.bpmn20.xml
+++ b/fit/core-reference/src/main/resources/userWorkflow.bpmn20.xml
@@ -34,10 +34,10 @@ under the License.
<sequenceFlow id="flow2" sourceRef="create" targetRef="createGW"/>
<exclusiveGateway id="createGW"/>
<sequenceFlow id="createAsAnonymous2Approval" sourceRef="createGW" targetRef="createApproval">
- <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wfExecutor == 'anonymous' || user.getRoleKeys().contains(9)}]]></conditionExpression>
+ <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wfExecutor == 'anonymous' || user.getGroupKeys().contains(9)}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="create2Activate" sourceRef="createGW" targetRef="enableGW">
- <conditionExpression xsi:type="tFormalExpression"><![CDATA[${!user.getRoleKeys().contains(9)}]]></conditionExpression>
+ <conditionExpression xsi:type="tFormalExpression"><![CDATA[${!user.getGroupKeys().contains(9)}]]></conditionExpression>
</sequenceFlow>
<userTask id="createApproval" name="Create approval" activiti:candidateGroups="7" activiti:formKey="createApproval">
<extensionElements>
@@ -56,7 +56,7 @@ under the License.
</sequenceFlow>
<exclusiveGateway id="enableGW"/>
<sequenceFlow id="createApprovalGW2OptIn" sourceRef="enableGW" targetRef="generateToken">
- <conditionExpression xsi:type="tFormalExpression"><![CDATA[${user.getRoleKeys().contains(11)}]]></conditionExpression>
+ <conditionExpression xsi:type="tFormalExpression"><![CDATA[${user.getGroupKeys().contains(11)}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="createApprovalGW2Activate" sourceRef="enableGW" targetRef="activate">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${enabled == null}]]></conditionExpression>
@@ -574,4 +574,4 @@ under the License.
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</definitions>
\ No newline at end of file
+</definitions>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/fit/core-reference/src/main/resources/workflow.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/workflow.properties b/fit/core-reference/src/main/resources/workflow.properties
index 9f0e35e..7167164 100644
--- a/fit/core-reference/src/main/resources/workflow.properties
+++ b/fit/core-reference/src/main/resources/workflow.properties
@@ -17,4 +17,4 @@
wf.directory=${conf.directory}
jobExecutorActivate=false
uwfAdapter=org.apache.syncope.core.workflow.java.DefaultUserWorkflowAdapter
-rwfAdapter=org.apache.syncope.core.workflow.java.DefaultRoleWorkflowAdapter
\ No newline at end of file
+gwfAdapter=org.apache.syncope.core.workflow.java.DefaultGroupWorkflowAdapter
[08/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/PushActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/PushActions.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/PushActions.java
index a97d2dd..8b1f451 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/PushActions.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/PushActions.java
@@ -27,10 +27,10 @@ import org.quartz.JobExecutionException;
public interface PushActions extends ProvisioningActions {
/**
- * Action to be executed before to assign (link & provision) a synchronized user / role to the resource.
+ * Action to be executed before to assign (link & provision) a synchronized user / group to the resource.
*
* @param profile profile of the synchronization being executed.
- * @param subject user / role to be created.
+ * @param subject user / group to be created.
* @return subject.
* @throws JobExecutionException in case of generic failure
*/
@@ -39,10 +39,10 @@ public interface PushActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before to provision a synchronized user / role to the resource.
+ * Action to be executed before to provision a synchronized user / group to the resource.
*
* @param profile profile of the synchronization being executed.
- * @param subject user / role to be created.
+ * @param subject user / group to be created.
* @return subject.
* @throws JobExecutionException in case of generic failure
*/
@@ -51,10 +51,10 @@ public interface PushActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before to update a synchronized user / role on the resource.
+ * Action to be executed before to update a synchronized user / group on the resource.
*
* @param profile profile of the synchronization being executed.
- * @param subject user / role to be updated.
+ * @param subject user / group to be updated.
* @return subject.
* @throws JobExecutionException in case of generic failure
*/
@@ -63,10 +63,10 @@ public interface PushActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before to link a synchronized user / role to the resource.
+ * Action to be executed before to link a synchronized user / group to the resource.
*
* @param profile profile of the synchronization being executed.
- * @param subject user / role to be created.
+ * @param subject user / group to be created.
* @return subject.
* @throws JobExecutionException in case of generic failure
*/
@@ -75,10 +75,10 @@ public interface PushActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before to unlink a synchronized user / role from the resource.
+ * Action to be executed before to unlink a synchronized user / group from the resource.
*
* @param profile profile of the synchronization being executed.
- * @param subject user / role to be created.
+ * @param subject user / group to be created.
* @return subject.
* @throws JobExecutionException in case of generic failure
*/
@@ -87,10 +87,10 @@ public interface PushActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before to unassign a synchronized user / role from the resource.
+ * Action to be executed before to unassign a synchronized user / group from the resource.
*
* @param profile profile of the synchronization being executed.
- * @param subject user / role to be created.
+ * @param subject user / group to be created.
* @return subject.
* @throws JobExecutionException in case of generic failure
*/
@@ -99,10 +99,10 @@ public interface PushActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before to unassign a synchronized user / role from the resource.
+ * Action to be executed before to unassign a synchronized user / group from the resource.
*
* @param profile profile of the synchronization being executed.
- * @param subject user / role to be created.
+ * @param subject user / group to be created.
* @return subject.
* @throws JobExecutionException in case of generic failure
*/
@@ -111,10 +111,10 @@ public interface PushActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before delete a synchronized user / role locally and from the resource.
+ * Action to be executed before delete a synchronized user / group locally and from the resource.
*
* @param profile profile of the synchronization being executed.
- * @param subject user / role to be created.
+ * @param subject user / group to be created.
* @return subject.
* @throws JobExecutionException in case of generic failure
*/
@@ -123,10 +123,10 @@ public interface PushActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed after each local user / role synchronization.
+ * Action to be executed after each local user / group synchronization.
*
* @param profile profile of the synchronization being executed.
- * @param subject synchronized user / role.
+ * @param subject synchronized user / group.
* @param result operation result.
* @throws JobExecutionException in case of generic failure
*/
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/RolePushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/RolePushResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/RolePushResultHandler.java
deleted file mode 100644
index 72f71b9..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/RolePushResultHandler.java
+++ /dev/null
@@ -1,23 +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.provisioning.api.sync;
-
-public interface RolePushResultHandler extends SyncopePushResultHandler {
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/RoleSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/RoleSyncResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/RoleSyncResultHandler.java
deleted file mode 100644
index 48508d7..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/RoleSyncResultHandler.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.provisioning.api.sync;
-
-import java.util.Map;
-
-public interface RoleSyncResultHandler extends SyncopeSyncResultHandler {
-
- Map<Long, String> getRoleOwnerMap();
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncActions.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncActions.java
index 87f3d05..2824f99 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncActions.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncActions.java
@@ -29,13 +29,13 @@ import org.quartz.JobExecutionException;
public interface SyncActions extends ProvisioningActions {
/**
- * Action to be executed before to create a synchronized user / role locally.
- * User/role is created locally upon synchronization in case of the un-matching rule
+ * Action to be executed before to create a synchronized user / group locally.
+ * User/group is created locally upon synchronization in case of the un-matching rule
* {@link org.apache.syncope.common.types.UnmatchingRule#PROVISION} (default un-matching rule) is applied.
*
* @param profile profile of the synchronization being executed.
* @param delta retrieved synchronization information
- * @param subject user / role to be created
+ * @param subject user / group to be created
* @return synchronization information used for user status evaluation and to be passed to the 'after' method.
* @throws JobExecutionException in case of generic failure
*/
@@ -45,13 +45,13 @@ public interface SyncActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before creating (and linking to the resource) a synchronized user / role locally.
- * User/role is created locally and linked to the synchronized resource upon synchronization in case of the
+ * Action to be executed before creating (and linking to the resource) a synchronized user / group locally.
+ * User/group is created locally and linked to the synchronized resource upon synchronization in case of the
* un-matching rule {@link org.apache.syncope.common.types.UnmatchingRule#ASSIGN} is applied.
*
* @param profile profile of the synchronization being executed.
* @param delta retrieved synchronization information
- * @param subject user / role to be created
+ * @param subject user / group to be created
* @return synchronization information used for user status evaluation and to be passed to the 'after' method.
* @throws JobExecutionException in case of generic failure
*/
@@ -61,13 +61,13 @@ public interface SyncActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before unlinking resource from the synchronized user / role and de-provisioning.
- * User/role is unlinked and de-provisioned from the synchronized resource upon synchronization in case of the
+ * Action to be executed before unlinking resource from the synchronized user / group and de-provisioning.
+ * User/group is unlinked and de-provisioned from the synchronized resource upon synchronization in case of the
* matching rule {@link org.apache.syncope.common.types.MatchingRule#UNASSIGN} is applied.
*
* @param profile profile of the synchronization being executed.
* @param delta retrieved synchronization information
- * @param subject user / role to be created
+ * @param subject user / group to be created
* @return synchronization information used for user status evaluation and to be passed to the 'after' method.
* @throws JobExecutionException in case of generic failure
*/
@@ -78,12 +78,12 @@ public interface SyncActions extends ProvisioningActions {
/**
* Action to be executed before de-provisioning action only.
- * User/role is de-provisioned (without unlinking) from the synchronized resource upon synchronization in case of
+ * User/group is de-provisioned (without unlinking) from the synchronized resource upon synchronization in case of
* the matching rule {@link org.apache.syncope.common.types.MatchingRule#DEPROVISION} is applied.
*
* @param profile profile of the synchronization being executed.
* @param delta retrieved synchronization information
- * @param subject user / role to be created
+ * @param subject user / group to be created
* @return synchronization information used for user status evaluation and to be passed to the 'after' method.
* @throws JobExecutionException in case of generic failure
*/
@@ -93,13 +93,13 @@ public interface SyncActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before unlinking resource from the synchronized user / role.
- * User/role is unlinked (without de-provisioning) from the synchronized resource upon synchronization in case of
+ * Action to be executed before unlinking resource from the synchronized user / group.
+ * User/group is unlinked (without de-provisioning) from the synchronized resource upon synchronization in case of
* the matching rule {@link org.apache.syncope.common.types.MatchingRule#UNLINK} is applied.
*
* @param profile profile of the synchronization being executed.
* @param delta retrieved synchronization information
- * @param subject user / role to be created
+ * @param subject user / group to be created
* @return synchronization information used for user status evaluation and to be passed to the 'after' method.
* @throws JobExecutionException in case of generic failure
*/
@@ -109,13 +109,13 @@ public interface SyncActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before linking resource to the synchronized user / role.
- * User/role is linked (without updating) to the synchronized resource upon synchronization in case of
+ * Action to be executed before linking resource to the synchronized user / group.
+ * User/group is linked (without updating) to the synchronized resource upon synchronization in case of
* the matching rule {@link org.apache.syncope.common.types.MatchingRule#LINK} is applied.
*
* @param profile profile of the synchronization being executed.
* @param delta retrieved synchronization information
- * @param subject user / role to be created
+ * @param subject user / group to be created
* @return synchronization information used for user status evaluation and to be passed to the 'after' method.
* @throws JobExecutionException in case of generic failure
*/
@@ -125,13 +125,13 @@ public interface SyncActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed before to update a synchronized user / role locally.
- * User/role is updated upon synchronization in case of the matching rule
+ * Action to be executed before to update a synchronized user / group locally.
+ * User/group is updated upon synchronization in case of the matching rule
* {@link org.apache.syncope.common.types.MatchingRule#UPDATE} (default matching rule) is applied.
*
* @param profile profile of the synchronization being executed.
* @param delta retrieved synchronization information
- * @param subject local user / role information
+ * @param subject local user / group information
* @param subjectMod modification
* @return synchronization information used for logging and to be passed to the 'after' method.
* @throws JobExecutionException in case of generic failure.
@@ -144,11 +144,11 @@ public interface SyncActions extends ProvisioningActions {
throws JobExecutionException;
/**
- * Action to be executed before to delete a synchronized user / role locally.
+ * Action to be executed before to delete a synchronized user / group locally.
*
* @param profile profile of the synchronization being executed.
* @param delta retrieved synchronization information
- * @param subject local user / role to be deleted
+ * @param subject local user / group to be deleted
* @return synchronization information used for logging and to be passed to the 'after' method.
* @throws JobExecutionException in case of generic failure
*/
@@ -158,12 +158,12 @@ public interface SyncActions extends ProvisioningActions {
final T subject) throws JobExecutionException;
/**
- * Action to be executed after each local user / role synchronization.
+ * Action to be executed after each local user / group synchronization.
*
* @param profile profile of the synchronization being executed.
* @param delta retrieved synchronization information (may be modified by
* 'beforeProvision/beforeUpdate/beforeDelete')
- * @param subject synchronized local user / role
+ * @param subject synchronized local user / group
* @param result global synchronization results at the current synchronization step
* @throws JobExecutionException in case of generic failure
*/
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
new file mode 100644
index 0000000..7dc3366
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
@@ -0,0 +1,222 @@
+/*
+ * 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.provisioning.java;
+
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.PropagationByResource;
+import org.apache.syncope.core.persistence.api.GroupEntitlementUtil;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.provisioning.api.GroupProvisioningManager;
+import org.apache.syncope.core.provisioning.api.WorkflowResult;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
+import org.apache.syncope.core.misc.security.AuthContextUtil;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
+
+public class DefaultGroupProvisioningManager implements GroupProvisioningManager {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GroupProvisioningManager.class);
+
+ @Autowired
+ protected GroupWorkflowAdapter gwfAdapter;
+
+ @Autowired
+ protected PropagationManager propagationManager;
+
+ @Autowired
+ protected PropagationTaskExecutor taskExecutor;
+
+ @Autowired
+ protected GroupDAO groupDAO;
+
+ @Override
+ public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO subject) {
+ return create(subject, Collections.<String>emptySet());
+ }
+
+ @Override
+ public Map.Entry<Long, List<PropagationStatus>> create(final GroupTO subject, final Set<String> excludedResources) {
+ WorkflowResult<Long> created = gwfAdapter.create(subject);
+
+ AuthContextUtil.extendAuthContext(created.getResult(), GroupEntitlementUtil.getEntitlementNameFromGroupKey(created.getResult()));
+
+ List<PropagationTask> tasks =
+ propagationManager.getGroupCreateTaskIds(created, subject.getVirAttrs(), excludedResources);
+ PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().getBean(
+ PropagationReporter.class);
+ try {
+ taskExecutor.execute(tasks, propagationReporter);
+ } catch (PropagationException e) {
+ LOG.error("Error propagation primary resource", e);
+ propagationReporter.onPrimaryResourceFailure(tasks);
+ }
+
+ return new AbstractMap.SimpleEntry<>(created.getResult(), propagationReporter.getStatuses());
+ }
+
+ @Override
+ public Map.Entry<Long, List<PropagationStatus>> create(
+ final GroupTO groupTO, final Map<Long, String> groupOwnerMap, final Set<String> excludedResources) {
+
+ WorkflowResult<Long> created = gwfAdapter.create(groupTO);
+ AttrTO groupOwner = groupTO.getPlainAttrMap().get(StringUtils.EMPTY);
+ if (groupOwner != null) {
+ groupOwnerMap.put(created.getResult(), groupOwner.getValues().iterator().next());
+ }
+
+ AuthContextUtil.extendAuthContext(created.getResult(),
+ GroupEntitlementUtil.getEntitlementNameFromGroupKey(created.getResult()));
+
+ List<PropagationTask> tasks = propagationManager.getGroupCreateTaskIds(
+ created, groupTO.getVirAttrs(), excludedResources);
+
+ taskExecutor.execute(tasks);
+
+ return new AbstractMap.SimpleEntry<>(created.getResult(), null);
+ }
+
+ @Override
+ public Map.Entry<Long, List<PropagationStatus>> update(final GroupMod subjectMod) {
+ return update(subjectMod, Collections.<String>emptySet());
+ }
+
+ @Override
+ public Map.Entry<Long, List<PropagationStatus>> update(
+ final GroupMod subjectMod, final Set<String> excludedResources) {
+
+ WorkflowResult<Long> updated = gwfAdapter.update(subjectMod);
+
+ List<PropagationTask> tasks = propagationManager.getGroupUpdateTaskIds(updated,
+ subjectMod.getVirAttrsToRemove(), subjectMod.getVirAttrsToUpdate());
+ PropagationReporter propagationReporter =
+ ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+ try {
+ taskExecutor.execute(tasks, propagationReporter);
+ } catch (PropagationException e) {
+ LOG.error("Error propagation primary resource", e);
+ propagationReporter.onPrimaryResourceFailure(tasks);
+ }
+
+ Map.Entry<Long, List<PropagationStatus>> result = new AbstractMap.SimpleEntry<>(
+ updated.getResult(), propagationReporter.getStatuses());
+ return result;
+ }
+
+ @Override
+ public List<PropagationStatus> delete(final Long subjectKey) {
+ final List<Group> toBeDeprovisioned = new ArrayList<>();
+
+ final Group syncopeGroup = groupDAO.find(subjectKey);
+
+ if (syncopeGroup != null) {
+ toBeDeprovisioned.add(syncopeGroup);
+
+ final List<Group> descendants = groupDAO.findDescendants(toBeDeprovisioned.get(0));
+ if (descendants != null) {
+ toBeDeprovisioned.addAll(descendants);
+ }
+ }
+
+ final List<PropagationTask> tasks = new ArrayList<>();
+
+ for (Group group : toBeDeprovisioned) {
+ // Generate propagation tasks for deleting users from group resources, if they are on those resources only
+ // because of the reason being deleted (see SYNCOPE-357)
+ for (Map.Entry<Long, PropagationByResource> entry : groupDAO.findUsersWithIndirectResources(group.
+ getKey()).entrySet()) {
+
+ WorkflowResult<Long> wfResult =
+ new WorkflowResult<>(entry.getKey(), entry.getValue(), Collections.<String>emptySet());
+ tasks.addAll(propagationManager.getUserDeleteTaskIds(wfResult));
+ }
+
+ // Generate propagation tasks for deleting this group from resources
+ tasks.addAll(propagationManager.getGroupDeleteTaskIds(group.getKey()));
+ }
+
+ PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
+ getBean(PropagationReporter.class);
+ try {
+ taskExecutor.execute(tasks, propagationReporter);
+ } catch (PropagationException e) {
+ LOG.error("Error propagation primary resource", e);
+ propagationReporter.onPrimaryResourceFailure(tasks);
+ }
+
+ try {
+ gwfAdapter.delete(subjectKey);
+ } catch (RuntimeException e) {
+ throw e;
+ }
+
+ return propagationReporter.getStatuses();
+ }
+
+ @Override
+ public Long unlink(final GroupMod subjectMod) {
+ WorkflowResult<Long> updated = gwfAdapter.update(subjectMod);
+ return updated.getResult();
+ }
+
+ @Override
+ public List<PropagationStatus> deprovision(final Long groupKey, final Collection<String> resources) {
+ Group group = groupDAO.authFetch(groupKey);
+
+ Set<String> noPropResourceName = group.getResourceNames();
+ noPropResourceName.removeAll(resources);
+
+ List<PropagationTask> tasks = propagationManager.getGroupDeleteTaskIds(
+ groupKey, new HashSet<>(resources), noPropResourceName);
+ PropagationReporter propagationReporter =
+ ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+ try {
+ taskExecutor.execute(tasks, propagationReporter);
+ } catch (PropagationException e) {
+ LOG.error("Error propagation primary resource", e);
+ propagationReporter.onPrimaryResourceFailure(tasks);
+ }
+ return propagationReporter.getStatuses();
+ }
+
+ @Override
+ public Long link(final GroupMod subjectMod) {
+ return gwfAdapter.update(subjectMod).getResult();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultRoleProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultRoleProvisioningManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultRoleProvisioningManager.java
deleted file mode 100644
index d78e0fc..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultRoleProvisioningManager.java
+++ /dev/null
@@ -1,223 +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.provisioning.java;
-
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.mod.RoleMod;
-import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.PropagationStatus;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.core.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.RoleProvisioningManager;
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.core.misc.security.AuthContextUtil;
-import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.workflow.api.RoleWorkflowAdapter;
-
-public class DefaultRoleProvisioningManager implements RoleProvisioningManager {
-
- private static final Logger LOG = LoggerFactory.getLogger(RoleProvisioningManager.class);
-
- @Autowired
- protected RoleWorkflowAdapter rwfAdapter;
-
- @Autowired
- protected PropagationManager propagationManager;
-
- @Autowired
- protected PropagationTaskExecutor taskExecutor;
-
- @Autowired
- protected RoleDAO roleDAO;
-
- @Override
- public Map.Entry<Long, List<PropagationStatus>> create(final RoleTO subject) {
- return create(subject, Collections.<String>emptySet());
- }
-
- @Override
- public Map.Entry<Long, List<PropagationStatus>> create(final RoleTO subject, final Set<String> excludedResources) {
- WorkflowResult<Long> created = rwfAdapter.create(subject);
-
- AuthContextUtil.extendAuthContext(
- created.getResult(), RoleEntitlementUtil.getEntitlementNameFromRoleKey(created.getResult()));
-
- List<PropagationTask> tasks =
- propagationManager.getRoleCreateTaskIds(created, subject.getVirAttrs(), excludedResources);
- PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().getBean(
- PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
-
- return new AbstractMap.SimpleEntry<>(created.getResult(), propagationReporter.getStatuses());
- }
-
- @Override
- public Map.Entry<Long, List<PropagationStatus>> create(
- final RoleTO roleTO, final Map<Long, String> roleOwnerMap, final Set<String> excludedResources) {
-
- WorkflowResult<Long> created = rwfAdapter.create(roleTO);
- AttrTO roleOwner = roleTO.getPlainAttrMap().get(StringUtils.EMPTY);
- if (roleOwner != null) {
- roleOwnerMap.put(created.getResult(), roleOwner.getValues().iterator().next());
- }
-
- AuthContextUtil.extendAuthContext(
- created.getResult(), RoleEntitlementUtil.getEntitlementNameFromRoleKey(created.getResult()));
-
- List<PropagationTask> tasks = propagationManager.getRoleCreateTaskIds(
- created, roleTO.getVirAttrs(), excludedResources);
-
- taskExecutor.execute(tasks);
-
- return new AbstractMap.SimpleEntry<>(created.getResult(), null);
- }
-
- @Override
- public Map.Entry<Long, List<PropagationStatus>> update(final RoleMod subjectMod) {
- return update(subjectMod, Collections.<String>emptySet());
- }
-
- @Override
- public Map.Entry<Long, List<PropagationStatus>> update(
- final RoleMod subjectMod, final Set<String> excludedResources) {
-
- WorkflowResult<Long> updated = rwfAdapter.update(subjectMod);
-
- List<PropagationTask> tasks = propagationManager.getRoleUpdateTaskIds(updated,
- subjectMod.getVirAttrsToRemove(), subjectMod.getVirAttrsToUpdate());
- PropagationReporter propagationReporter =
- ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
-
- Map.Entry<Long, List<PropagationStatus>> result = new AbstractMap.SimpleEntry<>(
- updated.getResult(), propagationReporter.getStatuses());
- return result;
- }
-
- @Override
- public List<PropagationStatus> delete(final Long subjectKey) {
- final List<Role> toBeDeprovisioned = new ArrayList<>();
-
- final Role syncopeRole = roleDAO.find(subjectKey);
-
- if (syncopeRole != null) {
- toBeDeprovisioned.add(syncopeRole);
-
- final List<Role> descendants = roleDAO.findDescendants(toBeDeprovisioned.get(0));
- if (descendants != null) {
- toBeDeprovisioned.addAll(descendants);
- }
- }
-
- final List<PropagationTask> tasks = new ArrayList<>();
-
- for (Role role : toBeDeprovisioned) {
- // Generate propagation tasks for deleting users from role resources, if they are on those resources only
- // because of the reason being deleted (see SYNCOPE-357)
- for (Map.Entry<Long, PropagationByResource> entry : roleDAO.findUsersWithIndirectResources(role.
- getKey()).entrySet()) {
-
- WorkflowResult<Long> wfResult =
- new WorkflowResult<>(entry.getKey(), entry.getValue(), Collections.<String>emptySet());
- tasks.addAll(propagationManager.getUserDeleteTaskIds(wfResult));
- }
-
- // Generate propagation tasks for deleting this role from resources
- tasks.addAll(propagationManager.getRoleDeleteTaskIds(role.getKey()));
- }
-
- PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
- getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
-
- try {
- rwfAdapter.delete(subjectKey);
- } catch (RuntimeException e) {
- throw e;
- }
-
- return propagationReporter.getStatuses();
- }
-
- @Override
- public Long unlink(final RoleMod subjectMod) {
- WorkflowResult<Long> updated = rwfAdapter.update(subjectMod);
- return updated.getResult();
- }
-
- @Override
- public List<PropagationStatus> deprovision(final Long roleKey, final Collection<String> resources) {
- Role role = roleDAO.authFetch(roleKey);
-
- Set<String> noPropResourceName = role.getResourceNames();
- noPropResourceName.removeAll(resources);
-
- List<PropagationTask> tasks = propagationManager.getRoleDeleteTaskIds(
- roleKey, new HashSet<>(resources), noPropResourceName);
- PropagationReporter propagationReporter =
- ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
- return propagationReporter.getStatuses();
- }
-
- @Override
- public Long link(final RoleMod subjectMod) {
- return rwfAdapter.update(subjectMod).getResult();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
index b11cfe4..c9fbe0f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
@@ -123,7 +123,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
for (MembershipMod membershipMod : userMod.getMembershipsToAdd()) {
if (!virtAttrHandler.fillMembershipVirtual(
updated.getResult().getKey().getKey(),
- membershipMod.getRole(),
+ membershipMod.getGroup(),
null,
membershipMod.getVirAttrsToRemove(),
membershipMod.getVirAttrsToUpdate(),
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandler.java
index 449f949..c948de4 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandler.java
@@ -47,9 +47,9 @@ import org.apache.syncope.core.persistence.api.entity.VirSchema;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
import org.apache.syncope.core.persistence.api.entity.user.UVirSchema;
import org.slf4j.Logger;
@@ -100,15 +100,15 @@ public class VirAttrHandler {
if (virAttr instanceof UVirAttr) {
((UVirAttr) virAttr).setSchema((UVirSchema) virSchema);
- } else if (virAttr instanceof RVirAttr) {
- RVirAttrTemplate template = ((Role) attributable).
- getAttrTemplate(RVirAttrTemplate.class, virSchema.getKey());
+ } else if (virAttr instanceof GVirAttr) {
+ GVirAttrTemplate template = ((Group) attributable).
+ getAttrTemplate(GVirAttrTemplate.class, virSchema.getKey());
if (template != null) {
- ((RVirAttr) virAttr).setTemplate(template);
+ ((GVirAttr) virAttr).setTemplate(template);
}
} else if (virAttr instanceof MVirAttr) {
MVirAttrTemplate template =
- ((Membership) attributable).getRole().
+ ((Membership) attributable).getGroup().
getAttrTemplate(MVirAttrTemplate.class, virSchema.getKey());
if (template != null) {
((MVirAttr) virAttr).setTemplate(template);
@@ -141,7 +141,7 @@ public class VirAttrHandler {
externalResources.addAll(((Subject<?, ?, ?>) attributable).getResources());
} else if (attributable instanceof Membership) {
externalResources.addAll(((Membership) attributable).getUser().getResources());
- externalResources.addAll(((Membership) attributable).getRole().getResources());
+ externalResources.addAll(((Membership) attributable).getGroup().getResources());
}
// 1. virtual attributes to be removed
@@ -282,7 +282,7 @@ public class VirAttrHandler {
* SYNCOPE-501: build membership virtual attribute changes in case no other changes were made.
*
* @param key user key
- * @param roleKey role key
+ * @param groupKey group key
* @param membershipKey membership key
* @param vAttrsToBeRemoved virtual attributes to be removed.
* @param vAttrsToBeUpdated virtual attributes to be updated.
@@ -290,11 +290,11 @@ public class VirAttrHandler {
* @return operations to be performed on external resources for membership virtual attributes changes
*/
public PropagationByResource fillMembershipVirtual(
- final Long key, final Long roleKey, final Long membershipKey, final Set<String> vAttrsToBeRemoved,
+ final Long key, final Long groupKey, final Long membershipKey, final Set<String> vAttrsToBeRemoved,
final Set<AttrMod> vAttrsToBeUpdated, final boolean isRemoval) {
final Membership membership = membershipKey == null
- ? userDAO.authFetch(key).getMembership(roleKey)
+ ? userDAO.authFetch(key).getMembership(groupKey)
: membershipDAO.authFetch(membershipKey);
return membership == null ? new PropagationByResource() : isRemoval
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/MemoryVirAttrCache.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/MemoryVirAttrCache.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/MemoryVirAttrCache.java
index d746ae4..8a32e99 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/MemoryVirAttrCache.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/cache/MemoryVirAttrCache.java
@@ -56,8 +56,8 @@ public class MemoryVirAttrCache implements VirAttrCache {
/**
* Cache virtual attribute values.
*
- * @param type user or role
- * @param key user or role id
+ * @param type user or group
+ * @param key user or group id
* @param schemaName virtual attribute name
* @param value virtual attribute values
*/
@@ -81,8 +81,8 @@ public class MemoryVirAttrCache implements VirAttrCache {
/**
* Retrieve cached value. Return null in case of virtual attribute not cached.
*
- * @param type user or role
- * @param id user or role id
+ * @param type user or group
+ * @param id user or group id
* @param schemaName virtual attribute schema name.
* @return cached values or null if virtual attribute is not cached.
*/
@@ -94,8 +94,8 @@ public class MemoryVirAttrCache implements VirAttrCache {
/**
* Force entry expiring.
*
- * @param type user or role
- * @param id user or role id
+ * @param type user or group
+ * @param id user or group id
* @param schemaName virtual attribute schema name
*/
@Override
@@ -113,7 +113,7 @@ public class MemoryVirAttrCache implements VirAttrCache {
* This method is not thread safe: the caller have to take care to synchronize the call.
*/
private void free() {
- final Set<VirAttrCacheKey> toBeRemoved = new HashSet<VirAttrCacheKey>();
+ final Set<VirAttrCacheKey> toBeRemoved = new HashSet<>();
Map.Entry<VirAttrCacheKey, VirAttrCacheValue> latest = null;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
index ea12fad..65fc97e 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
@@ -49,7 +49,7 @@ import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
import org.apache.syncope.core.persistence.api.dao.PlainAttrValueDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+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.dao.VirAttrDAO;
import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
@@ -74,12 +74,12 @@ import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr;
import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
@@ -101,7 +101,7 @@ abstract class AbstractAttributableDataBinder {
protected static final Logger LOG = LoggerFactory.getLogger(AbstractAttributableDataBinder.class);
@Autowired
- protected RoleDAO roleDAO;
+ protected GroupDAO groupDAO;
@Autowired
protected PlainSchemaDAO plainSchemaDAO;
@@ -259,12 +259,12 @@ abstract class AbstractAttributableDataBinder {
// Check if there is some mandatory schema defined for which no value has been provided
List<? extends PlainSchema> plainSchemas;
switch (attrUtil.getType()) {
- case ROLE:
- plainSchemas = ((Role) attributable).getAttrTemplateSchemas(RPlainAttrTemplate.class);
+ case GROUP:
+ plainSchemas = ((Group) attributable).getAttrTemplateSchemas(GPlainAttrTemplate.class);
break;
case MEMBERSHIP:
- plainSchemas = ((Membership) attributable).getRole().getAttrTemplateSchemas(MPlainAttrTemplate.class);
+ plainSchemas = ((Membership) attributable).getGroup().getAttrTemplateSchemas(MPlainAttrTemplate.class);
break;
case USER:
@@ -286,12 +286,12 @@ abstract class AbstractAttributableDataBinder {
List<? extends DerSchema> derSchemas;
switch (attrUtil.getType()) {
- case ROLE:
- derSchemas = ((Role) attributable).getAttrTemplateSchemas(RDerAttrTemplate.class);
+ case GROUP:
+ derSchemas = ((Group) attributable).getAttrTemplateSchemas(GDerAttrTemplate.class);
break;
case MEMBERSHIP:
- derSchemas = ((Membership) attributable).getRole().getAttrTemplateSchemas(MDerAttrTemplate.class);
+ derSchemas = ((Membership) attributable).getGroup().getAttrTemplateSchemas(MDerAttrTemplate.class);
break;
case USER:
@@ -311,12 +311,12 @@ abstract class AbstractAttributableDataBinder {
List<? extends VirSchema> virSchemas;
switch (attrUtil.getType()) {
- case ROLE:
- virSchemas = ((Role) attributable).getAttrTemplateSchemas(RVirAttrTemplate.class);
+ case GROUP:
+ virSchemas = ((Group) attributable).getAttrTemplateSchemas(GVirAttrTemplate.class);
break;
case MEMBERSHIP:
- virSchemas = ((Membership) attributable).getRole().getAttrTemplateSchemas(MVirAttrTemplate.class);
+ virSchemas = ((Membership) attributable).getGroup().getAttrTemplateSchemas(MVirAttrTemplate.class);
break;
case USER:
@@ -343,14 +343,14 @@ abstract class AbstractAttributableDataBinder {
if (attr instanceof UPlainAttr) {
((UPlainAttr) attr).setSchema((UPlainSchema) schema);
- } else if (attr instanceof RPlainAttr) {
- RPlainAttrTemplate template =
- ((Role) attributable).getAttrTemplate(RPlainAttrTemplate.class, schema.getKey());
+ } else if (attr instanceof GPlainAttr) {
+ GPlainAttrTemplate template =
+ ((Group) attributable).getAttrTemplate(GPlainAttrTemplate.class, schema.getKey());
if (template != null) {
- ((RPlainAttr) attr).setTemplate(template);
+ ((GPlainAttr) attr).setTemplate(template);
}
} else if (attr instanceof MPlainAttr) {
- MPlainAttrTemplate template = ((Membership) attributable).getRole().
+ MPlainAttrTemplate template = ((Membership) attributable).getGroup().
getAttrTemplate(MPlainAttrTemplate.class, schema.getKey());
if (template != null) {
((MPlainAttr) attr).setTemplate(template);
@@ -363,14 +363,14 @@ abstract class AbstractAttributableDataBinder {
if (derAttr instanceof UDerAttr) {
((UDerAttr) derAttr).setSchema((UDerSchema) derSchema);
- } else if (derAttr instanceof RDerAttr) {
- RDerAttrTemplate template = ((Role) attributable).
- getAttrTemplate(RDerAttrTemplate.class, derSchema.getKey());
+ } else if (derAttr instanceof GDerAttr) {
+ GDerAttrTemplate template = ((Group) attributable).
+ getAttrTemplate(GDerAttrTemplate.class, derSchema.getKey());
if (template != null) {
- ((RDerAttr) derAttr).setTemplate(template);
+ ((GDerAttr) derAttr).setTemplate(template);
}
} else if (derAttr instanceof MDerAttr) {
- MDerAttrTemplate template = ((Membership) attributable).getRole().
+ MDerAttrTemplate template = ((Membership) attributable).getGroup().
getAttrTemplate(MDerAttrTemplate.class, derSchema.getKey());
if (template != null) {
((MDerAttr) derAttr).setTemplate(template);
@@ -416,7 +416,7 @@ abstract class AbstractAttributableDataBinder {
externalResources.addAll(((Subject<?, ?, ?>) attributable).getResources());
} else if (attributable instanceof Membership) {
externalResources.addAll(((Membership) attributable).getUser().getResources());
- externalResources.addAll(((Membership) attributable).getRole().getResources());
+ externalResources.addAll(((Membership) attributable).getGroup().getResources());
}
// 3. attributes to be removed
@@ -591,8 +591,8 @@ abstract class AbstractAttributableDataBinder {
LOG.debug("Derived attributes to be added:\n{}", propByRes);
- // 7. virtual attributes: for users and roles this is delegated to PropagationManager
- if (AttributableType.USER != attrUtil.getType() && AttributableType.ROLE != attrUtil.getType()) {
+ // 7. virtual attributes: for users and groups this is delegated to PropagationManager
+ if (AttributableType.USER != attrUtil.getType() && AttributableType.GROUP != attrUtil.getType()) {
virtAttrHander.fillVirtual(attributable, attributableMod.getVirAttrsToRemove(),
attributableMod.getVirAttrsToUpdate(), attrUtil);
}
@@ -663,9 +663,9 @@ abstract class AbstractAttributableDataBinder {
}
}
- // 3. user and role virtual attributes will be evaluated by the propagation manager only (if needed).
+ // 3. user and group virtual attributes will be evaluated by the propagation manager only (if needed).
if (AttributableType.USER == attrUtil.getType()
- || AttributableType.ROLE == attrUtil.getType()) {
+ || AttributableType.GROUP == attrUtil.getType()) {
for (AttrTO vattrTO : attributableTO.getVirAttrs()) {
VirSchema virSchema = virtAttrHander.getVirSchema(vattrTO.getSchema(), attrUtil.virSchemaClass());
@@ -753,7 +753,7 @@ abstract class AbstractAttributableDataBinder {
for (ExternalResource resource : subject.getResources()) {
if ((type == AttributableType.USER && resource.getUmapping() != null)
- || (type == AttributableType.ROLE && resource.getRmapping() != null)) {
+ || (type == AttributableType.GROUP && resource.getGmapping() != null)) {
MappingItem accountIdItem =
attrUtilFactory.getInstance(type).getAccountIdItem(resource);
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/GroupDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/GroupDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/GroupDataBinderImpl.java
new file mode 100644
index 0000000..4a5ed5f
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/GroupDataBinderImpl.java
@@ -0,0 +1,411 @@
+/*
+ * 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.provisioning.java.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.syncope.common.lib.SyncopeClientCompositeException;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.mod.GroupMod;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.ResourceOperation;
+import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.Entitlement;
+import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.Schema;
+import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.common.lib.types.PropagationByResource;
+import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
+import org.apache.syncope.core.misc.ConnObjectUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+@Transactional(rollbackFor = { Throwable.class })
+public class GroupDataBinderImpl extends AbstractAttributableDataBinder implements GroupDataBinder {
+
+ @Autowired
+ private ConnObjectUtil connObjectUtil;
+
+ @Autowired
+ private EntitlementDAO entitlementDAO;
+
+ private <T extends AttrTemplate<S>, S extends Schema> void setAttrTemplates(
+ final Group group, final List<String> schemaNames,
+ final Class<T> templateClass, final Class<S> schemaClass) {
+
+ List<T> toRemove = new ArrayList<>();
+ for (T template : group.getAttrTemplates(templateClass)) {
+ if (!schemaNames.contains(template.getSchema().getKey())) {
+ toRemove.add(template);
+ }
+ }
+ group.getAttrTemplates(templateClass).removeAll(toRemove);
+
+ for (String schemaName : schemaNames) {
+ if (group.getAttrTemplate(templateClass, schemaName) == null) {
+ S schema = getSchema(schemaName, schemaClass);
+ if (schema != null) {
+ try {
+ T template = entityFactory.newEntity(templateClass);
+ template.setSchema(schema);
+ template.setOwner(group);
+ group.getAttrTemplates(templateClass).add(template);
+ } catch (Exception e) {
+ LOG.error("Could not create template for {}", templateClass, e);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public Group create(final Group group, final GroupTO groupTO) {
+ group.setInheritOwner(groupTO.isInheritOwner());
+
+ group.setInheritPlainAttrs(groupTO.isInheritPlainAttrs());
+ group.setInheritDerAttrs(groupTO.isInheritDerAttrs());
+ group.setInheritVirAttrs(groupTO.isInheritVirAttrs());
+
+ group.setInheritTemplates(groupTO.isInheritTemplates());
+
+ group.setInheritPasswordPolicy(groupTO.isInheritPasswordPolicy());
+ group.setInheritAccountPolicy(groupTO.isInheritAccountPolicy());
+
+ SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
+
+ // name and parent
+ SyncopeClientException invalidGroups = SyncopeClientException.build(ClientExceptionType.InvalidGroups);
+ if (groupTO.getName() == null) {
+ LOG.error("No name specified for this group");
+
+ invalidGroups.getElements().add("No name specified for this group");
+ } else {
+ group.setName(groupTO.getName());
+ }
+ Long parentGroupKey = null;
+ if (groupTO.getParent() != 0) {
+ Group parentGroup = groupDAO.find(groupTO.getParent());
+ if (parentGroup == null) {
+ LOG.error("Could not find group with id " + groupTO.getParent());
+
+ invalidGroups.getElements().add(String.valueOf(groupTO.getParent()));
+ scce.addException(invalidGroups);
+ } else {
+ group.setParent(parentGroup);
+ parentGroupKey = group.getParent().getKey();
+ }
+ }
+
+ Group otherGroup = groupDAO.find(groupTO.getName(), parentGroupKey);
+ if (otherGroup != null) {
+ LOG.error("Another group exists with the same name and the same parent group: " + otherGroup);
+
+ invalidGroups.getElements().add(groupTO.getName());
+ }
+
+ // attribute templates
+ setAttrTemplates(group, groupTO.getGPlainAttrTemplates(), GPlainAttrTemplate.class, GPlainSchema.class);
+ setAttrTemplates(group, groupTO.getGDerAttrTemplates(), GDerAttrTemplate.class, GDerSchema.class);
+ setAttrTemplates(group, groupTO.getGVirAttrTemplates(), GVirAttrTemplate.class, GVirSchema.class);
+ setAttrTemplates(group, groupTO.getMPlainAttrTemplates(), MPlainAttrTemplate.class, MPlainSchema.class);
+ setAttrTemplates(group, groupTO.getMDerAttrTemplates(), MDerAttrTemplate.class, MDerSchema.class);
+ setAttrTemplates(group, groupTO.getMVirAttrTemplates(), MVirAttrTemplate.class, MVirSchema.class);
+
+ // attributes, derived attributes, virtual attributes and resources
+ fill(group, groupTO, attrUtilFactory.getInstance(AttributableType.GROUP), scce);
+
+ // entitlements
+ for (String entitlementName : groupTO.getEntitlements()) {
+ Entitlement entitlement = entitlementDAO.find(entitlementName);
+ if (entitlement == null) {
+ LOG.warn("Ignoring invalid entitlement {}", entitlementName);
+ } else {
+ group.addEntitlement(entitlement);
+ }
+ }
+
+ // owner
+ if (groupTO.getUserOwner() != null) {
+ User owner = userDAO.find(groupTO.getUserOwner());
+ if (owner == null) {
+ LOG.warn("Ignoring invalid user specified as owner: {}", groupTO.getUserOwner());
+ } else {
+ group.setUserOwner(owner);
+ }
+ }
+ if (groupTO.getGroupOwner() != null) {
+ Group owner = groupDAO.find(groupTO.getGroupOwner());
+ if (owner == null) {
+ LOG.warn("Ignoring invalid group specified as owner: {}", groupTO.getGroupOwner());
+ } else {
+ group.setGroupOwner(owner);
+ }
+ }
+
+ // policies
+ if (groupTO.getPasswordPolicy() != null) {
+ group.setPasswordPolicy((PasswordPolicy) policyDAO.find(groupTO.getPasswordPolicy()));
+ }
+ if (groupTO.getAccountPolicy() != null) {
+ group.setAccountPolicy((AccountPolicy) policyDAO.find(groupTO.getAccountPolicy()));
+ }
+
+ return group;
+ }
+
+ @Override
+ public PropagationByResource update(final Group group, final GroupMod groupMod) {
+ PropagationByResource propByRes = new PropagationByResource();
+
+ SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
+
+ // fetch account ids before update
+ Map<String, String> oldAccountIds = getAccountIds(group, AttributableType.GROUP);
+
+ // name
+ SyncopeClientException invalidGroups = SyncopeClientException.build(ClientExceptionType.InvalidGroups);
+ if (groupMod.getName() != null) {
+ Group otherGroup = groupDAO.find(groupMod.getName(),
+ group.getParent() == null ? null : group.getParent().getKey());
+ if (otherGroup == null || group.equals(otherGroup)) {
+ if (!groupMod.getName().equals(group.getName())) {
+ propByRes.addAll(ResourceOperation.UPDATE, group.getResourceNames());
+
+ group.setName(groupMod.getName());
+ }
+ } else {
+ LOG.error("Another group exists with the same name and the same parent group: " + otherGroup);
+
+ invalidGroups.getElements().add(groupMod.getName());
+ scce.addException(invalidGroups);
+ }
+ }
+
+ if (groupMod.getInheritOwner() != null) {
+ group.setInheritOwner(groupMod.getInheritOwner());
+ }
+
+ if (groupMod.getInheritTemplates() != null) {
+ group.setInheritTemplates(groupMod.getInheritTemplates());
+ }
+
+ if (groupMod.getInheritPlainAttrs() != null) {
+ group.setInheritPlainAttrs(groupMod.getInheritPlainAttrs());
+ }
+ if (groupMod.getInheritDerAttrs() != null) {
+ group.setInheritDerAttrs(groupMod.getInheritDerAttrs());
+ }
+ if (groupMod.getInheritVirAttrs() != null) {
+ group.setInheritVirAttrs(groupMod.getInheritVirAttrs());
+ }
+
+ if (groupMod.getInheritPasswordPolicy() != null) {
+ group.setInheritPasswordPolicy(groupMod.getInheritPasswordPolicy());
+ }
+ if (groupMod.getInheritAccountPolicy() != null) {
+ group.setInheritAccountPolicy(groupMod.getInheritAccountPolicy());
+ }
+
+ // entitlements
+ if (groupMod.isModEntitlements()) {
+ group.getEntitlements().clear();
+ for (String entitlementName : groupMod.getEntitlements()) {
+ Entitlement entitlement = entitlementDAO.find(entitlementName);
+ if (entitlement == null) {
+ LOG.warn("Ignoring invalid entitlement {}", entitlementName);
+ } else {
+ group.addEntitlement(entitlement);
+ }
+ }
+ }
+
+ // attribute templates
+ if (groupMod.isModRAttrTemplates()) {
+ setAttrTemplates(group, groupMod.getRPlainAttrTemplates(), GPlainAttrTemplate.class, GPlainSchema.class);
+ }
+ if (groupMod.isModRDerAttrTemplates()) {
+ setAttrTemplates(group, groupMod.getRDerAttrTemplates(), GDerAttrTemplate.class, GDerSchema.class);
+ }
+ if (groupMod.isModRVirAttrTemplates()) {
+ setAttrTemplates(group, groupMod.getRVirAttrTemplates(), GVirAttrTemplate.class, GVirSchema.class);
+ }
+ if (groupMod.isModMAttrTemplates()) {
+ setAttrTemplates(group, groupMod.getMPlainAttrTemplates(), MPlainAttrTemplate.class, MPlainSchema.class);
+ }
+ if (groupMod.isModMDerAttrTemplates()) {
+ setAttrTemplates(group, groupMod.getMDerAttrTemplates(), MDerAttrTemplate.class, MDerSchema.class);
+ }
+ if (groupMod.isModMVirAttrTemplates()) {
+ setAttrTemplates(group, groupMod.getMVirAttrTemplates(), MVirAttrTemplate.class, MVirSchema.class);
+ }
+
+ // policies
+ if (groupMod.getPasswordPolicy() != null) {
+ group.setPasswordPolicy(groupMod.getPasswordPolicy().getKey() == null
+ ? null
+ : (PasswordPolicy) policyDAO.find(groupMod.getPasswordPolicy().getKey()));
+ }
+ if (groupMod.getAccountPolicy() != null) {
+ group.setAccountPolicy(groupMod.getAccountPolicy().getKey() == null
+ ? null
+ : (AccountPolicy) policyDAO.find(groupMod.getAccountPolicy().getKey()));
+ }
+
+ // owner
+ if (groupMod.getUserOwner() != null) {
+ group.setUserOwner(groupMod.getUserOwner().getKey() == null
+ ? null
+ : userDAO.find(groupMod.getUserOwner().getKey()));
+ }
+ if (groupMod.getGroupOwner() != null) {
+ group.setGroupOwner(groupMod.getGroupOwner().getKey() == null
+ ? null
+ : groupDAO.find(groupMod.getGroupOwner().getKey()));
+ }
+
+ // attributes, derived attributes, virtual attributes and resources
+ propByRes.merge(fill(group, groupMod, attrUtilFactory.getInstance(AttributableType.GROUP), scce));
+
+ // check if some account id was changed by the update above
+ Map<String, String> newAccountIds = getAccountIds(group, AttributableType.GROUP);
+ for (Map.Entry<String, String> entry : oldAccountIds.entrySet()) {
+ if (newAccountIds.containsKey(entry.getKey())
+ && !entry.getValue().equals(newAccountIds.get(entry.getKey()))) {
+
+ propByRes.addOldAccountId(entry.getKey(), entry.getValue());
+ propByRes.add(ResourceOperation.UPDATE, entry.getKey());
+ }
+ }
+
+ return propByRes;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Transactional(readOnly = true)
+ @Override
+ public GroupTO getGroupTO(final Group group) {
+ connObjectUtil.retrieveVirAttrValues(group, attrUtilFactory.getInstance(AttributableType.GROUP));
+
+ GroupTO groupTO = new GroupTO();
+
+ // set sys info
+ groupTO.setCreator(group.getCreator());
+ groupTO.setCreationDate(group.getCreationDate());
+ groupTO.setLastModifier(group.getLastModifier());
+ groupTO.setLastChangeDate(group.getLastChangeDate());
+
+ groupTO.setKey(group.getKey());
+ groupTO.setName(group.getName());
+
+ groupTO.setInheritOwner(group.isInheritOwner());
+
+ groupTO.setInheritTemplates(group.isInheritTemplates());
+
+ groupTO.setInheritPlainAttrs(group.isInheritPlainAttrs());
+ groupTO.setInheritDerAttrs(group.isInheritDerAttrs());
+ groupTO.setInheritVirAttrs(group.isInheritVirAttrs());
+
+ groupTO.setInheritPasswordPolicy(group.isInheritPasswordPolicy());
+ groupTO.setInheritAccountPolicy(group.isInheritAccountPolicy());
+
+ if (group.getParent() != null) {
+ groupTO.setParent(group.getParent().getKey());
+ }
+
+ if (group.getUserOwner() != null) {
+ groupTO.setUserOwner(group.getUserOwner().getKey());
+ }
+ if (group.getGroupOwner() != null) {
+ groupTO.setGroupOwner(group.getGroupOwner().getKey());
+ }
+
+ // -------------------------
+ // Retrieve all [derived/virtual] attributes (inherited and not)
+ // -------------------------
+ final List<? extends GPlainAttr> allAttributes = group.findLastInheritedAncestorPlainAttrs();
+
+ final List<? extends GDerAttr> allDerAttributes = group.findLastInheritedAncestorDerAttrs();
+
+ final List<? extends GVirAttr> allVirAttributes = group.findLastInheritedAncestorVirAttrs();
+ // -------------------------
+
+ fillTO(groupTO, allAttributes, allDerAttributes, allVirAttributes, group.getResources());
+
+ for (Entitlement entitlement : group.getEntitlements()) {
+ groupTO.getEntitlements().add(entitlement.getKey());
+ }
+
+ for (GPlainAttrTemplate template : group.findInheritedTemplates(GPlainAttrTemplate.class)) {
+ groupTO.getGPlainAttrTemplates().add(template.getSchema().getKey());
+ }
+ for (GDerAttrTemplate template : group.findInheritedTemplates(GDerAttrTemplate.class)) {
+ groupTO.getGDerAttrTemplates().add(template.getSchema().getKey());
+ }
+ for (GVirAttrTemplate template : group.findInheritedTemplates(GVirAttrTemplate.class)) {
+ groupTO.getGVirAttrTemplates().add(template.getSchema().getKey());
+ }
+ for (MPlainAttrTemplate template : group.findInheritedTemplates(MPlainAttrTemplate.class)) {
+ groupTO.getMPlainAttrTemplates().add(template.getSchema().getKey());
+ }
+ for (MDerAttrTemplate template : group.findInheritedTemplates(MDerAttrTemplate.class)) {
+ groupTO.getMDerAttrTemplates().add(template.getSchema().getKey());
+ }
+ for (MVirAttrTemplate template : group.findInheritedTemplates(MVirAttrTemplate.class)) {
+ groupTO.getMVirAttrTemplates().add(template.getSchema().getKey());
+ }
+
+ groupTO.setPasswordPolicy(group.getPasswordPolicy() == null
+ ? null
+ : group.getPasswordPolicy().getKey());
+ groupTO.setAccountPolicy(group.getAccountPolicy() == null
+ ? null
+ : group.getAccountPolicy().getKey());
+
+ return groupTO;
+ }
+
+ @Transactional(readOnly = true)
+ @Override
+ public GroupTO getGroupTO(final Long key) {
+ return getGroupTO(groupDAO.authFetch(key));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
index c18e079..ae6d8a8 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
@@ -42,7 +42,7 @@ public class NotificationDataBinderImpl implements NotificationDataBinder {
result.setKey(notification.getKey());
result.setUserAbout(notification.getUserAbout());
- result.setRoleAbout(notification.getRoleAbout());
+ result.setGroupAbout(notification.getGroupAbout());
result.setRecipients(notification.getRecipients());
return result;
@@ -60,7 +60,7 @@ public class NotificationDataBinderImpl implements NotificationDataBinder {
BeanUtils.copyProperties(notificationTO, notification, IGNORE_PROPERTIES);
notification.setUserAbout(notificationTO.getUserAbout());
- notification.setRoleAbout(notificationTO.getRoleAbout());
+ notification.setGroupAbout(notificationTO.getGroupAbout());
notification.setRecipients(notificationTO.getRecipients());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
index ec735b6..1f0e308 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
@@ -29,14 +29,14 @@ import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.PasswordPolicySpec;
import org.apache.syncope.common.lib.types.SyncPolicySpec;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.Policy;
import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -54,7 +54,7 @@ public class PolicyDataBinderImpl implements PolicyDataBinder {
private ExternalResourceDAO resourceDAO;
@Autowired
- private RoleDAO roleDAO;
+ private GroupDAO groupDAO;
@Autowired
private EntityFactory entityFactory;
@@ -102,12 +102,12 @@ public class PolicyDataBinderImpl implements PolicyDataBinder {
policyTO.getUsedByResources().add(resource.getKey());
}
}
- for (Role role : roleDAO.findByPolicy(policy)) {
- policyTO.getUsedByRoles().add(role.getKey());
+ for (Group group : groupDAO.findByPolicy(policy)) {
+ policyTO.getUsedByGroups().add(group.getKey());
}
if (policy.getType().isGlobal()) {
- for (Role role : roleDAO.findWithoutPolicy(policy.getType())) {
- policyTO.getUsedByRoles().add(role.getKey());
+ for (Group group : groupDAO.findWithoutPolicy(policy.getType())) {
+ policyTO.getUsedByGroups().add(group.getKey());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
index 2bf756f..6b5a289 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
@@ -43,8 +43,8 @@ import org.apache.syncope.core.persistence.api.entity.Mapping;
import org.apache.syncope.core.persistence.api.entity.MappingItem;
import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
-import org.apache.syncope.core.persistence.api.entity.role.RMapping;
-import org.apache.syncope.core.persistence.api.entity.role.RMappingItem;
+import org.apache.syncope.core.persistence.api.entity.group.GMapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMappingItem;
import org.apache.syncope.core.persistence.api.entity.user.UMapping;
import org.apache.syncope.core.persistence.api.entity.user.UMappingItem;
import org.apache.syncope.core.provisioning.api.ConnectorRegistry;
@@ -117,13 +117,13 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
resource.setUmapping(mapping);
populateMapping(resourceTO.getUmapping(), mapping, entityFactory.newEntity(UMappingItem.class));
}
- if (resourceTO.getRmapping() == null || resourceTO.getRmapping().getItems().isEmpty()) {
- resource.setRmapping(null);
+ if (resourceTO.getGmapping() == null || resourceTO.getGmapping().getItems().isEmpty()) {
+ resource.setGmapping(null);
} else {
- RMapping mapping = entityFactory.newEntity(RMapping.class);
+ GMapping mapping = entityFactory.newEntity(GMapping.class);
mapping.setResource(resource);
- resource.setRmapping(mapping);
- populateMapping(resourceTO.getRmapping(), mapping, entityFactory.newEntity(RMappingItem.class));
+ resource.setGmapping(mapping);
+ populateMapping(resourceTO.getGmapping(), mapping, entityFactory.newEntity(GMappingItem.class));
}
resource.setCreateTraceLevel(resourceTO.getCreateTraceLevel());
@@ -276,10 +276,10 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
resourceTO.setUmapping(mappingTO);
populateMappingTO(resource.getUmapping(), mappingTO);
}
- if (resource.getRmapping() != null) {
+ if (resource.getGmapping() != null) {
MappingTO mappingTO = new MappingTO();
- resourceTO.setRmapping(mappingTO);
- populateMappingTO(resource.getRmapping(), mappingTO);
+ resourceTO.setGmapping(mappingTO);
+ populateMappingTO(resource.getGmapping(), mappingTO);
}
resourceTO.setEnforceMandatoryCondition(resource.isEnforceMandatoryCondition());
[29/57] syncope git commit: More replacements thanks to
commons-collections
Posted by il...@apache.org.
More replacements thanks to commons-collections
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/101b1071
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/101b1071
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/101b1071
Branch: refs/heads/master
Commit: 101b10711c5a37b4cea4fb615dc056cbe0f6d583
Parents: 678e968
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 7 13:07:02 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 7 13:07:02 2015 +0200
----------------------------------------------------------------------
.../common/lib/to/AbstractSubjectTO.java | 15 --------
.../persistence/jpa/dao/JPAConnInstanceDAO.java | 21 +++++-----
.../persistence/jpa/dao/JPADerSchemaDAO.java | 34 +++++++++--------
.../core/persistence/jpa/dao/JPAGroupDAO.java | 8 ++--
.../persistence/jpa/dao/JPAPlainSchemaDAO.java | 38 ++++++++++---------
.../core/persistence/jpa/dao/JPATaskDAO.java | 19 +++++-----
.../persistence/jpa/dao/JPAVirSchemaDAO.java | 40 +++++++++++---------
.../java/data/ResourceDataBinderImpl.java | 1 -
8 files changed, 88 insertions(+), 88 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/101b1071/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
index 62c83eb..cbc858d 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
@@ -26,8 +26,6 @@ import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Predicate;
@XmlType
public abstract class AbstractSubjectTO extends AbstractAttributableTO {
@@ -45,19 +43,6 @@ public abstract class AbstractSubjectTO extends AbstractAttributableTO {
return resources;
}
- public boolean removePropagationTO(final String resource) {
- if (resource != null && getPropagationStatusTOs().isEmpty()) {
- return CollectionUtils.filterInverse(propagationStatusTOs, new Predicate<PropagationStatus>() {
-
- @Override
- public boolean evaluate(final PropagationStatus propagationStatus) {
- return resource.equals(propagationStatus.getResource());
- }
- });
- }
- return false;
- }
-
@XmlElementWrapper(name = "propagationStatuses")
@XmlElement(name = "propagationStatus")
@JsonProperty("propagationStatuses")
http://git-wip-us.apache.org/repos/asf/syncope/blob/101b1071/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConnInstanceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConnInstanceDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConnInstanceDAO.java
index 8d6fcac..e148b04 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConnInstanceDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConnInstanceDAO.java
@@ -18,10 +18,11 @@
*/
package org.apache.syncope.core.persistence.jpa.dao;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
import javax.persistence.TypedQuery;
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -75,13 +76,15 @@ public class JPAConnInstanceDAO extends AbstractDAO<ConnInstance, Long> implemen
return;
}
- Set<String> resourceNames = new HashSet<>(connInstance.getResources().size());
- for (ExternalResource resource : connInstance.getResources()) {
- resourceNames.add(resource.getKey());
- }
- for (String resourceName : resourceNames) {
- resourceDAO.delete(resourceName);
- }
+ CollectionUtils.forAllDo(new CopyOnWriteArrayList<>(connInstance.getResources()),
+ new Closure<ExternalResource>() {
+
+ @Override
+ public void execute(final ExternalResource input) {
+ resourceDAO.delete(input.getKey());
+ }
+
+ });
entityManager.remove(connInstance);
http://git-wip-us.apache.org/repos/asf/syncope/blob/101b1071/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
index 6e1db3f..18f7e68 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
@@ -18,11 +18,10 @@
*/
package org.apache.syncope.core.persistence.jpa.dao;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import javax.persistence.TypedQuery;
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.core.persistence.api.dao.AttrTemplateDAO;
import org.apache.syncope.core.persistence.api.dao.DerAttrDAO;
@@ -108,21 +107,26 @@ public class JPADerSchemaDAO extends AbstractDAO<DerSchema, String> implements D
return;
}
- final Set<Long> attrIds = new HashSet<>();
- for (DerAttr attr : findAttrs(schema, attributableUtil.derAttrClass())) {
- attrIds.add(attr.getKey());
- }
- for (Long attrId : attrIds) {
- derAttrDAO.delete(attrId, attributableUtil.derAttrClass());
- }
+ CollectionUtils.forAllDo(findAttrs(schema, attributableUtil.derAttrClass()), new Closure<DerAttr>() {
+
+ @Override
+ public void execute(final DerAttr input) {
+ derAttrDAO.delete(input.getKey(), attributableUtil.derAttrClass());
+ }
+
+ });
if (attributableUtil.getType() != AttributableType.USER) {
- for (Iterator<Number> it = attrTemplateDAO.
- findBySchemaName(schema.getKey(), attributableUtil.derAttrTemplateClass()).iterator();
- it.hasNext();) {
+ CollectionUtils.forAllDo(attrTemplateDAO.
+ findBySchemaName(schema.getKey(), attributableUtil.derAttrTemplateClass()).iterator(),
+ new Closure<Number>() {
- attrTemplateDAO.delete(it.next().longValue(), attributableUtil.derAttrTemplateClass());
- }
+ @Override
+ public void execute(final Number input) {
+ attrTemplateDAO.delete(input.longValue(), attributableUtil.derAttrTemplateClass());
+ }
+
+ });
}
resourceDAO.deleteMapping(key, attributableUtil.derIntMappingType(), UMappingItem.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/101b1071/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
index 63e9fc6..9f79e49 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
@@ -102,7 +102,8 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
@Override
public Group find(final Long key) {
- TypedQuery<Group> query = entityManager.createQuery("SELECT e FROM " + JPAGroup.class.getSimpleName() + " e WHERE e.id = :id", Group.class);
+ TypedQuery<Group> query = entityManager.createQuery(
+ "SELECT e FROM " + JPAGroup.class.getSimpleName() + " e WHERE e.id = :id", Group.class);
query.setParameter("id", key);
Group result = null;
@@ -117,7 +118,8 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
@Override
public List<Group> find(final String name) {
- TypedQuery<Group> query = entityManager.createQuery("SELECT e FROM " + JPAGroup.class.getSimpleName() + " e WHERE e.name = :name", Group.class);
+ TypedQuery<Group> query = entityManager.createQuery(
+ "SELECT e FROM " + JPAGroup.class.getSimpleName() + " e WHERE e.name = :name", Group.class);
query.setParameter("name", name);
return query.getResultList();
@@ -196,7 +198,7 @@ public class JPAGroupDAO extends AbstractSubjectDAO<GPlainAttr, GDerAttr, GVirAt
TypedQuery<Group> query = entityManager.createQuery(queryString.toString(), Group.class);
query.setParameter("owner", owner);
- List<Group> result = new ArrayList<Group>();
+ List<Group> result = new ArrayList<>();
for (Group group : query.getResultList()) {
findSameOwnerDescendants(result, group);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/101b1071/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
index b271868..9b3ae5b 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
@@ -18,11 +18,10 @@
*/
package org.apache.syncope.core.persistence.jpa.dao;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import javax.persistence.TypedQuery;
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.core.persistence.api.dao.AttrTemplateDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
@@ -51,7 +50,7 @@ import org.springframework.stereotype.Repository;
public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema, String> implements PlainSchemaDAO {
@Autowired
- private PlainAttrDAO attrDAO;
+ private PlainAttrDAO plainAttrDAO;
@Autowired
private AttrTemplateDAO<PlainSchema> attrTemplateDAO;
@@ -88,7 +87,7 @@ public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema, String> implemen
@Override
public <T extends PlainAttr> List<T> findAttrs(final PlainSchema schema, final Class<T> reference) {
final StringBuilder queryString = new StringBuilder("SELECT e FROM ").
- append(((JPAPlainAttrDAO) attrDAO).getJPAEntityReference(reference).getSimpleName()).
+ append(((JPAPlainAttrDAO) plainAttrDAO).getJPAEntityReference(reference).getSimpleName()).
append(" e WHERE e.");
if (GPlainAttr.class.isAssignableFrom(reference) || MPlainAttr.class.isAssignableFrom(reference)) {
queryString.append("template.");
@@ -114,23 +113,28 @@ public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema, String> implemen
return;
}
- final Set<Long> attrIds = new HashSet<>();
- for (PlainAttr attr : findAttrs(schema, attributableUtil.plainAttrClass())) {
- attrIds.add(attr.getKey());
- }
- for (Long attrId : attrIds) {
- attrDAO.delete(attrId, attributableUtil.plainAttrClass());
- }
+ CollectionUtils.forAllDo(findAttrs(schema, attributableUtil.plainAttrClass()), new Closure<PlainAttr>() {
+
+ @Override
+ public void execute(final PlainAttr input) {
+ plainAttrDAO.delete(input.getKey(), attributableUtil.plainAttrClass());
+ }
+
+ });
if (attributableUtil.getType() == AttributableType.GROUP
|| attributableUtil.getType() == AttributableType.MEMBERSHIP) {
- for (Iterator<Number> it = attrTemplateDAO.
- findBySchemaName(schema.getKey(), attributableUtil.plainAttrTemplateClass()).iterator();
- it.hasNext();) {
+ CollectionUtils.forAllDo(attrTemplateDAO.
+ findBySchemaName(schema.getKey(), attributableUtil.plainAttrTemplateClass()).iterator(),
+ new Closure<Number>() {
- attrTemplateDAO.delete(it.next().longValue(), attributableUtil.plainAttrTemplateClass());
- }
+ @Override
+ public void execute(final Number input) {
+ attrTemplateDAO.delete(input.longValue(), attributableUtil.plainAttrTemplateClass());
+ }
+
+ });
}
resourceDAO.deleteMapping(key, attributableUtil.plainIntMappingType(), UMappingItem.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/101b1071/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java
index a9c9b46..db0d6f2 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java
@@ -18,10 +18,11 @@
*/
package org.apache.syncope.core.persistence.jpa.dao;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.persistence.Query;
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.core.persistence.api.dao.TaskDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
@@ -171,15 +172,13 @@ public class JPATaskDAO extends AbstractDAO<Task, Long> implements TaskDAO {
@Override
public void deleteAll(final ExternalResource resource, final TaskType type) {
- List<Task> tasks = findAll(resource, type);
- if (tasks != null) {
- List<Long> taskIds = new ArrayList<>(tasks.size());
- for (Task task : tasks) {
- taskIds.add(task.getKey());
- }
- for (Long taskId : taskIds) {
- delete(taskId);
+ CollectionUtils.forAllDo(findAll(resource, type), new Closure<Task>() {
+
+ @Override
+ public void execute(final Task input) {
+ delete(input.getKey());
}
- }
+
+ });
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/101b1071/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
index 2da7ef5..873e0c3 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
@@ -18,11 +18,10 @@
*/
package org.apache.syncope.core.persistence.jpa.dao;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import javax.persistence.TypedQuery;
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.syncope.common.lib.types.AttributableType;
import org.apache.syncope.core.persistence.api.dao.AttrTemplateDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
@@ -101,30 +100,35 @@ public class JPAVirSchemaDAO extends AbstractDAO<VirSchema, String> implements V
}
@Override
- public void delete(final String name, final AttributableUtil attributableUtil) {
- final VirSchema schema = find(name, attributableUtil.virSchemaClass());
+ public void delete(final String key, final AttributableUtil attributableUtil) {
+ final VirSchema schema = find(key, attributableUtil.virSchemaClass());
if (schema == null) {
return;
}
- final Set<Long> attrIds = new HashSet<>();
- for (VirAttr attr : findAttrs(schema, attributableUtil.virAttrClass())) {
- attrIds.add(attr.getKey());
- }
- for (Long attrId : attrIds) {
- virAttrDAO.delete(attrId, attributableUtil.virAttrClass());
- }
+ CollectionUtils.forAllDo(findAttrs(schema, attributableUtil.virAttrClass()), new Closure<VirAttr>() {
+
+ @Override
+ public void execute(final VirAttr input) {
+ virAttrDAO.delete(input.getKey(), attributableUtil.virAttrClass());
+ }
+
+ });
if (attributableUtil.getType() != AttributableType.USER) {
- for (Iterator<Number> it = attrTemplateDAO.
- findBySchemaName(schema.getKey(), attributableUtil.virAttrTemplateClass()).iterator();
- it.hasNext();) {
+ CollectionUtils.forAllDo(attrTemplateDAO.
+ findBySchemaName(schema.getKey(), attributableUtil.virAttrTemplateClass()).iterator(),
+ new Closure<Number>() {
- attrTemplateDAO.delete(it.next().longValue(), attributableUtil.virAttrTemplateClass());
- }
+ @Override
+ public void execute(final Number input) {
+ attrTemplateDAO.delete(input.longValue(), attributableUtil.virAttrTemplateClass());
+ }
+
+ });
}
- resourceDAO.deleteMapping(name, attributableUtil.virIntMappingType(), UMappingItem.class);
+ resourceDAO.deleteMapping(key, attributableUtil.virIntMappingType(), UMappingItem.class);
entityManager.remove(schema);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/101b1071/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
index 6b5a289..8823a19 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
@@ -211,7 +211,6 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
SyncopeClientException invalidMandatoryCondition = SyncopeClientException.build(
ClientExceptionType.InvalidValues);
-
invalidMandatoryCondition.getElements().add(itemTO.getMandatoryCondition());
scce.addException(invalidMandatoryCondition);
[22/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage_pt_BR.properties
index 8e00512..69c09fa 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/PushTaskModalPage_pt_BR.properties
@@ -42,4 +42,4 @@ actionsClasses=Classes de a\u00e7\u00f5es
matchingRule=Regra de correspond\u00eancia
unmatchingRule=Regra de non correspond\u00eancia
checkUserFilter=Filtro Usu\u00e1rio
-checkRoleFilter=Filtro Papel
+checkGroupFilter=Filtro Grupo
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage.html
index 2316adc..8f2cdab 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage.html
@@ -28,7 +28,7 @@ under the License.
<ul>
<li class="tabs-selected"><a href="#resource"><span><wicket:message key="resource"/></span></a></li>
<li><a href="#umapping"><span><wicket:message key="umapping"/></span></a></li>
- <li><a href="#rmapping"><span><wicket:message key="rmapping"/></span></a></li>
+ <li><a href="#gmapping"><span><wicket:message key="gmapping"/></span></a></li>
<li><a href="#connectorProperties"><span><wicket:message key="connectorProperties"/></span></a></li>
<li><a href="#security"><span><wicket:message key="security"/></span></a></li>
</ul>
@@ -39,8 +39,8 @@ under the License.
<div id="umapping">
<span wicket:id="umapping">[umapping]</span>
</div>
- <div id="rmapping">
- <span wicket:id="rmapping">[rmapping]</span>
+ <div id="gmapping">
+ <span wicket:id="gmapping">[gmapping]</span>
</div>
<div id="connectorProperties">
<span wicket:id="connconf">[connconf]</span>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage.properties
index 561fe2e..69e6e0a 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage.properties
@@ -27,13 +27,13 @@ title=Resource
extAttrNames=External attributes
intMappingTypes=Internal mapping types
entity=Entity
-roleSchema=Role Schema
+groupSchema=Group Schema
accountId=AccountId
mandatoryCondition=Mandatory
password=Password
purpose=Purpose
mappingUserSchema=Mapping User Schema
-mappingRoleSchema=Mapping Role Schema
+mappingGroupSchema=Mapping Group Schema
delete=Delete
intAttrNames=Internal attributes
enforceMandatoryCondition=Enforce mandatory condition
@@ -55,6 +55,6 @@ success_connection=Successful connection
error_connection=Connection failure
check=Check connection
actionsClasses=Actions classes
-rmapping=Role mapping
+gmapping=Group mapping
new=New
randomPwdIfNotProvided=Generate random passwords when missing
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage_it.properties
index 2223b99..a7b33b8 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage_it.properties
@@ -27,13 +27,13 @@ title=Risorsa
extAttrNames=Attributi esterni
intMappingTypes=Tipo mapping interno
entity=Entità
-roleSchema=Schema Ruolo
+groupSchema=Schema Gruppo
accountId=AccountId
mandatoryCondition=Obbligatorio
password=Password
purpose=Scopo
mappingUserSchema=Mapping User Schema
-mappingRoleSchema=Mapping Role Schema
+mappingGroupSchema=Mapping Group Schema
delete=Rimuovi
intAttrNames=Attributi interni
enforceMandatoryCondition=Abilita mandatory condition
@@ -55,6 +55,6 @@ success_connection=Connessione avvenuta con successo
error_connection=Connessione non riuscita
check=Verifica connessione
actionsClasses=Classi azioni
-rmapping=Mapping ruoli
+gmapping=Mapping gruppi
new=Nuova
randomPwdIfNotProvided=Genera password casuali se mancanti
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage_pt_BR.properties
index a681eb0..be08c73 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ResourceModalPage_pt_BR.properties
@@ -27,13 +27,13 @@ title=Recurso
extAttrNames=Atributos Externos
intMappingTypes=Tipos internos de mapeamentos
entity=Entidade
-roleSchema=Esquema de Fun\u00e7\u00e3o
+groupSchema=Esquema de Grupo
accountId=Identificador da Conta
mandatoryCondition=Obrigat\u00f3rio
password=Senha
purpose=Prop\u00f3sito
mappingUserSchema=Esquema de mapeamento de usu\u00e1rio
-mappingRoleSchema=Esquema de mapeamento de fun\u00e7\u00e3o
+mappingGroupSchema=Esquema de mapeamento de grupo
delete=Excluir
intAttrNames=Atributos internos
enforceMandatoryCondition=Aplicar condi\u00e7\u00e3o obrigat\u00f3ria
@@ -55,6 +55,6 @@ success_connection=Conex\u00e3o com sucesso
error_connection=Conex\u00e3o sem sucesso
check=Verificar a conex\u00e3o
actionsClasses=Classes de a\u00e7\u00f5es
-rmapping=Regra de Mapeamento
+gmapping=Mapeamento de grupos
new=Novo
randomPwdIfNotProvided=Gerar senhas aleat\u00f3rias quando n\u00e3o houver
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage.html
deleted file mode 100644
index 6406807..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage.html
+++ /dev/null
@@ -1,52 +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 style="margin: 5px;">
- <p class="ui-widget ui-corner-all ui-widget-header">
- <wicket:message key="title"/> <span wicket:id="displayName"/>
- </p>
- <form wicket:id="roleForm">
- <div id="tabs">
- <div style="display: block; clear: both">
- <ul>
- <li><a href="#details"><span><wicket:message key="details"/></span></a></li>
- <li><a href="#templates"><span><wicket:message key="templates"/></span></a></li>
- <li><a href="#plainAttrs"><span><wicket:message key="plainAttrs"/></span></a></li>
- <li><a href="#derAttrs"><span><wicket:message key="derAttrs"/></span></a></li>
- <li><a href="#virAttrs"><span><wicket:message key="virAttrs"/></span></a></li>
- <li><a href="#resources"><span><wicket:message key="resources"/></span></a></li>
- <li><a href="#entitlements"><span><wicket:message key="entitlements"/></span></a></li>
- <li><a href="#security"><span><wicket:message key="security"/></span></a></li>
- </ul>
- </div>
- <div wicket:id="rolePanel"></div>
- </div>
- <div style="bottom:0;margin:10px">
- <input type="submit"
- class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
- wicket:id="submit"/>
- <input type="button"
- class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
- wicket:id="cancel"/>
- </div>
- </form>
- </div>
- </wicket:extend>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage.properties
deleted file mode 100644
index a24551c..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage.properties
+++ /dev/null
@@ -1,48 +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.
-required_alert=All form fields are required.
-title=Role
-details=Details
-plainAttrs=Plain attributes
-tab3=Derived attributes
-tab4=Virtual attributes
-resources=Resources
-entitlements=Entitlements
-security=Security
-add=+
-drop=-
-error=Generic error occurred during the operation
-firstResourcesList=Role's resources
-secondResourcesList=Available resources
-firstEntitlementsList=Role's entitlements
-secondEntitlementsList=Available entitlements
-derAttrs=Derived Attributes
-derAttrToRemove=Delete
-derAttrName=Name
-derAttrValue=Derived value
-
-virAttrs=Virtual Attributes
-virAttrToRemove=Delete
-virAttrName=Name
-virAttrValue=Virtual value
-
-addAttributeBtn=Add
-
-inheritPlainAttrs=Inherit plain attributes
-inheritDerAttrs=Inherit derived attributes
-inheritVirAttrs=Inherit virtual attributes
-templates=Templates
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage_it.properties
deleted file mode 100644
index c97fe6f..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage_it.properties
+++ /dev/null
@@ -1,50 +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.
-required_alert=All form fields are required.
-title=Ruolo
-details=Dettagli
-plainAttrs=Attributi normali
-tab3=Attributi derivati
-tab4=Attributi virtuali
-resources=Risorse
-entitlements=Entitlement
-security=Sicurezza
-add=+
-drop=-
-error=Errore generico durante l'operazione
-firstResourcesList=Risorse ruolo
-secondResourcesList=Risorse disponibili
-firstResourcesList=Risorse ruolo
-secondResourcesList=Risorse disponibili
-derAttrs=Attributi derivati
-derAttrToRemove=Elimina
-derAttrName=Nome
-derAttrValue=Valore derivato
-
-virAttrs=Attributi virtuali
-virAttrToRemove=Elimina
-virAttrName=Nome
-virAttrValue=Valore virtuale
-
-addAttributeBtn=Aggiungi
-
-inheritPlainAttrs=Eredita attributi normali
-inheritDerAttrs=Eredita attributi derivati
-inheritVirAttrs=Eredita attributi virtuali
-templates=Modelo
-secondEntitlementsList=Entitlement disponibili
-firstEntitlementsList=Entitlement ruolo
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage_pt_BR.properties
deleted file mode 100644
index 5bff4ed..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleModalPage_pt_BR.properties
+++ /dev/null
@@ -1,48 +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.
-required_alert=Todos os campos s\u00e3o obrigat\u00f3rios
-title=Fun\u00e7\u00e3o
-details=Detalhes
-plainAttrs=Atributos Normal
-tab3=Atributos Derivados
-tab4=Atributos Virtuais
-resources=Recursos
-entitlements=Direitos
-security=Seguran\u00e7a
-add=+
-drop=-
-error=Um erro gen\u00e9rico ocorreu durante a opera\u00e7\u00e3o
-firstResourcesList=Recursos de fun\u00e7\u00f5es
-secondResourcesList=Recursos dispon\u00edveis
-firstEntitlementsList=Direitos de fun\u00e7\u00f5es
-secondEntitlementsList=Direitos dispon\u00edveis
-derAttrs=Atributos derivados
-derAttrToRemove=Exluir
-derAttrName=Nome
-derAttrValue=Valor Derivado
-
-virAttrs=Atributos Virtuais
-virAttrToRemove=Excluir
-virAttrName=Nome
-virAttrValue=Valor Virtual
-
-addAttributeBtn=Adicionar
-
-inheritPlainAttrs=Atributos Herdados Normal
-inheritDerAttrs=Atributos Derivados Herdados
-inheritVirAttrs=Atributos Virtuais Herdados
-templates=Modelli
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleSelectModalPage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleSelectModalPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleSelectModalPage.html
deleted file mode 100644
index 9e9ef59..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/RoleSelectModalPage.html
+++ /dev/null
@@ -1,22 +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.
--->
-<wicket:extend>
- <div wicket:id="treeTable"
- style="width: 100%;display:block;margin:auto;" class="roleTable role-tree"/>
-</wicket:extend>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles.html
deleted file mode 100644
index f8981a9..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles.html
+++ /dev/null
@@ -1,80 +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:head>
- <style>
- div.role-tree div.wicket-tree-table a {
- color:black;
- }
- </style>
- <script type="text/javascript">
- $(document).ready(function() {
- $("#roletabs").tabs();
- });
- </script>
- </wicket:head>
- <wicket:extend>
- <div id="roletabs">
- <ul>
- <li class="tabs-selected">
- <a href="#tabs-tree">
- <span><wicket:message key="tabs-tree"/>
- </span>
- </a>
- </li>
- <li>
- <a href="#tabs-search">
- <span><wicket:message key="tabs-search"/>
- </span>
- </a>
- </li>
- </ul>
-
- <div id="tabs-tree" >
- <div wicket:id="roleTabsContainer">
- <span wicket:id="treePanel"></span>
- <span wicket:id="summaryPanel"></span>
- </div>
- <div wicket:id="editRoleWin">[Show modal window for create/editing role]</div>
- </div>
-
- <div id="tabs-search">
- <div>
- <form wicket:id="searchForm">
- <span wicket:id="searchPanel">searchPanel</span>
-
- <br/>
- <a wicket:id="search"
- class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
- <img src="img/search.png" alt="search"/>
- <wicket:message key="search"/>
- </a>
- </form>
- </div>
-
- <div id="users-contain" class="ui-widget" style="width:auto">
- <span wicket:id="searchResult">[search result]</span>
- </div>
- </div>
-
- </div>
-
- <wicket:child/>
- </wicket:extend>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles.properties
deleted file mode 100644
index bfe9385..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles.properties
+++ /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.
-tabs-tree=Tree
-tabs-search=Search
-search=Search
-create_user=Create new user
-search_results_title=Search results
-search_noResults=No matches found.
-reset=Reset
-showingFrom=Showing
-showingTo=to
-showingOf=of
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles_it.properties
deleted file mode 100644
index 76e69f7..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles_it.properties
+++ /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.
-tabs-tree=Albero
-tabs-search=Ricerca
-search=Cerca
-create_user=Crea nuovo utente
-search_results_title=Risultati ricerca:
-search_noResults=Nessuna corrispondenza trovata.
-reset=Reset
-showingFrom=Risultati da
-showingTo=a
-showingOf=di
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles_pt_BR.properties
deleted file mode 100644
index 8d80401..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Roles_pt_BR.properties
+++ /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.
-tabs-tree=\u00C1rvore
-tabs-search=Buscar
-search=Buscar
-create_user=Criar novo usu\u00E1rio
-search_results_title=Resultados da busca
-search_noResults=N\u00E3o foram encontrados resultados
-reset=Resetar
-showingFrom=Mostrando
-showingTo=para
-showingOf=de
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema.html
index de6d1e2..af0b83f 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema.html
@@ -38,7 +38,7 @@ under the License.
<li class="tabs-selected"><a href="#cschema"><wicket:message key="configuration"/></a></li>
<li><a href="#uschema"><wicket:message key="user"/></a></li>
<li><a href="#mschema"><wicket:message key="membership"/></a></li>
- <li><a href="#rschema"><wicket:message key="role"/></a></li>
+ <li><a href="#gschema"><wicket:message key="group"/></a></li>
</ul>
<div id="cschema">
@@ -50,8 +50,8 @@ under the License.
<div id="mschema">
<div wicket:id="membershipTabs"/>
</div>
- <div id="rschema">
- <div wicket:id="roleTabs"/>
+ <div id="gschema">
+ <div wicket:id="groupTabs"/>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema.properties
index e103028..920d29c 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
user=User
-role=Role
+group=Group
membership=Membership
required_alert=All fields are required
mandatory=Mandatory
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema_it.properties
index b95da78..186b540 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema_it.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
user=Utente
-role=Ruolo
+group=Gruppo
membership=Membership
required_alert=Tutti i campi sono richiesti.
mandatory=Obbligatorio
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema_pt_BR.properties
index 994d485..8c41db6 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Schema_pt_BR.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
user=Usu\u00e1rio
-role=Fun\u00e7\u00e3o
+group=Grupo
membership=Membro
required_alert=Todos os campos s\u00e3o requeridos
mandatory=Obrigat\u00f3rio
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage.properties
index 7667bc5..9cb9c55 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage.properties
@@ -23,14 +23,14 @@ tab2=Plain attributes
tab3=Derived attributes
tab4=Virtual attributes
tab5=Resources
-tab6=Roles
+tab6=Groups
add=+
drop=-
resources=Resources transfer
firstResourcesList=User's resources
secondResourcesList=Available resources
updating_error=Generic error occurred during updating
-column1=Roles
+column1=Groups
column2=Action
edit=Edit
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage_it.properties
index ec550c3..454a171 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage_it.properties
@@ -23,14 +23,14 @@ tab2=Attributi normali
tab3=Attributi derivati
tab4=Attributi virtuali
tab5=Risorse
-tab6=Ruoli
+tab6=Gruppi
add=+
drop=-
resources=Associazione risorse
firstResourcesList=Risorse utente
secondResourcesList=Risorse disponibili
updating_error=Errore generico durante l'aggiornamento
-column1=Ruoli
+column1=Gruppi
column2=Azioni
edit=Modifica
delete=Rimuovi
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage_pt_BR.properties
index d5d26a9..8486112 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/UserModalPage_pt_BR.properties
@@ -23,14 +23,14 @@ tab2=Atributos Normal
tab3=Atriutos Derivados
tab4=Atributos Virtuais
tab5=Recursos
-tab6=Fun\u00e7\u00f5es
+tab6=Grupos
add=+
drop=-
resources=Transfer\u00eancia de Recursos
firstResourcesList=Recursos de usu\u00e1rio
secondResourcesList=Recursos Dispon\u00edveis
updating_error=Um erro gern\u00e9rico ocorreu durante a atualiza\u00e7\u00e3o
-column1=Fun\u00e7\u00f5es
+column1=Grupos
column2=A\u00e7\u00e3o
edit=Alterar
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/pages/WelcomePage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/WelcomePage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/WelcomePage.html
index 4e0e5a0..938ecc4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/WelcomePage.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/WelcomePage.html
@@ -57,7 +57,7 @@ under the License.
<li><a href="#" wicket:id="todo" class="todo"><img wicket:id="todoIcon" alt="TODO" width="80" height="80" /><br /><wicket:message key="todo"/></a></li>
<li><a href="#" wicket:id="schema" class="schema"><img wicket:id="schemaIcon" alt="Schema" width="80" height="80" /><br /><wicket:message key="schema"/></a></li>
<li><a href="#" wicket:id="users" class="users"><img wicket:id="usersIcon" alt="Users" width="80" height="80" /><br /><wicket:message key="users"/></a></li>
- <li><a href="#" wicket:id="roles" class="roles"><img wicket:id="rolesIcon" alt="Roles" width="80" height="80" /><br /><wicket:message key="roles"/></a></li>
+ <li><a href="#" wicket:id="groups" class="groups"><img wicket:id="groupsIcon" alt="Groups" width="80" height="80" /><br /><wicket:message key="groups"/></a></li>
<li><a href="#" wicket:id="resources" class="resources"><img wicket:id="resourcesIcon" alt="Resources" width="80" height="80" /><br /><wicket:message key="resources"/></a></li>
<li><a href="#" wicket:id="tasks" class="tasks"><img wicket:id="tasksIcon" alt="Tasks" width="80" height="80" /><br /><wicket:message key="tasks"/></a></li>
<li><a href="#" wicket:id="reports" class="reports"><img wicket:id="reportsIcon" alt="Reports" width="80" height="80" /><br /><wicket:message key="reports"/></a></li>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/AttrTemplatesPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AttrTemplatesPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AttrTemplatesPanel.html
index 9049435..2b7ef52 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AttrTemplatesPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AttrTemplatesPanel.html
@@ -36,13 +36,13 @@ under the License.
</ul>
<div id="rplainattr">
- <div wicket:id="rPlainAttrTemplates"/>
+ <div wicket:id="gPlainAttrTemplates"/>
</div>
<div id="rderattr">
- <div wicket:id="rDerAttrTemplates"/>
+ <div wicket:id="gDerAttrTemplates"/>
</div>
<div id="rvirattr">
- <div wicket:id="rVirAttrTemplates"/>
+ <div wicket:id="gVirAttrTemplates"/>
</div>
<div id="mplainattr">
<div wicket:id="mPlainAttrTemplates"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel.html
new file mode 100644
index 0000000..42bf48f
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel.html
@@ -0,0 +1,107 @@
+<!--
+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 id="formtable">
+ <span wicket:id="parent">[parent]</span>
+
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <wicket:message key="name"/>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="name"/>
+ <a class="tooltips" wicket:id="questionMarkJexlHelp" href="#" alt="Click to help" title="Click to help">
+ <img src="img/help.png"/>
+ <span wicket:id="jexlHelp" class="tooltips">
+ <wicket:message key="jexl_info"/>
+ <ul>
+ <li><wicket:message key="jexl_ex1"/></li>
+ <li><wicket:message key="jexl_ex2"/></li>
+ </ul>
+ <a href="#" wicket:id="jexlLink" target="_blank"><wicket:message key="jexl_syntax_url"/></a>
+ </span>
+ </a>
+ </div>
+ </div>
+
+ <div class="tablerow alt">
+ <div class="tablecolumn_label short_dynamicsize">
+ <wicket:message key="inheritOwner"/>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="inheritOwner"/>
+ </div>
+ </div>
+
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <wicket:message key="inheritTemplates"/>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="inheritTemplates"/>
+ </div>
+ </div>
+
+ <div wicket:id="ownerContainer">
+ <div class="tablerow alt">
+ <div class="tablecolumn_label short_dynamicsize">
+ <wicket:message key="userOwner"/>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="userOwner"/>
+ <a href="#" wicket:id="userOwnerSelect"><img src="img/actions/search.png" alt="select user owner" title="Search"/></a>
+ <a href="#" wicket:id="userOwnerReset"><img src="img/actions/delete.png" alt="reset user owner" title="Delete"/></a>
+ </div>
+ </div>
+
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <wicket:message key="groupOwner"/>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="groupOwner"/>
+ <a href="#" wicket:id="groupOwnerSelect"><img src="img/actions/search.png" alt="select group owner" title="Search"/></a>
+ <a href="#" wicket:id="groupOwnerReset"><img src="img/actions/delete.png" alt="reset group owner" title="Delete"/></a>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <span wicket:id="parentSelectWin"/>
+ <span wicket:id="userOwnerSelectWin"/>
+ <span wicket:id="groupOwnerSelectWin"/>
+
+ <wicket:fragment wicket:id="parentFragment">
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <wicket:message key="parent"/>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="parent"/>
+ <a href="#" wicket:id="parentSelect"><img src="img/actions/search.png" alt="select group parent" title="Search"/></a>
+ <a href="#" wicket:id="parentReset"><img src="img/actions/delete.png" alt="reset group parent" title="Delete"/></a>
+ </div>
+ </div>
+ </wicket:fragment>
+
+ <wicket:fragment wicket:id="emptyFragment">
+ </wicket:fragment>
+ </wicket:panel>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel.properties
new file mode 100644
index 0000000..52581e5
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+name=Name
+userOwner=Owner (user)
+groupOwner=Owner (group)
+inheritOwner=Inherit owner
+parent=Parent
+inheritTemplates=Inherit templates
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel_it.properties
new file mode 100644
index 0000000..f7fbc02
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel_it.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+name=Nome
+userOwner=Proprietario (utente)
+groupOwner=Proprietario (gruppo)
+inheritOwner=Eredita proprietario
+parent=Padre
+inheritTemplates=Eredita modelli
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel_pt_BR.properties
new file mode 100644
index 0000000..772fc4e
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupDetailsPanel_pt_BR.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+name=Nome
+userOwner=Dono (usu\u00e1rio)
+groupOwner=Dono (grupo)
+inheritOwner=Dono herdado
+parent=Parente
+inheritTemplates=Modelo herdado
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel.html
new file mode 100644
index 0000000..5783350
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel.html
@@ -0,0 +1,88 @@
+<!--
+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 id="details">
+ <span wicket:id="details">[group details]</span>
+ <span wicket:id="statuspanel">[Status Panel]</span>
+ <span wicket:id="systeminformation">[System Information]</span>
+ </div>
+
+ <div id="templates">
+ <span wicket:id="templates">[templates]</span>
+ </div>
+
+ <div id="plainAttrs">
+ <div id="formtable">
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <wicket:message key="inheritPlainAttrs"/>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="inheritPlainAttrs" />
+ </div>
+ </div>
+
+ <span wicket:id="plainAttrs">[group attributes]</span>
+ </div>
+ </div>
+
+ <div id="derAttrs">
+ <div id="formtable">
+ <div class="tablerow alt">
+ <div class="tablecolumn_label short_dynamicsize">
+ <wicket:message key="inheritDerAttrs"/>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="inheritDerAttrs" />
+ </div>
+ </div>
+
+ <span wicket:id="derAttrs">[group derived attributes]</span>
+ </div>
+ </div>
+
+ <div id="virAttrs">
+ <div id="formtable">
+ <div class="tablerow alt">
+ <div class="tablecolumn_label short_dynamicsize">
+ <wicket:message key="inheritVirAttrs"/>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="inheritVirAttrs" />
+ </div>
+ </div>
+
+ <span wicket:id="virAttrs">[group virtual attributes]</span>
+ </div>
+ </div>
+
+ <div id="resources">
+ <span wicket:id="resources">[resources]</span>
+ </div>
+ <div id="entitlements">
+ <span wicket:id="entitlements">[entitlements]</span>
+ </div>
+ <div id="security">
+ <span wicket:id="security">[security]</span>
+ </div>
+
+ </wicket:panel>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel.properties
new file mode 100644
index 0000000..195f8ed
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel.properties
@@ -0,0 +1,51 @@
+# 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.
+required_alert=All form fields are required.
+add=+
+drop=-
+error=Generic error occurred during the operation
+name=Name
+firstResourcesList=Group's resources
+secondResourcesList=Available resources
+firstEntitlementsList=Group's entitlements
+secondEntitlementsList=Available entitlements
+
+addAttributeBtn=Add
+required_alert=All form fields are required.
+add=+
+drop=-
+error=Generic error occurred during the operation
+name=Name
+firstResourcesList=Group's resources
+secondResourcesList=Available resources
+firstEntitlementsList=Group's entitlements
+secondEntitlementsList=Available entitlements
+derAttrs=Derived Attributes
+derAttrToRemove=Delete
+derAttrName=Name
+derAttrValue=Derived value
+
+virAttrs=Virtual Attributes
+virAttrToRemove=Delete
+virAttrName=Name
+virAttrValue=Virtual value
+
+addAttributeBtn=Add
+
+inheritPlainAttrs=Inherit plain attributes
+inheritDerAttrs=Inherit derived attributes
+inheritVirAttrs=Inherit virtual attributes
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel_it.properties
new file mode 100644
index 0000000..7dda4fb
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel_it.properties
@@ -0,0 +1,53 @@
+# 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.
+required_alert=All form fields are required.
+add=+
+drop=-
+name=Nome
+error=Errore generico durante l'operazione
+firstResourcesList=Risorse ruolo
+secondResourcesList=Risorse disponibili
+firstResourcesList=Entitlement ruolo
+secondResourcesList=Entitlement disponibili
+
+addAttributeBtn=Aggiungi
+required_alert=Tutti i valori sono richiesti.
+add=+
+drop=-
+name=Nome
+error=Errore generico durante l'operazione
+firstResourcesList=Risorse ruolo
+secondResourcesList=Risorse disponibili
+firstResourcesList=Risorse gruppo
+secondResourcesList=Risorse disponibili
+derAttrs=Attributi derivati
+derAttrToRemove=Rimuovi
+derAttrName=Nome
+derAttrValue=Valore derivato
+
+virAttrs=Attributi virtuali
+virAttrToRemove=Rimuovi
+virAttrName=Nome
+virAttrValue=Valore virtuale
+
+addAttributeBtn=Aggiungi
+
+inheritPlainAttrs=Eredita attributi normali
+inheritDerAttrs=Eredita attributi derivati
+inheritVirAttrs=Eredita attributi virtuali
+firstEntitlementsList=Entitlement grupo
+secondEntitlementsList=Entitlement disponibili
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel_pt_BR.properties
new file mode 100644
index 0000000..e74968a
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupPanel_pt_BR.properties
@@ -0,0 +1,40 @@
+# 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.
+required_alert=Todos os campos s\u00e3o obrigat\u00f3rios
+add=+
+drop=-
+error=Um erro gen\u00e9rico ocorreu durante a opera\u00e7\u00e3o
+name=Nome
+firstResourcesList=Recursos de Grupo
+secondResourcesList=Recursos Dipon\u00edveis
+firstEntitlementsList=Direitos de Grupo
+secondEntitlementsList=Direitos Dispon\u00edveis
+derAttrs=Atributos Derivados
+derAttrToRemove=Remover
+derAttrName=Nome
+derAttrValue=Valor Derivado
+
+virAttrs=Atributos Virtuais
+virAttrToRemove=Remover
+virAttrName=Nome
+virAttrValue=Valor Virtual
+
+addAttributeBtn=Adicionar
+
+inheritPlainAttrs=Atributos Herdados Normal
+inheritDerAttrs=Atributos Herdados Derivados
+inheritVirAttrs=Atributos Virtuais Herdados
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel.html
new file mode 100644
index 0000000..61b609e
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel.html
@@ -0,0 +1,66 @@
+<!--
+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 id="formtable" wicket:id="security">
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <label for="inheritPasswordPolicy"><wicket:message key="inheritPasswordPolicy"/></label>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="inheritPasswordPolicy">
+ [panel for dynamic input type markup]
+ </span>
+ </div>
+ </div>
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <label for="passwordPolicy"><wicket:message key="passwordPolicy"/></label>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="passwordPolicy">
+ [panel for dynamic input type markup]
+ </span>
+ </div>
+ </div>
+
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <label for="inheritAccountPolicy"><wicket:message key="inheritAccountPolicy"/></label>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="inheritAccountPolicy">
+ [panel for dynamic input type markup]
+ </span>
+ </div>
+ </div>
+
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <label for="accountPolicy"><wicket:message key="accountPolicy"/></label>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="accountPolicy">
+ [panel for dynamic input type markup]
+ </span>
+ </div>
+ </div>
+ </div>
+ </wicket:panel>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel.properties
new file mode 100644
index 0000000..167673d
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel.properties
@@ -0,0 +1,20 @@
+# 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.
+inheritPasswordPolicy = Inherit password policy
+inheritAccountPolicy = Inherit account policy
+passwordPolicy = Password Policy
+accountPolicy = Account Policy
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel_it.properties
new file mode 100644
index 0000000..6e7c6ed
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel_it.properties
@@ -0,0 +1,20 @@
+# 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.
+inheritPasswordPolicy = Eredita password policy
+inheritAccountPolicy = Eredita account policy
+passwordPolicy = Password Policy
+accountPolicy = Account Policy
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel_pt_BR.properties
new file mode 100644
index 0000000..5c77adc
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSecurityPanel_pt_BR.properties
@@ -0,0 +1,20 @@
+# 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.
+inheritPasswordPolicy = Pol\u00EDtica de Senha Herdada
+inheritAccountPolicy = Pol\u00EDtica de Conta Herdada
+passwordPolicy = Pol\u00EDtica de Senha
+accountPolicy = Pol\u00EDtica de Conta
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSummaryPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSummaryPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSummaryPanel.html
new file mode 100644
index 0000000..39eead2
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupSummaryPanel.html
@@ -0,0 +1,39 @@
+<!--
+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>
+
+ <span wicket:id="groupSummaryPanel">[Group panel]</span>
+
+ <wicket:fragment wicket:id="groupViewPanel">
+ <span wicket:id="nodeViewPanel"></span>
+ </wicket:fragment>
+
+ <wicket:fragment wicket:id="rootPanel">
+ <div style="float:left; width:70%;">
+ <p style="height:15px; margin-top: 0px;" class="ui-widget ui-corner-all ui-widget-header">
+ <span style="float:right;" wicket:id="actionLinks"/>
+ </p>
+ </div>
+ </wicket:fragment>
+
+ <wicket:fragment wicket:id="fakerootFrag">
+ </wicket:fragment>
+ </wicket:panel>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel.html
new file mode 100644
index 0000000..a05da39
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel.html
@@ -0,0 +1,64 @@
+<!--
+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 style="float:left; width:70%;">
+ <script type="text/javascript">
+ $(document).ready(function () {
+ $("div form #tabs").tabs();
+ });
+ $(document).ready(function () {
+ $("div form #tabs #templates").tabs();
+ });
+ </script>
+ <p style="height:15px; margin-top: 0px;" class="ui-widget ui-corner-all ui-widget-header">
+ <wicket:message key="title"/>
+ <span wicket:id="displayName"/>
+ <span style="float:right;" wicket:id="actionLinks"/>
+ </p>
+
+ <form wicket:id="groupForm">
+ <div id="tabs" style="margin: 0px;">
+ <ul>
+ <li><a href="#details"><span><wicket:message key="details"/></span></a></li>
+ <li><a href="#templates"><span><wicket:message key="templates"/></span></a></li>
+ <li><a href="#plainAttrs"><span><wicket:message key="plainAttrs"/></span></a></li>
+ <li><a href="#derAttrs"><span><wicket:message key="derAttrs"/></span></a></li>
+ <li><a href="#virAttrs"><span><wicket:message key="virAttrs"/></span></a></li>
+ <li><a href="#resources"><span><wicket:message key="resources"/></span></a></li>
+ <li><a href="#entitlements"><span><wicket:message key="entitlements"/></span></a></li>
+ <li><a href="#security"><span><wicket:message key="security"/></span></a></li>
+ <li><a href="#users"><span><wicket:message key="users"/></span></a></li>
+ </ul>
+ <div wicket:id="groupPanel">
+ </div>
+ <div id="users">
+ <div wicket:id="userListContainer">
+ <input type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
+ wicket:id="search"/>
+ <div id="users-contain" class="ui-widget" style="width:auto">
+ <span wicket:id="userList"> [userList] </span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </form>
+ </div>
+ </wicket:panel>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel.properties
new file mode 100644
index 0000000..4ee3e36
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel.properties
@@ -0,0 +1,27 @@
+# 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.
+title=Group
+details=Details
+plainAttrs=Plain attributes
+derAttrs=Derived attributes
+virAttrs=Virtual attributes
+resources=Resources
+entitlements=Entitlements
+security=Security
+users=Users
+search=Get Users
+templates=Templates
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel_it.properties
new file mode 100644
index 0000000..61e0772
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel_it.properties
@@ -0,0 +1,27 @@
+# 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.
+title=Gruppo
+details=Dettagli
+plainAttrs=Attributi normali
+derAttrs=Attributi derivati
+virAttrs=Attributi virtuali
+resources=Risorse
+entitlements=Entitlement
+security=Sicurezza
+users=Utenti
+search=Lista Utenti
+templates=Modelli
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel_pt_BR.properties
new file mode 100644
index 0000000..7e751b2
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupTabPanel_pt_BR.properties
@@ -0,0 +1,27 @@
+# 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.
+title=Grupo
+details=Detalhes
+plainAttrs=Atributos Normal
+derAttrs=Atributos Derivados
+virAttrs=Atributos Virtuais
+resources=Recursos
+entitlements=Direitos
+security=Seguran\u00e7a
+users=Usu\u00e1rios
+search=Obter Usu\u00e1rios
+templates=Modelo
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel.html
index 684225b..cac787d 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel.html
@@ -22,7 +22,7 @@ under the License.
<wicket:message key="membership_availability"/>
</p>
- <div wicket:id="treeTable" style="float: left; width: 100%; margin:auto;" class="role-tree roleTable"/>
+ <div wicket:id="treeTable" style="float: left; width: 100%; margin:auto;" class="group-tree groupTable"/>
<div style="float: left; width: 100%;">
<p class="ui-widget ui-corner-all ui-widget-header"><wicket:message key="membership_text"/></p>
@@ -41,10 +41,10 @@ under the License.
<tbody>
<tr wicket:id="memberships">
<td>
- <span wicket:id="roleId"/>
+ <span wicket:id="groupId"/>
</td>
<td>
- <span wicket:id="roleName"/>
+ <span wicket:id="groupName"/>
</td>
<td>
<a href="#" wicket:id="editLink">
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel.properties
index 11b0de6..16b7c36 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel.properties
@@ -14,10 +14,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-id=Role Id
-name=Role Name
+id=Group Id
+name=Group Name
edit=Edit
delete=Delete
-membership_availability=Available roles
-membership_text=Selected roles
+membership_availability=Available groups
+membership_text=Selected groups
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel_it.properties
index e5751ae..86864a1 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel_it.properties
@@ -14,11 +14,11 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-id=Id Ruolo
+id=Id Gruppo
edit=Modifica
delete=Rimuovi
-name=Nome Ruolo
+name=Nome Gruppo
-membership_availability=Ruoli disponibili
-membership_text=Ruoli selezionati
+membership_availability=Gruppi disponibili
+membership_text=Gruppi selezionati
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel_pt_BR.properties
index b9ed029..5a41e98 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/MembershipsPanel_pt_BR.properties
@@ -14,10 +14,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-id=Identificador da Fun\u00E7\u00E3o
-name=Nome da Fun\u00E7\u00E3o
+id=Identificador da Grupo
+name=Nome da Grupo
edit=Alterar
delete=Excluir
-membership_availability=Fun\u00E7\u00F5es dispon\u00EDveis
-membership_text=Fun\u00E7\u00F5es selecionadas
+membership_availability=Grupos dispon\u00edveis
+membership_text=Grupos selecionadas
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel.html
deleted file mode 100644
index bd04c97..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel.html
+++ /dev/null
@@ -1,107 +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 id="formtable">
- <span wicket:id="parent">[parent]</span>
-
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <wicket:message key="name"/>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="name"/>
- <a class="tooltips" wicket:id="questionMarkJexlHelp" href="#" alt="Click to help" title="Click to help">
- <img src="img/help.png"/>
- <span wicket:id="jexlHelp" class="tooltips">
- <wicket:message key="jexl_info"/>
- <ul>
- <li><wicket:message key="jexl_ex1"/></li>
- <li><wicket:message key="jexl_ex2"/></li>
- </ul>
- <a href="#" wicket:id="jexlLink" target="_blank"><wicket:message key="jexl_syntax_url"/></a>
- </span>
- </a>
- </div>
- </div>
-
- <div class="tablerow alt">
- <div class="tablecolumn_label short_dynamicsize">
- <wicket:message key="inheritOwner"/>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="inheritOwner"/>
- </div>
- </div>
-
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <wicket:message key="inheritTemplates"/>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="inheritTemplates"/>
- </div>
- </div>
-
- <div wicket:id="ownerContainer">
- <div class="tablerow alt">
- <div class="tablecolumn_label short_dynamicsize">
- <wicket:message key="userOwner"/>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="userOwner"/>
- <a href="#" wicket:id="userOwnerSelect"><img src="img/actions/search.png" alt="select user owner" title="Search"/></a>
- <a href="#" wicket:id="userOwnerReset"><img src="img/actions/delete.png" alt="reset user owner" title="Delete"/></a>
- </div>
- </div>
-
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <wicket:message key="roleOwner"/>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="roleOwner"/>
- <a href="#" wicket:id="roleOwnerSelect"><img src="img/actions/search.png" alt="select role owner" title="Search"/></a>
- <a href="#" wicket:id="roleOwnerReset"><img src="img/actions/delete.png" alt="reset role owner" title="Delete"/></a>
- </div>
- </div>
- </div>
- </div>
-
- <span wicket:id="parentSelectWin"/>
- <span wicket:id="userOwnerSelectWin"/>
- <span wicket:id="roleOwnerSelectWin"/>
-
- <wicket:fragment wicket:id="parentFragment">
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <wicket:message key="parent"/>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="parent"/>
- <a href="#" wicket:id="parentSelect"><img src="img/actions/search.png" alt="select role parent" title="Search"/></a>
- <a href="#" wicket:id="parentReset"><img src="img/actions/delete.png" alt="reset role parent" title="Delete"/></a>
- </div>
- </div>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="emptyFragment">
- </wicket:fragment>
- </wicket:panel>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel.properties
deleted file mode 100644
index b729c65..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RoleDetailsPanel.properties
+++ /dev/null
@@ -1,22 +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.
-name=Name
-userOwner=Owner (user)
-roleOwner=Owner (role)
-inheritOwner=Inherit owner
-parent=Parent
-inheritTemplates=Inherit templates