<resource 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="137edf3a-104e-49b4-9dcb-14db1062c8f3">
    <name>Openstack Keystone </name>

   <connectorRef type="ConnectorType">
        <filter>
            <q:text>c:connectorType = "com.evolveum.polygon.connector.openstackkeystone.rest.OpenStackConnector"</q:text>
        </filter>
    </connectorRef>
    <connectorConfiguration xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3">
        <icfc:configurationProperties xmlns:gen233="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.polygon.connector-openStack-Keystone/com.evolveum.polygon.connector.openstackkeystone.rest.OpenStackConnector">
            <gen233:endpoint>endpoint</gen233:endpoint>
            <gen233:userId>userId</gen233:userId>
            <gen233:password>
                <t:clearValue>password </t:clearValue>
            </gen233:password>
            <gen233:projectName>projectName</gen233:projectName>
            <gen233:domainName>domainName</gen233:domainName>
        </icfc:configurationProperties>
    </connectorConfiguration>

    <schemaHandling>
        <objectType>
            <kind>entitlement</kind>
            <intent>Group</intent>
            <default>false</default>
            <objectClass>ri:GroupObjectClass</objectClass>
            <attribute>
                <c:ref>icfs:name</c:ref>
                <outbound>
                    <source>
                        <c:path>$focus/name</c:path>
                    </source>
                </outbound>
                <inbound>
                    <target>
                        <c:path>$focus/name</c:path>
                    </target>
                </inbound>
                <inbound>
                    <expression>
                        <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType">
                            <code>
                           return 'group'
                        </code>
                        </script>
                    </expression>
                    <target>
                        <c:path>$focus/subtype</c:path>
                    </target>
                </inbound>
                <inbound>
                    <expression>
                        <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType">
                            <code>
                           return 'group'
                        </code>
                        </script>
                    </expression>
                    <target>
                        <c:path>$focus/identifier</c:path>
                    </target>
                </inbound>
            </attribute>
            <attribute>
                <c:ref>ri:description</c:ref>
                <tolerant>true</tolerant>
                <exclusiveStrong>false</exclusiveStrong>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$focus/description</c:path>
                    </source>
                </outbound>
                <inbound>
                    <strength>weak</strength>
                    <target>
                        <c:path>$focus/description</c:path>
                    </target>
                </inbound>
            </attribute>
            <association>
                <c:ref>ri:group_in_roles</c:ref>
                <displayName>Roles for group</displayName>
                <kind>entitlement</kind>
                <intent>Role</intent>
                <direction>subjectToObject</direction>
                <associationAttribute>ri:grouproles</associationAttribute>
                <valueAttribute>icfs:uid</valueAttribute>
                <explicitReferentialIntegrity>false</explicitReferentialIntegrity>
            </association>
            <association>
                <c:ref>ri:group_in_projects</c:ref>
                <displayName>Projects for group</displayName>
                <kind>entitlement</kind>
                <intent>Project</intent>
                <direction>subjectToObject</direction>
                <associationAttribute>ri:groupprojects</associationAttribute>
                <valueAttribute>icfs:uid</valueAttribute>
                <explicitReferentialIntegrity>false</explicitReferentialIntegrity>
            </association>
            <association>
                <c:ref>ri:users_in_group</c:ref>
                <displayName>Group members</displayName>
                <kind>account</kind>
                <intent>default</intent>
                <direction>subjectToObject</direction>
                <associationAttribute>ri:group_members</associationAttribute>
                <valueAttribute>icfs:uid</valueAttribute>
                <explicitReferentialIntegrity>false</explicitReferentialIntegrity>
            </association>
        </objectType>
        <objectType>
            <kind>account</kind>
            <intent>default</intent>
            <default>true</default>
            <objectClass>ri:AccountObjectClass</objectClass>
            <attribute>
                <c:ref>icfs:name</c:ref>
                <outbound>
                    <source>
                        <c:path>$user/name</c:path>
                    </source>
                </outbound>
                <inbound>
                    <target>
                        <c:path>$user/name</c:path>
                    </target>
                </inbound>
            </attribute>
            <attribute>
                <c:ref>ri:email</c:ref>
                <tolerant>true</tolerant>
                <exclusiveStrong>false</exclusiveStrong>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$user/emailAddress</c:path>
                    </source>
                </outbound>
                <inbound>
                    <strength>weak</strength>
                    <target>
                        <c:path>$user/emailAddress</c:path>
                    </target>
                </inbound>
            </attribute>
            <attribute>
                <c:ref>ri:description</c:ref>
                <tolerant>true</tolerant>
                <exclusiveStrong>false</exclusiveStrong>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$user/description</c:path>
                    </source>
                </outbound>
                <inbound id="65">
                    <strength>weak</strength>
                    <target>
                        <c:path>$user/description</c:path>
                    </target>
                </inbound>
            </attribute>
            <association>
                <c:ref>ri:user_in_groups</c:ref>
                <displayName>User in groups</displayName>
                <kind>entitlement</kind>
                <intent>Group</intent>
                <direction>subjectToObject</direction>
                <associationAttribute>ri:usergroups</associationAttribute>
                <valueAttribute>icfs:uid</valueAttribute>
                <explicitReferentialIntegrity>false</explicitReferentialIntegrity>
            </association>
            <association>
                <c:ref>ri:user_in_roles</c:ref>
                <displayName>Roles for user</displayName>
                <kind>entitlement</kind>
                <intent>Role</intent>
                <direction>subjectToObject</direction>
                <associationAttribute>ri:userroles</associationAttribute>
                <valueAttribute>icfs:uid</valueAttribute>
                <explicitReferentialIntegrity>false</explicitReferentialIntegrity>
            </association>
            <association>
                <c:ref>ri:user_in_projects</c:ref>
                <displayName>Projects for user</displayName>
                <kind>entitlement</kind>
                <intent>Project</intent>
                <direction>subjectToObject</direction>
                <associationAttribute>ri:userprojects</associationAttribute>
                <valueAttribute>icfs:uid</valueAttribute>
                <explicitReferentialIntegrity>false</explicitReferentialIntegrity>
            </association>
            <protected>
                <filter>
                    <q:text>attributes/icfs:name =[stringIgnoreCase] "root"</q:text>
                </filter>
            </protected>
            <activation>
                <administrativeStatus>
                    <outbound id="57">
                        <strength>strong</strength>
                        <expression>
                            <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.ActivationStatusType;
                                    if (legal) {
                                        input;
                                    } else {
                                        ActivationStatusType.DISABLED;
                                    }
                                </code>
                            </script>
                        </expression>
                    </outbound>
                </administrativeStatus>
            </activation>
            <credentials>
                <password xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ResourcePasswordDefinitionType">
                    <outbound>
                        <expression>
                            <asIs xsi:type="c:AsIsExpressionEvaluatorType"/>
                        </expression>
                    </outbound>
                </password>
            </credentials>
        </objectType>
        <objectType>
            <kind>entitlement</kind>
            <intent>Project</intent>
            <default>false</default>
            <objectClass>ri:CustomProjectObjectClass</objectClass>
            <attribute>
                <c:ref>icfs:name</c:ref>
                <outbound>
                    <source>
                        <c:path>$focus/name</c:path>
                    </source>
                </outbound>
                <inbound>
                    <target>
                        <c:path>$focus/name</c:path>
                    </target>
                </inbound>
                <inbound>
                    <expression>
                        <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType">
                            <code>
                           return 'project'
                        </code>
                        </script>
                    </expression>
                    <target>
                        <c:path>$focus/subtype</c:path>
                    </target>
                </inbound>
            </attribute>
            <attribute>
                <c:ref>icfs:uid</c:ref>
                <inbound>
                    <target>
                        <c:path>$focus/identifier</c:path>
                    </target>
                </inbound>
            </attribute>
            <attribute>
                <c:ref>ri:description</c:ref>
                <tolerant>true</tolerant>
                <exclusiveStrong>false</exclusiveStrong>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$focus/description</c:path>
                    </source>
                </outbound>
                <inbound>
                    <strength>weak</strength>
                    <target>
                        <c:path>$focus/description</c:path>
                    </target>
                </inbound>
            </attribute>
        </objectType>
        <objectType>
            <kind>entitlement</kind>
            <intent>Role</intent>
            <default>false</default>
            <objectClass>ri:CustomRoleObjectClass</objectClass>
            <attribute>
                <c:ref>icfs:name</c:ref>
                <outbound>
                    <source>
                        <c:path>$focus/name</c:path>
                    </source>
                </outbound>
                <inbound>
                    <target>
                        <c:path>$focus/name</c:path>
                    </target>
                </inbound>
                <inbound>
                    <expression>
                        <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType">
                            <code>
                           return 'role'
                        </code>
                        </script>
                    </expression>
                    <target>
                        <c:path>subtype</c:path>
                    </target>
                </inbound>
            </attribute>
            <attribute>
                <c:ref>icfs:uid</c:ref>
                <inbound>
                    <target>
                        <c:path>identifier</c:path>
                    </target>
                </inbound>
            </attribute>
        </objectType>
        <objectType>
            <kind>entitlement</kind>
            <intent>Domain</intent>
            <default>false</default>
            <objectClass>ri:CustomDomainObjectClass</objectClass>
            <attribute>
                <c:ref>icfs:name</c:ref>
                <outbound>
                    <source>
                        <c:path>$focus/name</c:path>
                    </source>
                </outbound>
                <inbound>
                    <target>
                        <c:path>$focus/name</c:path>
                    </target>
                </inbound>
                <inbound>
                    <expression>
                        <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType">
                            <code>
                           return 'domain'
                        </code>
                        </script>
                    </expression>
                    <target>
                        <c:path>$focus/subtype</c:path>
                    </target>
                </inbound>
                <inbound>
                    <expression>
                        <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType">
                            <code>
                           return 'domain'
                        </code>
                        </script>
                    </expression>
                    <target>
                        <c:path>$focus/identifier</c:path>
                    </target>
                </inbound>
            </attribute>
            <attribute>
                <c:ref>ri:description</c:ref>
                <tolerant>true</tolerant>
                <exclusiveStrong>false</exclusiveStrong>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$focus/description</c:path>
                    </source>
                </outbound>
                <inbound>
                    <strength>weak</strength>
                    <target>
                        <c:path>$focus/description</c:path>
                    </target>
                </inbound>
            </attribute>
        </objectType>
    </schemaHandling>

    <synchronization>
        <objectSynchronization>
            <name>Users sync</name>
            <kind>account</kind>
            <focusType>c:UserType</focusType>
            <enabled>true</enabled>
            <correlation>
                <q:equal>
                    <q:path>c:name</q:path>
                    <expression>
                        <path>$account/attributes/icfs:name</path>
                    </expression>
                </q:equal>
            </correlation>
            <reconcile>true</reconcile>
            <reaction>
                <situation>linked</situation>
                <synchronize>true</synchronize>
                <reconcile>true</reconcile>
            </reaction>
            <reaction>
                <situation>deleted</situation>
                <synchronize>true</synchronize>
                <reconcile>true</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteShadow</handlerUri>
                </action>
            </reaction>
            <reaction>
                <situation>unlinked</situation>
                <synchronize>true</synchronize>
                <reconcile>true</reconcile>
                <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>
        <objectSynchronization>
            <name>Groups sync</name>
            <kind>entitlement</kind>
            <intent>Group</intent>
            <focusType>c:OrgType</focusType>
            <enabled>true</enabled>
            <correlation>
                <q:equal>
                    <q:path>c:name</q:path>
                    <expression>
                        <path>$account/attributes/icfs:name</path>
                    </expression>
                </q:equal>
            </correlation>
            <reconcile>false</reconcile>
            <reaction>
                <situation>linked</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
            </reaction>
            <reaction>
                <situation>deleted</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteFocus</handlerUri>
                </action>
            </reaction>
            <reaction>
                <situation>unlinked</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#link</handlerUri>
                </action>
            </reaction>
            <reaction>
                <situation>unmatched</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus</handlerUri>
                </action>
            </reaction>
        </objectSynchronization>
        <objectSynchronization>
            <name>Project sync</name>
            <kind>entitlement</kind>
            <intent>Project</intent>
            <focusType>c:OrgType</focusType>
            <enabled>true</enabled>
            <correlation>
                <q:equal>
                    <q:path>c:name</q:path>
                    <expression>
                        <path>$account/attributes/icfs:name</path>
                    </expression>
                </q:equal>
            </correlation>
            <objectTemplateRef oid="99cc8d77-dedc-4444-a081-b006821a9c79"/>
            <reconcile>false</reconcile>
            <reaction>
                <situation>linked</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
            </reaction>
            <reaction>
                <situation>deleted</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteFocus</handlerUri>
                </action>
            </reaction>
            <reaction>
                <situation>unlinked</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#link</handlerUri>
                </action>
            </reaction>
            <reaction>
                <situation>unmatched</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus</handlerUri>
                </action>
            </reaction>
        </objectSynchronization>
        <objectSynchronization>
            <name>Role sync</name>
            <kind>entitlement</kind>
            <intent>Role</intent>
            <focusType>c:RoleType</focusType>
            <enabled>true</enabled>
            <correlation>
                <q:equal>
                    <q:path>c:name</q:path>
                    <expression>
                        <path>$account/attributes/icfs:name</path>
                    </expression>
                </q:equal>
            </correlation>
            <reconcile>false</reconcile>
            <reaction>
                <situation>linked</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
            </reaction>
            <reaction>
                <situation>deleted</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteFocus</handlerUri>
                </action>
            </reaction>
            <reaction>
                <situation>unlinked</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#link</handlerUri>
                </action>
            </reaction>
            <reaction>
                <situation>unmatched</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus</handlerUri>
                </action>
            </reaction>
        </objectSynchronization>
        <objectSynchronization>
            <name>Domain sync</name>
            <kind>entitlement</kind>
            <intent>Domain</intent>
            <focusType>c:OrgType</focusType>
            <enabled>true</enabled>
            <correlation>
                <q:equal>
                    <q:path>c:name</q:path>
                    <expression>
                        <path>$account/attributes/icfs:name</path>
                    </expression>
                </q:equal>
            </correlation>
            <reconcile>false</reconcile>
            <reaction>
                <situation>linked</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
            </reaction>
            <reaction>
                <situation>deleted</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteFocus</handlerUri>
                </action>
            </reaction>
            <reaction>
                <situation>unlinked</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#link</handlerUri>
                </action>
            </reaction>
            <reaction>
                <situation>unmatched</situation>
                <synchronize>true</synchronize>
                <reconcile>false</reconcile>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus</handlerUri>
                </action>
            </reaction>
        </objectSynchronization>
    </synchronization>
</resource>
