-
Notifications
You must be signed in to change notification settings - Fork 188
/
archetype-device.xml
117 lines (105 loc) · 4.43 KB
/
archetype-device.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
<!--
~ Copyright (c) 2020 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<archetype xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:s="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3"
oid="d6d90e2c-ad25-4f7f-a0e1-2f5fac03b402">
<name>device</name>
<documentation>A device has some special characteristics:
1. It is held by at most single user at given time.
2. It gives its holder some properties, e.g. the `organizational` obtains value of
`D users` for any device D held.
3. On the other hand, it knows who uses it by storing the user's `name` and `fullName` in
its `description` property.
Note that points 2 and 3 are implemented by object templates (point 2 by template for users
and point 3 by template for services). This means that they work for both active and
inactive devices. For a different approach please see the "token" archetype.
</documentation>
<archetypePolicy>
<objectTemplateRef oid="e0d5d585-da74-4523-b4f5-78cb54c0dccd" /> <!-- template-device -->
</archetypePolicy>
<!-- Part 2: Triggering data transfer: Policy rules that cause recomputation of relevant objects when needed. -->
<!-- 2a: device -> user -->
<inducement>
<policyRule>
<documentation>
Recomputes a user when device name is changed. (Note that user is recomputed
automatically when device is assigned or unassigned.)
</documentation>
<policyConstraints>
<modification>
<item>name</item>
</modification>
</policyConstraints>
<policyActions>
<scriptExecution>
<object>
<linkSource/>
</object>
<executeScript>
<s:recompute/>
</executeScript>
</scriptExecution>
</policyActions>
</policyRule>
<order>1</order> <!-- assigned to device object, so executes when device is modified -->
</inducement>
<!-- 2b: user -> device -->
<inducement>
<policyRule>
<documentation>
Recomputes all devices whose membership has changed.
</documentation>
<policyConstraints>
<alwaysTrue/>
</policyConstraints>
<policyActions>
<scriptExecution>
<object>
<linkTarget>
<changeSituation>changed</changeSituation>
<!-- i.e. all objects that brought this policy rule to the focus -->
<matchesRuleAssignment>true</matchesRuleAssignment>
</linkTarget>
</object>
<executeScript>
<s:recompute/>
</executeScript>
</scriptExecution>
</policyActions>
</policyRule>
<order>1</order> <!-- assigned to device object, so executes when assignment to it is added/modified (i.e. on the user) -->
</inducement>
<inducement>
<policyRule>
<documentation>Recomputes a device when user's name or fullName changes.</documentation>
<policyConstraints>
<or>
<modification>
<item>name</item>
</modification>
<modification>
<item>fullName</item>
</modification>
</or>
</policyConstraints>
<policyActions>
<scriptExecution>
<object>
<linkTarget>
<!-- i.e. all objects that brought this policy rule to the focus -->
<matchesRuleAssignment>true</matchesRuleAssignment>
</linkTarget>
</object>
<executeScript>
<s:recompute/>
</executeScript>
</scriptExecution>
</policyActions>
</policyRule>
<order>2</order> <!-- assigned to the user -->
</inducement>
</archetype>