-
Notifications
You must be signed in to change notification settings - Fork 188
/
objecttemplate-user-salesforce.xml
131 lines (119 loc) · 5.07 KB
/
objecttemplate-user-salesforce.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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>