-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add grouper loaders and t-data container
Also added server-side files: ScriptedSQL connector and scripts for the connections (SIS->midPoint, Grouper->midPoint).
- Loading branch information
Showing
20 changed files
with
787 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+97.3 KB
...ontainer_files/icf-connectors/net.tirasa.connid.bundles.db.scriptedsql-2.2.6-SNAPSHOT.jar
Binary file not shown.
91 changes: 91 additions & 0 deletions
91
grouper-midpoint/mp-gr/m-server/container_files/res/grouper/SchemaScript.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| /* | ||
| * ==================== | ||
| * 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<AttributeInfo>(); | ||
| 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<AttributeInfo>(); | ||
| 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<AttributeInfo>(); | ||
| 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"); |
101 changes: 101 additions & 0 deletions
101
grouper-midpoint/mp-gr/m-server/container_files/res/grouper/SearchScript.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| /* | ||
| * ==================== | ||
| * 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; |
38 changes: 38 additions & 0 deletions
38
grouper-midpoint/mp-gr/m-server/container_files/res/grouper/TestScript.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * ==================== | ||
| * 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 } ); | ||
|
|
||
|
|
Oops, something went wrong.