diff --git a/demo/complex/grouper_data/container_files/seed-data/demo.gsh b/demo/complex/grouper_data/container_files/seed-data/demo.gsh index 61bfd08..e584add 100644 --- a/demo/complex/grouper_data/container_files/seed-data/demo.gsh +++ b/demo/complex/grouper_data/container_files/seed-data/demo.gsh @@ -7,6 +7,7 @@ addStem("", "basis", "basis") addStem("", "bundle", "bundle") addStem("", "org", "org") addStem("", "test", "test") +addStem("", "midpoint", "midpoint") addRootStem("ref", "ref") addStem("ref", "course", "course") @@ -71,9 +72,8 @@ attributeAssign.getAttributeValueDelegate().assignValue(LoaderLdapUtils.grouperL attributeAssign.getAttributeValueDelegate().assignValue(LoaderLdapUtils.grouperLoaderLdapSubjectAttributeName(), "uniqueMember"); attributeAssign.getAttributeValueDelegate().assignValue(LoaderLdapUtils.grouperLoaderLdapSubjectIdTypeName(), "subjectId"); -testGroup = new GroupSave(gs).assignName("etc:testGroup").assignCreateParentStemsIfNotExist(true).save(); - -exportedGroups = new GroupSave(gs).assignName("etc:exportedGroups").assignCreateParentStemsIfNotExist(true).save(); +midpointGroupsGroup = new GroupSave(gs).assignName("etc:midpointGroups").assignCreateParentStemsIfNotExist(true).save(); +testGroup = new GroupSave(gs).assignName("midpoint:test").assignCreateParentStemsIfNotExist(true).save(); s = SubjectFinder.findById(testGroup.getId(), 'group', 'g:gsa'); -exportedGroups.addMember(s, false); +midpointGroupsGroup.addMember(s, false); diff --git a/demo/complex/midpoint-objects-manual/tasks/task-async-update-grouper.xml b/demo/complex/midpoint-objects-manual/tasks/task-async-update-grouper.xml new file mode 100644 index 0000000..750ddc5 --- /dev/null +++ b/demo/complex/midpoint-objects-manual/tasks/task-async-update-grouper.xml @@ -0,0 +1,43 @@ + + + + Grouper async updates + + + + 1552664339630-0-2 + + + + runnable + AsynchronousUpdate + http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/async-update/handler-3 + + + + single + loose + restart + diff --git a/demo/complex/midpoint-objects-manual/tasks/task-import-grouper.xml b/demo/complex/midpoint-objects-manual/tasks/task-import-grouper.xml deleted file mode 100644 index 3da3f02..0000000 --- a/demo/complex/midpoint-objects-manual/tasks/task-import-grouper.xml +++ /dev/null @@ -1,26 +0,0 @@ - - Import from Grouper - - account - ri:AccountObjectClass - - 1535468542646-0-1 - - runnable - ImportingAccounts - http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/import/handler-3 - - single - loose - diff --git a/demo/complex/midpoint-objects-manual/tasks/task-livesync-grouper.xml b/demo/complex/midpoint-objects-manual/tasks/task-livesync-grouper.xml deleted file mode 100644 index 23e4b4c..0000000 --- a/demo/complex/midpoint-objects-manual/tasks/task-livesync-grouper.xml +++ /dev/null @@ -1,32 +0,0 @@ - - LiveSync from Grouper - - account - ri:AccountObjectClass - - 1535465478027-0-1 - - runnable - LiveSynchronization - http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3 - - recurring - - 60 - - loose - diff --git a/demo/complex/midpoint-objects-manual/tasks/task-reconciliation-grouper-groups.xml b/demo/complex/midpoint-objects-manual/tasks/task-reconciliation-grouper-groups.xml new file mode 100644 index 0000000..6dd7321 --- /dev/null +++ b/demo/complex/midpoint-objects-manual/tasks/task-reconciliation-grouper-groups.xml @@ -0,0 +1,43 @@ + + + + Grouper reconciliation (groups) + + ri:GroupObjectClass + + 605a0127-a313-442a-9d5e-151eac8b0745 + + + + runnable + Reconciliation + http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/reconciliation/handler-3 + + + + single + loose + restart + diff --git a/demo/complex/midpoint-objects-manual/tasks/task-reconciliation-grouper-users.xml b/demo/complex/midpoint-objects-manual/tasks/task-reconciliation-grouper-users.xml new file mode 100644 index 0000000..48cb622 --- /dev/null +++ b/demo/complex/midpoint-objects-manual/tasks/task-reconciliation-grouper-users.xml @@ -0,0 +1,43 @@ + + + + Grouper reconciliation (users) + + ri:AccountObjectClass + + 42aa9f43-64c5-41a6-814c-b58b9ea4e204 + + + + runnable + Reconciliation + http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/reconciliation/handler-3 + + + + single + loose + restart + diff --git a/demo/complex/midpoint-objects/resources/function-library-grouper.xml b/demo/complex/midpoint-objects/resources/function-library-grouper.xml new file mode 100644 index 0000000..f3cfdc8 --- /dev/null +++ b/demo/complex/midpoint-objects/resources/function-library-grouper.xml @@ -0,0 +1,156 @@ + + + + grouper + Functions for Grouper AMQP connector + + + + + + createUcfChange + + message + c:AsyncUpdateMessageType + + + superGroup + xsd:string + + + exportedGroupPrefix + xsd:string + + + relevantSourceId + xsd:string + + + c:UcfChangeType + + diff --git a/demo/complex/midpoint-objects/resources/resource-grouper.xml b/demo/complex/midpoint-objects/resources/resource-grouper.xml new file mode 100644 index 0000000..c67f5ee --- /dev/null +++ b/demo/complex/midpoint-objects/resources/resource-grouper.xml @@ -0,0 +1,210 @@ + + + + + + Grouper Resource + + + + connectorType + com.evolveum.polygon.connector.grouper.rest.GrouperConnector + + + + + + grouper_ws:443 + banderson + password + etc:midpointGroups + midpoint + ldap + true + + + + AMQP async update connector + + + + connectorType + AsyncUpdateConnector + + + + + + + amqp://mq:5672 + guest + guest + sampleQueue + + + + + + + + + + account + subject + ri:AccountObjectClass + true + + icfs:name + + + name + + + + + ri:group + + + organizationalUnit + + + + + + entitlement + group + ri:GroupObjectClass + true + + icfs:name + + + name + + + + + + + + true + account + subject + ri:AccountObjectClass + UserType + + + name + + + $account/attributes/name + + + + + + linked + true + + + deleted + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus + + + + + true + entitlement + group + ri:GroupObjectClass + OrgType + + + name + + + $account/attributes/name + + + + + + linked + true + + + deleted + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteFocus + + + + unlinked + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus + + + + + + passive + + diff --git a/demo/complex/midpoint-objects/resources/scriptedsql-grouper2.xml b/demo/complex/midpoint-objects/resources/scriptedsql-grouper2.xml deleted file mode 100644 index 250ddb1..0000000 --- a/demo/complex/midpoint-objects/resources/scriptedsql-grouper2.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - - - Grouper SQL/MQ - - - - - connectorType - net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector - - - - - - - - grouper_data - 3306 - - root - - - - grouper - - GROOVY - - /opt/midpoint/var/res/grouper2/SearchScript.groovy - /opt/midpoint/var/res/grouper2/TestScript.groovy - /opt/midpoint/var/res/grouper2/SchemaScript.groovy - /opt/midpoint/var/res/grouper2/SyncScript.groovy - true - - - - - - org.mariadb.jdbc.Driver - jdbc:mysql://%h:%p/%d?useUnicode=true&characterEncoding=utf8&connectionCollation=utf8_bin - true - true - false - false - - - - - - - - - - - account - Normal Account - true - ri:AccountObjectClass - - ri:subject_id - Subject ID - - - ri:name - Name - - - ri:group - Subject Groups - - strong - - extension/grouper_group - - - - - - entitlement - group - Group - ri:GroupObjectClass - - - - - - - - true - - - - name - - - declare namespace ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"; - $account/attributes/icfs:name - - - - - - - linked - true - - - deleted - true - - http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink - - - - unlinked - true - - http://midpoint.evolveum.com/xml/ns/public/model/action-3#link - - - - unmatched - true - - - - - - diff --git a/demo/complex/midpoint_server/container_files/mp-home/icf-connectors/connector-grouper-rest-0.1.jar b/demo/complex/midpoint_server/container_files/mp-home/icf-connectors/connector-grouper-rest-0.1.jar new file mode 100644 index 0000000..9ca2b47 Binary files /dev/null and b/demo/complex/midpoint_server/container_files/mp-home/icf-connectors/connector-grouper-rest-0.1.jar differ diff --git a/demo/complex/midpoint_server/container_files/mp-home/lib/amqp-client-5.3.0.jar b/demo/complex/midpoint_server/container_files/mp-home/lib/amqp-client-5.3.0.jar deleted file mode 100644 index 27c6942..0000000 Binary files a/demo/complex/midpoint_server/container_files/mp-home/lib/amqp-client-5.3.0.jar and /dev/null differ diff --git a/demo/complex/midpoint_server/container_files/mp-home/res/grouper/SchemaScript.groovy b/demo/complex/midpoint_server/container_files/mp-home/res/grouper/SchemaScript.groovy deleted file mode 100644 index 857e6c1..0000000 --- a/demo/complex/midpoint_server/container_files/mp-home/res/grouper/SchemaScript.groovy +++ /dev/null @@ -1,91 +0,0 @@ -/* - * ==================== - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2013 ForgeRock. All rights reserved. - * - * The contents of this file are subject to the terms of the Common Development - * and Distribution License("CDDL") (the "License"). You may not use this file - * except in compliance with the License. - * - * You can obtain a copy of the License at - * http://opensource.org/licenses/cddl1.php - * See the License for the specific language governing permissions and limitations - * under the License. - * - * When distributing the Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://opensource.org/licenses/cddl1.php. - * If applicable, add the following below this CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * ==================== - * Portions Copyrighted 2013 ConnId. - */ -import org.identityconnectors.framework.common.objects.AttributeInfo; -import org.identityconnectors.framework.common.objects.AttributeInfo.Flags; -import org.identityconnectors.framework.common.objects.AttributeInfoBuilder; -import org.identityconnectors.framework.common.objects.ObjectClassInfo; -import org.identityconnectors.framework.common.objects.ObjectClassInfoBuilder; - -// Parameters: -// The connector sends the following: -// action: a string describing the action ("SCHEMA" here) -// log: a handler to the Log facility -// builder: SchemaBuilder instance for the connector -// -// The connector will make the final call to builder.build() -// so the scipt just need to declare the different object types. - -// This sample shows how to create 3 basic ObjectTypes: __ACCOUNT__, __GROUP__ and organization. -// Each of them contains one required attribute and normal String attributes - - -log.info("Entering "+action+" Script"); - -// Declare the __ACCOUNT__ attributes -// Make the uid required -uidAIB = new AttributeInfoBuilder("uid",String.class); -uidAIB.setRequired(true); - -accAttrsInfo = new HashSet(); -accAttrsInfo.add(uidAIB.build()); -accAttrsInfo.add(AttributeInfoBuilder.build("subject_id", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("subject_identifier0", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("sort_string0", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("search_string0", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("name", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("description", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("group", String.class, [Flags.MULTIVALUED] as Set)); -// Create the __ACCOUNT__ Object class -final ObjectClassInfo ociAccount = new ObjectClassInfoBuilder().setType("__ACCOUNT__").addAllAttributeInfo(accAttrsInfo).build(); -builder.defineObjectClass(ociAccount); - -/* -// Declare the __GROUP__ attributes -// Make the gid required -gidAIB = new AttributeInfoBuilder("gid",String.class); -gidAIB.setRequired(true); - -grpAttrsInfo = new HashSet(); -grpAttrsInfo.add(gidAIB.build()); -grpAttrsInfo.add(AttributeInfoBuilder.build("name", String.class)); -grpAttrsInfo.add(AttributeInfoBuilder.build("description", String.class)); -// Create the __GROUP__ Object class -final ObjectClassInfo ociGroup = new ObjectClassInfoBuilder().setType("__GROUP__").addAllAttributeInfo(grpAttrsInfo).build(); -builder.defineObjectClass(ociGroup); - - -// Declare the organization attributes -// Make the name required -nAIB = new AttributeInfoBuilder("name",String.class); -nAIB.setRequired(true); - -orgAttrsInfo = new HashSet(); -orgAttrsInfo.add(nAIB.build()); -orgAttrsInfo.add(AttributeInfoBuilder.build("description", String.class)); -// Create the organization Object class -final ObjectClassInfo ociOrg = new ObjectClassInfoBuilder().setType("organization").addAllAttributeInfo(orgAttrsInfo).build(); -builder.defineObjectClass(ociOrg); -*/ - -log.info("Schema script done"); diff --git a/demo/complex/midpoint_server/container_files/mp-home/res/grouper/SearchScript.groovy b/demo/complex/midpoint_server/container_files/mp-home/res/grouper/SearchScript.groovy deleted file mode 100644 index 801bfe1..0000000 --- a/demo/complex/midpoint_server/container_files/mp-home/res/grouper/SearchScript.groovy +++ /dev/null @@ -1,101 +0,0 @@ -/* - * ==================== - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2013 ForgeRock. All rights reserved. - * - * The contents of this file are subject to the terms of the Common Development - * and Distribution License("CDDL") (the "License"). You may not use this file - * except in compliance with the License. - * - * You can obtain a copy of the License at - * http://opensource.org/licenses/cddl1.php - * See the License for the specific language governing permissions and limitations - * under the License. - * - * When distributing the Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://opensource.org/licenses/cddl1.php. - * If applicable, add the following below this CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * ==================== - * Portions Copyrighted 2013 ConnId. - */ -import groovy.sql.Sql; -import groovy.sql.DataSet; - -// Parameters: -// The connector sends the following: -// connection: handler to the SQL connection -// objectClass: a String describing the Object class (__ACCOUNT__ / __GROUP__ / other) -// action: a string describing the action ("SEARCH" here) -// log: a handler to the Log facility -// options: a handler to the OperationOptions Map -// query: a handler to the Query Map -// -// The Query map describes the filter used. -// -// query = [ operation: "CONTAINS", left: attribute, right: "value", not: true/false ] -// query = [ operation: "ENDSWITH", left: attribute, right: "value", not: true/false ] -// query = [ operation: "STARTSWITH", left: attribute, right: "value", not: true/false ] -// query = [ operation: "EQUALS", left: attribute, right: "value", not: true/false ] -// query = [ operation: "GREATERTHAN", left: attribute, right: "value", not: true/false ] -// query = [ operation: "GREATERTHANOREQUAL", left: attribute, right: "value", not: true/false ] -// query = [ operation: "LESSTHAN", left: attribute, right: "value", not: true/false ] -// query = [ operation: "LESSTHANOREQUAL", left: attribute, right: "value", not: true/false ] -// query = null : then we assume we fetch everything -// -// AND and OR filter just embed a left/right couple of queries. -// query = [ operation: "AND", left: query1, right: query2 ] -// query = [ operation: "OR", left: query1, right: query2 ] -// -// Returns: A list of Maps. Each map describing one row. -// !!!! Each Map must contain a '__UID__' and '__NAME__' attribute. -// This is required to build a ConnectorObject. - -log.info("Entering "+action+" Script"); - -def sql = new Sql(connection); -def result = [] -def where = ""; - -switch ( objectClass ) { - case "__ACCOUNT__": - sql.eachRow("\ -select m.id, m.name, m.subject_id, m.subject_identifier0, m.sort_string0, m.search_string0, m.description, m.subject_source, group_concat(distinct g.name) as groups \ -from \ - grouper_members m \ - left join grouper_memberships_all_v gm on m.id=gm.member_id and gm.owner_id in \ - (select m.subject_id \ - from grouper_memberships gm join grouper_members m on gm.member_id=m.id \ - where gm.owner_id = (select subject_id from grouper_members where name='etc:exportedGroups' and subject_type='group')) \ - left join grouper_groups g on gm.owner_id=g.id \ -group by m.id \ -having \ - subject_source = 'ldap';", - {result.add( - [__UID__:it.id, - __NAME__:it.subject_id, - uid:it.id, - subject_id:it.subject_id, - subject_identifier0:it.subject_identifier0, - sort_string0:it.sort_string0, - search_string0:it.search_string0, - name:it.name, - description:it.description, - group:it.groups?.tokenize(',')])} ); - break - -/* case "__GROUP__": - sql.eachRow("SELECT * FROM Groups" + where, {result.add([__UID__:it.name, __NAME__:it.name, gid:it.gid, ,description:it.description])} ); - break - - case "organization": - sql.eachRow("SELECT * FROM Organizations" + where, {result.add([__UID__:it.name, __NAME__:it.name, description:it.description])} ); - break */ - - default: - result; -} - -return result; diff --git a/demo/complex/midpoint_server/container_files/mp-home/res/grouper/TestScript.groovy b/demo/complex/midpoint_server/container_files/mp-home/res/grouper/TestScript.groovy deleted file mode 100644 index a232c15..0000000 --- a/demo/complex/midpoint_server/container_files/mp-home/res/grouper/TestScript.groovy +++ /dev/null @@ -1,38 +0,0 @@ -/* - * ==================== - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2013 ForgeRock. All rights reserved. - * - * The contents of this file are subject to the terms of the Common Development - * and Distribution License("CDDL") (the "License"). You may not use this file - * except in compliance with the License. - * - * You can obtain a copy of the License at - * http://opensource.org/licenses/cddl1.php - * See the License for the specific language governing permissions and limitations - * under the License. - * - * When distributing the Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://opensource.org/licenses/cddl1.php. - * If applicable, add the following below this CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * ==================== - * Portions Copyrighted 2013 ConnId. - */ -import groovy.sql.Sql; -import groovy.sql.DataSet; - -// Parameters: -// The connector sends the following: -// connection: handler to the SQL connection -// action: a string describing the action ("TEST" here) -// log: a handler to the Log facility - -log.info("Entering "+action+" Script"); -def sql = new Sql(connection); - -sql.eachRow("select * from grouper_members limit 10", { println it.subject_id } ); - - diff --git a/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/SchemaScript.groovy b/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/SchemaScript.groovy deleted file mode 100644 index 495615d..0000000 --- a/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/SchemaScript.groovy +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ==================== - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2013 ForgeRock. All rights reserved. - * - * The contents of this file are subject to the terms of the Common Development - * and Distribution License("CDDL") (the "License"). You may not use this file - * except in compliance with the License. - * - * You can obtain a copy of the License at - * http://opensource.org/licenses/cddl1.php - * See the License for the specific language governing permissions and limitations - * under the License. - * - * When distributing the Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://opensource.org/licenses/cddl1.php. - * If applicable, add the following below this CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * ==================== - * Portions Copyrighted 2013 ConnId. - */ -import org.identityconnectors.framework.common.objects.AttributeInfo; -import org.identityconnectors.framework.common.objects.AttributeInfo.Flags; -import org.identityconnectors.framework.common.objects.AttributeInfoBuilder; -import org.identityconnectors.framework.common.objects.ObjectClassInfo; -import org.identityconnectors.framework.common.objects.ObjectClassInfoBuilder; - -// Parameters: -// The connector sends the following: -// action: a string describing the action ("SCHEMA" here) -// log: a handler to the Log facility -// builder: SchemaBuilder instance for the connector -// -// The connector will make the final call to builder.build() -// so the scipt just need to declare the different object types. - -// This sample shows how to create 3 basic ObjectTypes: __ACCOUNT__, __GROUP__ and organization. -// Each of them contains one required attribute and normal String attributes - - -log.info("Entering "+action+" Script"); - -// __UID__ = grouper_members.id -// __NAME__ = grouper_members.subject_id -accAttrsInfo = new HashSet(); -accAttrsInfo.add(AttributeInfoBuilder.build("subject_id", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("subject_identifier0", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("sort_string0", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("search_string0", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("name", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("description", String.class)); -accAttrsInfo.add(AttributeInfoBuilder.build("group", String.class, [Flags.MULTIVALUED] as Set)); -ociAccount = new ObjectClassInfoBuilder().setType("__ACCOUNT__").addAllAttributeInfo(accAttrsInfo).build(); -builder.defineObjectClass(ociAccount); - -// __UID__ = grouper_groups.id -// __NAME__ = grouper_groups.name -grpAttrsInfo = new HashSet(); -grpAttrsInfo.add(AttributeInfoBuilder.build("displayName", String.class)); -grpAttrsInfo.add(AttributeInfoBuilder.build("extension", String.class)); -grpAttrsInfo.add(AttributeInfoBuilder.build("displayExtension", String.class)); -grpAttrsInfo.add(AttributeInfoBuilder.build("description", String.class)); -grpAttrsInfo.add(AttributeInfoBuilder.build("type", String.class)); -ociGroup = new ObjectClassInfoBuilder().setType("__GROUP__").addAllAttributeInfo(grpAttrsInfo).build(); -builder.defineObjectClass(ociGroup); - - -/* -// Declare the organization attributes -// Make the name required -nAIB = new AttributeInfoBuilder("name",String.class); -nAIB.setRequired(true); - -orgAttrsInfo = new HashSet(); -orgAttrsInfo.add(nAIB.build()); -orgAttrsInfo.add(AttributeInfoBuilder.build("description", String.class)); -// Create the organization Object class -final ObjectClassInfo ociOrg = new ObjectClassInfoBuilder().setType("organization").addAllAttributeInfo(orgAttrsInfo).build(); -builder.defineObjectClass(ociOrg); -*/ - -log.info("Schema script done"); diff --git a/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/SearchScript.groovy b/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/SearchScript.groovy deleted file mode 100644 index ea61cdd..0000000 --- a/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/SearchScript.groovy +++ /dev/null @@ -1,112 +0,0 @@ -/* - * ==================== - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2013 ForgeRock. All rights reserved. - * - * The contents of this file are subject to the terms of the Common Development - * and Distribution License("CDDL") (the "License"). You may not use this file - * except in compliance with the License. - * - * You can obtain a copy of the License at - * http://opensource.org/licenses/cddl1.php - * See the License for the specific language governing permissions and limitations - * under the License. - * - * When distributing the Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://opensource.org/licenses/cddl1.php. - * If applicable, add the following below this CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * ==================== - * Portions Copyrighted 2013 ConnId. - */ -import groovy.sql.Sql; -import groovy.sql.DataSet; - -// Parameters: -// The connector sends the following: -// connection: handler to the SQL connection -// objectClass: a String describing the Object class (__ACCOUNT__ / __GROUP__ / other) -// action: a string describing the action ("SEARCH" here) -// log: a handler to the Log facility -// options: a handler to the OperationOptions Map -// query: a handler to the Query Map -// -// The Query map describes the filter used. -// -// query = [ operation: "CONTAINS", left: attribute, right: "value", not: true/false ] -// query = [ operation: "ENDSWITH", left: attribute, right: "value", not: true/false ] -// query = [ operation: "STARTSWITH", left: attribute, right: "value", not: true/false ] -// query = [ operation: "EQUALS", left: attribute, right: "value", not: true/false ] -// query = [ operation: "GREATERTHAN", left: attribute, right: "value", not: true/false ] -// query = [ operation: "GREATERTHANOREQUAL", left: attribute, right: "value", not: true/false ] -// query = [ operation: "LESSTHAN", left: attribute, right: "value", not: true/false ] -// query = [ operation: "LESSTHANOREQUAL", left: attribute, right: "value", not: true/false ] -// query = null : then we assume we fetch everything -// -// AND and OR filter just embed a left/right couple of queries. -// query = [ operation: "AND", left: query1, right: query2 ] -// query = [ operation: "OR", left: query1, right: query2 ] -// -// Returns: A list of Maps. Each map describing one row. -// !!!! Each Map must contain a '__UID__' and '__NAME__' attribute. -// This is required to build a ConnectorObject. - -log.info("Entering "+action+" Script"); - -def sql = new Sql(connection); -def result = [] -def where = ""; - -switch ( objectClass ) { - case "__ACCOUNT__": - sql.eachRow("\ -select m.id, m.name, m.subject_id, m.subject_identifier0, m.sort_string0, m.search_string0, m.description, m.subject_source, m.subject_type, group_concat(distinct g.name) as groups \ -from \ - grouper_members m \ - left join grouper_memberships_all_v gm on m.id=gm.member_id and gm.owner_id in \ - (select m.subject_id \ - from grouper_memberships gm join grouper_members m on gm.member_id=m.id \ - where gm.owner_id = (select subject_id from grouper_members where name='etc:exportedGroups' and subject_type='group')) \ - left join grouper_groups g on gm.owner_id=g.id \ -group by m.id \ -having \ - subject_source = 'ldap' and subject_type = 'person'", - {result.add( - [__UID__:it.id, - __NAME__:it.subject_id, - subject_id:it.subject_id, - subject_identifier0:it.subject_identifier0, - sort_string0:it.sort_string0, - search_string0:it.search_string0, - name:it.name, - description:it.description, - group:it.groups?.tokenize(',')])} ); - break - - case "__GROUP__": - sql.eachRow("SELECT id, name, display_name, extension, display_extension, description, type_of_group FROM grouper_groups WHERE id in \ - (select m.subject_id \ - from grouper_memberships gm join grouper_members m on gm.member_id=m.id \ - where gm.owner_id = (select subject_id from grouper_members where name='etc:exportedGroups' and subject_type='group'))", - {result.add([ - __UID__:it.id, - __NAME__:it.name, - displayName:it.display_name, - extension:it.extension, - displayExtension:it.display_extension, - description:it.description, - type:it.type_of_group])} ); - break - -/* - case "organization": - sql.eachRow("SELECT * FROM Organizations" + where, {result.add([__UID__:it.name, __NAME__:it.name, description:it.description])} ); - break */ - - default: - result; -} - -return result; diff --git a/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/SyncScript.groovy b/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/SyncScript.groovy deleted file mode 100644 index 35062a9..0000000 --- a/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/SyncScript.groovy +++ /dev/null @@ -1,205 +0,0 @@ -/* - * ==================== - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2013 ForgeRock. All rights reserved. - * - * The contents of this file are subject to the terms of the Common Development - * and Distribution License("CDDL") (the "License"). You may not use this file - * except in compliance with the License. - * - * You can obtain a copy of the License at - * http://opensource.org/licenses/cddl1.php - * See the License for the specific language governing permissions and limitations - * under the License. - * - * When distributing the Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://opensource.org/licenses/cddl1.php. - * If applicable, add the following below this CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * ==================== - * Portions Copyrighted 2013 ConnId. - */ -import groovy.sql.Sql -import groovy.sql.DataSet -import com.rabbitmq.client.* - -// Parameters: -// The connector sends the following: -// connection: handler to the SQL connection -// objectClass: a String describing the Object class (__ACCOUNT__ / __GROUP__ / other) -// action: a string describing the action ("SYNC" or "GET_LATEST_SYNC_TOKEN" here) -// log: a handler to the Log facility -// options: a handler to the OperationOptions Map (null if action = "GET_LATEST_SYNC_TOKEN") -// token: a handler to an Object representing the sync token (null if action = "GET_LATEST_SYNC_TOKEN") -// -// -// Returns: -// if action = "GET_LATEST_SYNC_TOKEN", it must return an object representing the last known -// sync token for the corresponding ObjectClass -// -// if action = "SYNC": -// A list of Maps . Each map describing one update: -// Map should look like the following: -// -// [ -// "token": token object (could be Integer, Date, String) , [!! could be null] -// "operation": ("CREATE_OR_UPDATE"|"DELETE") will always default to CREATE_OR_DELETE , -// "uid": uid (uid of the entry) , -// "previousUid": prevuid (This is for rename ops) , -// "password": password (optional... allows to pass clear text password if needed), -// "attributes":Map of attributes name/values -// ] - -def MQ_HOST = 'mq' -def MQ_PORT = 5672 -def QUEUE = 'sampleQueue' -def MAX_SQL_IN = 200 // maximum number of subject IDs in one SQL IN clause -def MAX_CHANGED_USERS = 1000 // maximum number of changed users (approximate) -def AUTO_ACKNOWLEDGE = true // use 'false' only for testing - -log.info("Entering "+action+" Script"); -def sql = new Sql(connection); - -if (action.equalsIgnoreCase("GET_LATEST_SYNC_TOKEN")) { - return System.currentTimeMillis() -} else if (action.equalsIgnoreCase("SYNC")) { - - factory = new ConnectionFactory() - factory.host = MQ_HOST - factory.port = MQ_PORT - connection = factory.newConnection() - channel = connection.createChannel() - println 'RabbitMQ: conn=' + connection + ', channel=' + channel - - result = [] - subjectsChanged = new HashSet() - - for (;;) { - response = channel.basicGet(QUEUE, AUTO_ACKNOWLEDGE) - println 'got response: ' + response - if (response == null) { - break - } - body = response.body - if (body == null) { - log.warn('null body in {}', response) - continue - } - text = new String(body) - println 'Got message:\n' + text - - jsonSlurper = new groovy.json.JsonSlurper() - msg = jsonSlurper.parseText(text) - - events = msg?.esbEvent - println 'events = ' + events - if (events == null || events.isEmpty()) { - println 'esbEvent is null or empty, getting next message; events = ' + events - continue - } - - for (event in events) { - type = event.eventType - if (type != 'MEMBERSHIP_ADD' && type != 'MEMBERSHIP_DELETE') { - println 'event type does not match, getting next message; type = ' + type - continue - } - if (event.sourceId != 'ldap') { - println 'sourceId does not match, getting next message; sourceId = ' + event.sourceId - continue - } - - // the user membership has changed: let's fetch the current status of the user (ConnId requires full 'new state' anyway) - subjectId = event.subjectId - if (subjectId == null) { - println 'subjectId is null, getting next message' - continue - } - println 'subject membership changed: ' + subjectId - subjectsChanged.add(subjectId) - } - if (subjectsChanged.size() >= MAX_CHANGED_USERS) { - println 'MAX_CHANGED_USERS reached, finishing fetching from MQ' - break - } - } - - println 'subjects changed: ' + subjectsChanged - - for (ids in subjectsChanged.asList().collate(MAX_SQL_IN)) { - idsIn = '(' + ids.collect { "'" + it + "'" }.join(',') + ')' - println 'idsIn = ' + idsIn - - sql.eachRow("\ -select m.id, m.name, m.subject_id, m.subject_identifier0, m.sort_string0, m.search_string0, m.description, m.subject_source, m.subject_type, group_concat(distinct g.name) as groups \ -from \ - grouper_members m \ - left join grouper_memberships_all_v gm on m.id=gm.member_id and gm.owner_id in \ - (select m.subject_id \ - from grouper_memberships gm join grouper_members m on gm.member_id=m.id \ - where gm.owner_id = (select subject_id from grouper_members where name='etc:exportedGroups' and subject_type='group')) \ - left join grouper_groups g on gm.owner_id=g.id \ -group by m.id \ -having \ - subject_source = 'ldap' and subject_type = 'person' and subject_id IN " + idsIn, - {result.add( - [operation:"CREATE_OR_UPDATE", - token:System.currentTimeMillis(), - uid:it.id, - attributes:[ - __UID__:it.id, - __NAME__:it.subject_id, - subject_id:it.subject_id, - subject_identifier0:it.subject_identifier0, - sort_string0:it.sort_string0, - search_string0:it.search_string0, - name:it.name, - description:it.description, - group:it.groups?.tokenize(',')]])} ) - } - - channel.close() - connection.close() - - println 'result is\n' + result - - return result - -/* - def result = []; - def tstamp = null; - if (token != null){ - tstamp = new java.sql.Timestamp(token); - } - else{ - def today= new Date(); - tstamp = new java.sql.Timestamp(today.time); - } - - switch ( objectClass ) { - case "__ACCOUNT__": - sql.eachRow("select * from Users where timestamp > ${tstamp}", - {result.add([operation:"CREATE_OR_UPDATE", uid:it.uid, token:it.timestamp.getTime(), - attributes:[firstname:it.firstname,fullname:it.fullname, lastname:it.lastname, email:it.email, organization:it.organization]])} - ) - break; - - case "__GROUP__": - sql.eachRow("select * from Groups where timestamp > ${tstamp}", - {result.add([operation:"CREATE_OR_UPDATE", uid:it.gid,token:it.timestamp.getTime(), - attributes:[gid:it.gid,name:it.name,description:it.description]])} - ); - break; - } - - log.ok("Sync script: found "+result.size()+" events to sync"); - return result; -*/ - -} -else { - log.error("Sync script: action '"+action+"' is not implemented in this script"); - return null; -} diff --git a/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/TestScript.groovy b/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/TestScript.groovy deleted file mode 100644 index 45d9477..0000000 --- a/demo/complex/midpoint_server/container_files/mp-home/res/grouper2/TestScript.groovy +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ==================== - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2013 ForgeRock. All rights reserved. - * - * The contents of this file are subject to the terms of the Common Development - * and Distribution License("CDDL") (the "License"). You may not use this file - * except in compliance with the License. - * - * You can obtain a copy of the License at - * http://opensource.org/licenses/cddl1.php - * See the License for the specific language governing permissions and limitations - * under the License. - * - * When distributing the Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://opensource.org/licenses/cddl1.php. - * If applicable, add the following below this CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * ==================== - * Portions Copyrighted 2013 ConnId. - */ -import groovy.sql.Sql -import groovy.sql.DataSet -import com.rabbitmq.client.* - -// Parameters: -// The connector sends the following: -// connection: handler to the SQL connection -// action: a string describing the action ("TEST" here) -// log: a handler to the Log facility - -log.info("Entering "+action+" Script") -def sql = new Sql(connection) - -sql.eachRow("select * from grouper_members limit 10", { println it.subject_id } ) - -factory = new ConnectionFactory() -factory.host = 'mq' -factory.port = 5672 -connection = factory.newConnection() -channel = connection.createChannel() -println 'conn=' + connection + ', channel=' + channel - -channel.close() -connection.close()