Skip to content

Commit

Permalink
more extensive sample import objects/tasks/etc script
Browse files Browse the repository at this point in the history
  • Loading branch information
James Babb committed Dec 1, 2017
1 parent 61769c1 commit 0d5c617
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 81 deletions.
202 changes: 202 additions & 0 deletions midpoint/assets/objects/01_sis.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8"?>

<objects xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-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:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
xmlns:mext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3">

<!-- TODO: is hard coding an OID going to be a problem? -->
<resource oid="6573361b-20c9-4d79-8f00-f1445b5902a1">
<name>SIS DB Source</name>

<connectorRef type="ConnectorType">
<filter>
<q:equal>
<q:path>c:connectorType</q:path>
<q:value>org.identityconnectors.databasetable.DatabaseTableConnector</q:value>
</q:equal>
</filter>
</connectorRef>

<connectorConfiguration>
<icfc:configurationProperties
xmlns:icscdbtable = "http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.polygon.connector-databasetable/org.identityconnectors.databasetable.DatabaseTableConnector">
<icscdbtable:port>3306</icscdbtable:port>
<icscdbtable:host>midpoint-poc-mysql</icscdbtable:host>
<icscdbtable:user>root</icscdbtable:user>
<icscdbtable:password><clearValue>root</clearValue></icscdbtable:password>
<icscdbtable:database>myapp_development</icscdbtable:database>
<icscdbtable:table>users</icscdbtable:table>
<icscdbtable:keyColumn>id</icscdbtable:keyColumn>
<icscdbtable:passwordColumn>password</icscdbtable:passwordColumn>
<icscdbtable:jdbcDriver>com.mysql.jdbc.Driver</icscdbtable:jdbcDriver>
<icscdbtable:jdbcUrlTemplate>jdbc:mysql://%h:%p/%d?useUnicode=true&amp;characterEncoding=utf8&amp;connectionCollation=utf8_bin&amp;useSSL=false</icscdbtable:jdbcUrlTemplate>
<icscdbtable:enableEmptyString>false</icscdbtable:enableEmptyString>
<icscdbtable:rethrowAllSQLExceptions>true</icscdbtable:rethrowAllSQLExceptions>
<icscdbtable:nativeTimestamps>false</icscdbtable:nativeTimestamps>
<icscdbtable:allNative>false</icscdbtable:allNative>
<icscdbtable:changeLogColumn>updated_at</icscdbtable:changeLogColumn>
</icfc:configurationProperties>
</connectorConfiguration>

<schemaHandling>
<objectType>
<kind>account</kind>
<displayName>Normal Account</displayName>
<default>true</default>
<objectClass>AccountObjectClass</objectClass>

<attribute>
<ref>icfs:uid</ref>
<displayName>Entry UUID</displayName>
<limitations>
<access>
<read>true</read>
</access>
</limitations>
</attribute>

<attribute>
<ref>icfs:name</ref>
<displayName>name</displayName>
<limitations>
<minOccurs>0</minOccurs>
<access>
<read>true</read>
<add>true</add>
<modify>true</modify>
</access>
</limitations>
</attribute>

<attribute>
<ref>ri:uid</ref>
<inbound>
<target>
<path>$user/name</path>
</target>
</inbound>
</attribute>

<attribute>
<ref>ri:givenname</ref>
<inbound>
<target>
<path>$user/givenName</path>
</target>
</inbound>
</attribute>

<attribute>
<ref>ri:surname</ref>
<inbound>
<target>
<path>$user/familyName</path>
</target>
</inbound>
</attribute>

<attribute>
<ref>ri:fullName</ref>
<inbound>
<target>
<path>$user/fullName</path>
</target>
</inbound>
</attribute>

<attribute>
<ref>ri:lfname</ref>
<inbound>
<target>
<path>$user/nickName</path>
</target>
</inbound>
</attribute>

<attribute>
<ref>ri:email</ref>
<inbound>
<target>
<path>$user/emailAddress</path>
</target>
</inbound>
</attribute>

</objectType>
</schemaHandling>

<synchronization>
<objectSynchronization>
<enabled>true</enabled>

<correlation>
<q:description>
Correlation expression is a search query.
Following search queury will look for users that have "name"
equal to the "uid" attribute of the account. Simply speaking,
it will look for match in usernames in the IDM and the resource.
The correlation rule always looks for users, so it will not match
any other object type.
</q:description>
<q:equal>
<q:path>name</q:path>
<c:expression>
<c:path>$c:account/c:attributes/ri:uid</c:path>
</c:expression>
</q:equal>
</correlation>

<reaction>
<situation>linked</situation>
<synchronize>true</synchronize>
</reaction>

<reaction>
<situation>deleted</situation>
<synchronize>true</synchronize>
<action>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink</handlerUri>
</action>
</reaction>

<reaction>
<situation>unlinked</situation>
<synchronize>true</synchronize>
<action>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#link</handlerUri>
</action>
</reaction>
<reaction>
<situation>unmatched</situation>
<synchronize>true</synchronize>
<action>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus</handlerUri>
</action>
</reaction>
</objectSynchronization>
</synchronization>

</resource>

<task>
<name>Import SIS Accounts</name>
<extension >
<mext:kind>account</mext:kind>
<mext:objectclass>ri:AccountObjectClass</mext:objectclass>
</extension>
<!-- TODO: More uses of hard coded OIDs..hmmm -->
<ownerRef oid="00000000-0000-0000-0000-000000000002" type="c:UserType"><!-- administrator --></ownerRef>
<executionStatus>runnable</executionStatus>
<category>ImportingAccounts</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/import/handler-3</handlerUri>
<objectRef oid="6573361b-20c9-4d79-8f00-f1445b5902a1" type="c:ResourceType"><!--SIS DB Source--></objectRef>
<recurrence>single</recurrence>
<binding>loose</binding>
<threadStopAction>restart</threadStopAction>
</task>

</objects>
3 changes: 2 additions & 1 deletion midpoint/assets/objects/import_objects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
# import_objects.sh, DESCRIPTION
#
echo "Importing Midpoint objects"
curl --user administrator:5ecr3t -H "Content-Type: application/xml" -X POST http://localhost:8080/midpoint/ws/rest/resources -d @/midpoint_objects/simple_dbtable.xml -v
# TODO: Change this to loop through all files in directory in ascending order
curl --user administrator:5ecr3t -H "Content-Type: application/xml" -X POST http://localhost:8080/midpoint/ws/rest/resources -d @/midpoint_objects/sis.xml -v
echo "Done importing Midpoint objects"
80 changes: 0 additions & 80 deletions midpoint/assets/objects/simple_dbtable.xml

This file was deleted.

0 comments on commit 0d5c617

Please sign in to comment.