forked from docker/midPoint-Grouper_connector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
256 additions
and
7 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
53 changes: 53 additions & 0 deletions
53
artifacts/archetypes/grouperToSympaIntegrationArchetype.xml
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,53 @@ | ||
<archetype xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" | ||
xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3" | ||
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" | ||
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" | ||
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" | ||
oid="<Enter a New OID>" | ||
version="2"> | ||
<!-- | ||
This archetype is creates 2 inducements that allow a Grouper STEM to | ||
1. Be assigned to a base Midpoint organization | ||
2. Create a Sympa List | ||
The archetype oid is typically referenced in a resource configuration Schema Handling inbound assignment | ||
--> | ||
<name>Grouper To SYMPA integration Archetype</name> | ||
<iteration>0</iteration> | ||
<iterationToken/> | ||
<activation> | ||
<effectiveStatus>enabled</effectiveStatus> | ||
<enableTimestamp>2021-09-10T22:06:48.815Z</enableTimestamp> | ||
</activation> | ||
<displayName>Sympa Email List Archetype for Internet2 Domain</displayName> | ||
<inducement id="2"> | ||
<targetRef oid="<Base ORG OID>" relation="org:default" type="c:OrgType"> | ||
<!-- The base ORG OID is the OID of a midpoint organization you create to hold Children of your | ||
Grouper Base Stem | ||
--> | ||
</targetRef> | ||
</inducement> | ||
<inducement id="3"> | ||
<construction> | ||
<resourceRef oid="<Sympa Connector Resource OID>" relation="org:default" type="c:ResourceType"> | ||
<!-- | ||
Enter the Resource OID of the Sympa connector instance that corresponds to SYMPA server | ||
than will handle LIST creation for the Grouper Base Stem. | ||
--> | ||
</resourceRef> | ||
<kind>account</kind> | ||
<intent>default</intent> | ||
</construction> | ||
</inducement> | ||
<archetypePolicy> | ||
<display> | ||
<label>Mailing list</label> | ||
<pluralLabel>Mailing lists</pluralLabel> | ||
<icon> | ||
<cssClass>fa fa-list</cssClass> | ||
<color>blue</color> | ||
</icon> | ||
</display> | ||
</archetypePolicy> | ||
</archetype> |
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,73 @@ | ||
<functionLibrary xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" | ||
xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3" | ||
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" | ||
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" | ||
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" | ||
oid="04602441-dff7-4eb1-a8cb-834c7733633a" | ||
version="0"> | ||
<!-- | ||
The grouperStems function library is intended to handle STEM messages sent from grouper. To take advantage | ||
of the asynchronous updates the midpoint Built in Async Update Connector must configured in the Grouper Resource | ||
You will be using. | ||
--> | ||
<name>grouperStems</name> | ||
<description>Functions for Grouper AMQP connector to Manage Sympa List Manager</description> | ||
<iteration>0</iteration> | ||
<iterationToken/> | ||
<function> | ||
<name>handleMessage</name> | ||
<parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ExpressionParameterType"> | ||
<name>message</name> | ||
<type>c:AsyncUpdateMessageType</type> | ||
</parameter> | ||
<returnType>c:UcfChangeType</returnType> | ||
<script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType"> | ||
<code> | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.* | ||
import com.evolveum.prism.xml.ns._public.types_3.* | ||
import static com.evolveum.midpoint.schema.constants.SchemaConstants.* | ||
import com.evolveum.midpoint.schema.util.* | ||
import com.evolveum.midpoint.prism.path.* | ||
import com.evolveum.midpoint.schema.constants.* | ||
import com.evolveum.midpoint.prism.delta.* | ||
STEM_OBJECT_CLASS = new ItemName(MidPointConstants.NS_RI, 'Stem') | ||
ATTR_NAME = new ItemName(MidPointConstants.NS_RI, 'name') | ||
ATTR_UUID = new ItemName(MidPointConstants.NS_RI, 'uuid') | ||
|
||
esbEvent = midpoint.getMessageBodyAsMap(message)['esbEvent'][0]; | ||
log.info( 'SYMPA Event {}', esbEvent) | ||
eventType = esbEvent['eventType']; | ||
if ( eventType == 'STEM_UPDATE') | ||
{ | ||
stemName = esbEvent['name']; | ||
stemId = esbEvent['id']; | ||
parentStemId = esbEvent['']; | ||
identifiers = new HashMap(); | ||
identifiers.put(ATTR_NAME, stemName); | ||
identifiers.put(ATTR_UUID, stemId); | ||
log.info( 'STEM_UPDATE on {}', stemName); | ||
return UcfChangeUtil.create(STEM_OBJECT_CLASS, identifiers, null, prismContext); | ||
} | ||
else if ( eventType == 'STEM_DELETE' ) | ||
{ | ||
stemName = esbEvent['name']; | ||
stemId = esbEvent['id']; | ||
parentStemId = esbEvent['']; | ||
identifiers = new HashMap() | ||
identifiers.put(ATTR_NAME, stemName); | ||
identifiers.put(ATTR_UUID, stemId); | ||
ObjectDeltaType delta = new ObjectDeltaType(); | ||
delta.changeType = ChangeTypeType.DELETE; | ||
log.info( 'STEM_DELETE {}', stemName); | ||
return UcfChangeUtil.create(STEM_OBJECT_CLASS, identifiers, delta, prismContext) | ||
} | ||
else | ||
{ | ||
return null; | ||
} | ||
</code> | ||
</script> | ||
</function> | ||
</functionLibrary> |
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,42 @@ | ||
<!-- | ||
This Resource Configuration fragment is placed immediately after the <connectorConfiguration> element | ||
--> | ||
<additionalConnector id="1"> | ||
<name>AMQP async update connector</name> | ||
<connectorRef oid="<Enter Built In Connector OID>" relation="org:default" type="c:ConnectorType"> | ||
<filter> | ||
<q:equal> | ||
<q:path>connectorType</q:path> | ||
<q:value>AsyncUpdateConnector</q:value> | ||
</q:equal> | ||
</filter> | ||
</connectorRef> | ||
<connectorConfiguration xmlns:gen871="http://midpoint.evolveum.com/xml/ns/public/connector/builtin-1/bundle/com.evolveum.midpoint.provisioning.ucf.impl.builtin.async/AsyncUpdateConnector"> | ||
<gen871:sources> | ||
<amqp091> | ||
<uri>amqp://mq:1234</uri> | ||
<username>aUserName</username> | ||
<password>aPassword</password> | ||
<queue>AQueueName</queue> | ||
</amqp091> | ||
</gen871:sources> | ||
<gen871:transformExpression> | ||
<script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType"> | ||
<code> | ||
<!-- Calls a Function Library named "grouperStems" with a method named "handleMessage" | ||
Function libraries take as input a hashmap containing the named parameters required by the method | ||
In this example the Hashmap only contains 1 parameter named message. | ||
The async update connector provides a variable named message | ||
--> | ||
parameters = ['message': message] | ||
grouperStems.execute('handleMessage', parameters) | ||
</code> | ||
</script> | ||
</gen871:transformExpression> | ||
</connectorConfiguration> | ||
<capabilities> | ||
<native xmlns:cap="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3"> | ||
<cap:asyncUpdate/> | ||
</native> | ||
</capabilities> | ||
</additionalConnector> |
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,58 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
|
||
<xsd:schema elementFormDefault="qualified" | ||
targetNamespace="http://sympa.internet2.edu" | ||
xmlns:tns="http://aHost.internet2.edu" | ||
xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3" | ||
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<!-- Extended fields for a midpoint OrgType to support SYMPA Mailing List Server attributes | ||
Place this file in your MIDPOINT_HOME/schema directory and restart your midpoint server | ||
--> | ||
<xsd:complexType name="OrgExtensionType"> | ||
<xsd:annotation> | ||
<xsd:appinfo> | ||
<a:extension ref="c:OrgType"/> | ||
</xsd:appinfo> | ||
</xsd:annotation> | ||
<xsd:sequence> | ||
<xsd:element name="subject" type="xsd:string" minOccurs="0"> | ||
<xsd:annotation> | ||
<xsd:appinfo> | ||
<a:indexed>true</a:indexed> | ||
<a:displayName>Subject</a:displayName> | ||
<a:help>Typically used as a mailing list subject</a:help> | ||
</xsd:appinfo> | ||
</xsd:annotation> | ||
</xsd:element> | ||
<xsd:element name="template" type="xsd:string" minOccurs="0"> | ||
<xsd:annotation> | ||
<xsd:appinfo> | ||
<a:indexed>true</a:indexed> | ||
<a:displayName>Template</a:displayName> | ||
<a:help>Typically used as a mailing list template for construction</a:help> | ||
</xsd:appinfo> | ||
</xsd:annotation> | ||
</xsd:element> | ||
<xsd:element name="topic" type="xsd:string" minOccurs="0"> | ||
<xsd:annotation> | ||
<xsd:appinfo> | ||
<a:indexed>true</a:indexed> | ||
<a:displayName>Topics</a:displayName> | ||
<a:help>Typically used to describes the topics covered by the item</a:help> | ||
</xsd:appinfo> | ||
</xsd:annotation> | ||
</xsd:element> | ||
<xsd:element name="homepage" type="xsd:string" minOccurs="0"> | ||
<xsd:annotation> | ||
<xsd:appinfo> | ||
<a:indexed>true</a:indexed> | ||
<a:displayName>Home Page</a:displayName> | ||
<a:help>The URL location of the Homepage</a:help> | ||
</xsd:appinfo> | ||
</xsd:annotation> | ||
</xsd:element> | ||
</xsd:sequence> | ||
</xsd:complexType> | ||
</xsd:schema> | ||
|
Oops, something went wrong.