Skip to content

Commit

Permalink
Added SCIMv1 samples to usual place with all samples
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-farinic committed Oct 24, 2016
1 parent f37aeac commit 1d56843
Show file tree
Hide file tree
Showing 15 changed files with 3,065 additions and 0 deletions.
@@ -0,0 +1,60 @@
<xsd:schema elementFormDefault="qualified"
targetNamespace="http://example.com/mycustomer"
xmlns:tns="http://example.com/mycustomer"
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">

<xsd:complexType name="UserExtensionType">
<xsd:annotation>
<xsd:appinfo>
<a:extension ref="c:UserType"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>

<xsd:element name="salesForceGroups" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo>
<a:indexed>false</a:indexed>
<a:displayName>SalesForce Groups</a:displayName>
<a:displayOrder>100</a:displayOrder>
</xsd:appinfo>
<xsd:documentation>
SalesForce Groups
</xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:element name="salesForceEntitlements" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo>
<a:indexed>false</a:indexed>
<a:displayName>SalesForce Entitlements</a:displayName>
<a:displayOrder>110</a:displayOrder>
</xsd:appinfo>
<xsd:documentation>
SalesForce Entitlements
</xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:element name="entitlementValue" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo>
<a:indexed>false</a:indexed>
<a:displayName>Entitlement Value</a:displayName>
<a:displayOrder>120</a:displayOrder>
</xsd:appinfo>
<xsd:documentation>
SalesForce entitlement value
</xsd:documentation>
</xsd:annotation>
</xsd:element>



</xsd:sequence>
</xsd:complexType>

</xsd:schema>
@@ -0,0 +1,62 @@
<objectTemplate xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
oid="fa3d0199-4c91-4055-8ad5-8f550462de69"
version="12">
<name>Group and entitlement role template - Salesforce </name>
<description>
Template with the implementation of the automatic creation of roles while importing entitlement and role resource objects.
</description>
<metadata>
<createTimestamp>2016-10-11T13:17:01.692+02:00</createTimestamp>
<creatorRef oid="00000000-0000-0000-0000-000000000002" type="c:UserType"><!-- administrator --></creatorRef>
<createChannel>http://midpoint.evolveum.com/xml/ns/public/model/channels-3#objectImport</createChannel>
</metadata>
<mapping>
<name>Group assignment</name>
<authoritative>true</authoritative>
<strength>strong</strength>
<source>
<c:path>roleType</c:path>
</source>
<expression>
<assignmentTargetSearch>
<targetType>c:RoleType</targetType>
<oid>a5bcd1cc-eb8a-469e-8ff2-3f5c6f97c463</oid>
</assignmentTargetSearch>
</expression>
<target>
<c:path>assignment</c:path>
</target>
<condition>
<script>
<code>roleType == 'SalesForce-Group'</code>
</script>
</condition>
</mapping>
<mapping>
<name>Entitlement assignment</name>
<authoritative>true</authoritative>
<strength>strong</strength>
<source>
<c:path>roleType</c:path>
</source>
<expression>
<assignmentTargetSearch>
<targetType>c:RoleType</targetType>
<oid>bf4e629b-de8c-4af2-b58d-99e18e270ebb</oid>
</assignmentTargetSearch>
</expression>
<target>
<c:path>assignment</c:path>
</target>
<condition>
<script>
<code>roleType == 'SalesForce-Entitlement'</code>
</script>
</condition>
</mapping>
</objectTemplate>
131 changes: 131 additions & 0 deletions samples/resources/scim1/Salesforce/objecttemplate-user-salesforce.xml
@@ -0,0 +1,131 @@
<objectTemplate xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
oid="ae2702dc-5fa2-4b0d-a1ed-cd3bf87908fd"
version="21">
<name>User template - Salesforce</name>
<description>
User template with the impementation of scripts for automatic assigment of roles to Salesforce users.
</description>
<metadata>
<createTimestamp>2016-10-11T13:18:27.498+02:00</createTimestamp>
<creatorRef oid="00000000-0000-0000-0000-000000000002" type="c:UserType"><!-- administrator --></creatorRef>
<createChannel>http://midpoint.evolveum.com/xml/ns/public/model/channels-3#objectImport</createChannel>
</metadata>
<mapping>
<name>User - Salesforce Group mapping</name>
<authoritative>true</authoritative>
<strength>strong</strength>
<source>
<name>salesForceGroup</name>
<c:path>extension/salesForceGroups</c:path>
</source>
<expression>
<script>
<code>
import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;
import com.evolveum.midpoint.util.exception.SystemException;
import java.util.*;

log.info("The group for which the assigment will be built from the salesForceGroup attribute {}" , salesForceGroup)
if (salesForceGroup != null){
roleName = salesForceGroup;

role = midpoint.searchObjectByName(RoleType.class, roleName);
if (role==null){
throw new SystemException("Exception while assigning the group defined in attribute to a role. Please make sure that all the group objects are already importet to Midpoint.");
}
log.info("role {}" , role)
roleOrt = new ObjectReferenceType();
roleOrt.setOid(role.getOid());
roleOrt.setType(RoleType.COMPLEX_TYPE);

AssignmentType assignment = new AssignmentType();
assignment.asPrismContainerValue()
assignment.setTargetRef(roleOrt);

return assignment

}
</code>
</script>
</expression>
<target>
<c:path>assignment</c:path>
</target>
</mapping>
<mapping>
<name>User - Salesforce Entitlement mapping</name>
<authoritative>true</authoritative>
<strength>strong</strength>
<source>
<name>salesForceEntitlement</name>
<c:path>extension/salesForceEntitlements</c:path>
</source>
<expression>
<script>
<code>
import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;
import com.evolveum.midpoint.util.exception.SystemException;
import java.util.*;

log.info("The entitlement for which the assigment will be built from the salesForceEntitlement attribute {}" , salesForceEntitlement)
if (salesForceEntitlement != null){
roleName = salesForceEntitlement;

role = midpoint.searchObjectByName(RoleType.class, roleName);

if (role==null){
throw new SystemException("Exception while assigning the entitlement defined in attribute to a role. Please make sure that all the entitlement objects are already importet to Midpoint.");
}

log.info("role {}" , role)
roleOrt = new ObjectReferenceType();
roleOrt.setOid(role.getOid());
roleOrt.setType(RoleType.COMPLEX_TYPE);

AssignmentType assignment = new AssignmentType();
assignment.asPrismContainerValue()
assignment.setTargetRef(roleOrt);

return assignment

}
</code>
</script>
</expression>
<target>
<c:path>assignment</c:path>
</target>
</mapping>
<mapping>
<name>User - Full name mapping</name>
<strength>weak</strength>
<source>
<c:path>$user/givenName</c:path>
</source>
<source>
<c:path>$user/familyName</c:path>
</source>
<expression>
<script>
<language>http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy</language>
<code>
givenName + ' ' + familyName
</code>
</script>
</expression>
<target>
<c:path>fullName</c:path>
</target>
</mapping>
</objectTemplate>

0 comments on commit 1d56843

Please sign in to comment.