[midPoint] Blog: MidPoint in Higher Education: Archetypes

Slavek Licehammer slavek.licehammer at evolveum.com
Sat Aug 29 11:59:46 CEST 2020


In the introductory blog <https://evolveum.com/midpoint-in-higher-education-introduction/> about midPoint in higher education I promised that the next blog post would be about relations and organizational units. It is taking a bit longer to finalize, but hopefully it will be worth it. In the meantime, let us examine the possible uses of archetypes in midPoint.

Primary purpose of archetypes is the categorization of objects. One object can have only one archetype, but in the future, there is a plan to change that. That is why we cannot use the archetypes to distinguish between students and employees, because it would be impossible to deal with persons who are students and employees at the same time. Midpoint offers other ways to deal with that situation, but let’s focus on archetypes now.

For today’s demonstration example, we will create two archetypes for users. One will be for academic users (e.g. students, professors, researchers) and the second one for non-academic users (e.g. support staff). Usually the academic users have some additional privileges (like access to academic journals), therefore if a user fits in both categories, we will prioritize the academic one. An empty archetype doesn’t do anything, so let’s add visual change to it straight away.

 1. <archetypeoid="d2898b9b-5a31-4b7f-a971-1215f9b95b84">
 2.    <name>Academic User</name>
 3.    <description>Student, Teacher, Researchers, etc.</description>
 4.

 5.    <archetypePolicy>
 6.      <display>
 7.        <label>Academic user</label>
 8.        <pluralLabel>Academic users</pluralLabel>
 9.        <icon>
10.          <cssClass>fa fa-graduation-cap</cssClass>
11.          <color>RoyalBlue</color>
12.        </icon>
13.      </display>
14.    </archetypePolicy>
15. </archetype>

 1. <archetypeoid="019eec6e-2bc2-4112-be40-57471d3a1490">
 2.    <name>Non-academic users</name>
 3.    <description>Non-academic users e.g. support staff</description>
 4.

 5.    <archetypePolicy>
 6.      <display>
 7.        <label>Non-academic user</label>
 8.        <pluralLabel>Non-academic users</pluralLabel>
 9.        <icon>
10.          <cssClass>fa fa-user</cssClass>
11.          <color>LimeGreen</color>
12.        </icon>
13.      </display>
14.    </archetypePolicy>
15. </archetype>

As soon as we assign the archetypes to users, we will see the change in midPoint GUI.

We can even add a custom collection view to midPoint GUI. To do that we have to update the adminGuiConfiguration object in the system configuration.

 1. <adminGuiConfiguration>
 2.   <objectCollectionViews>
 3.     <objectCollectionView>
 4.       <identifier>academic-users</identifier>
 5.       <display>
 6.        <label>Academic users</label>
 7.       </display>
 8.       <type>UserType</type>
 9.       <collection>
10.         <collectionRefoid="d2898b9b-5a31-4b7f-a971-1215f9b95b84"type="ArchetypeType"/>
11.       </collection>
12.     </objectCollectionView>
13.

14.     <objectCollectionView>
15.       <identifier>non-academic-users</identifier>
16.         <display>
17.           <label>Non-academic users</label>
18.         </display>
19.         <type>UserType</type>
20.         <collection>
21.           <collectionRefoid="019eec6e-2bc2-4112-be40-57471d3a1490"type="ArchetypeType"/>
22.         </collection>
23.     </objectCollectionView>
24.   </objectCollectionViews>
25. </adminGuiConfiguration>

After the change is applied, the new views are available in the menu.

Archetypes also offer another user-experience related improvement. Assignments of archetyped objects can be restricted based on custom rules. For example, we can create a role which could be assigned only to academic users.

 1. <archetypeoid="016b2ce4-7877-4633-965a-18bc9b7bc50a">
 2.   <name>Role for academic users</name>
 3.

 4.   <inducement>
 5.     <description>Archetyped role can be assigned only to academic users</description>
 6.     <assignmentRelation>
 7.       <holderType>UserType</holderType>
 8.       <!-- Academic user archetype -->
 9.       <holderArchetypeRefoid="d2898b9b-5a31-4b7f-a971-1215f9b95b84"/>
10.       <relation>org:default</relation>
11.     </assignmentRelation>
12.   </inducement>
13.

14.   <assignment>
15.     <description>The archetype itself can be assigned only to roles</description>
16.     <assignmentRelation>
17.       <holderType>RoleType</holderType>
18.       <relation>org:default</relation>
19.     </assignmentRelation>
20.   </assignment>
21.

22.   <archetypePolicy>
23.     <display>
24.       <label>Role for academic users</label>
25.       <pluralLabel>Roles for academic users</pluralLabel>
26.       <icon>
27.        <cssClass>fa fa-graduation-cap</cssClass>
28.        <color>SkyBlue</color>
29.       </icon>
30.     </display>
31.   </archetypePolicy>
32. </archetype>

Notice the difference between assignment, which is applied to the object itself (the archetype), and inducement, which is applied to the object with archetype assigned.

We also prepare a role for non-academic users and a role for any users in a similar way. With all the parts in place, the configuration is already visible in GUI’s assignment tab.

You can see the leftmost icon representing the role adding to academic users and the middle icon representing role adding to any user. You cannot see a button for assigning a role to non-academic users because this role cannot be applied to an academic user, who Jack Smith is (as you can see in the upper right corner). Notice that the “general” assignment button (the rightmost icon from highlighted area) is still present as it was before we have created the archetypes. To eliminate it and display only explicitly allowed relations, we have to set assignmentHolderRelationApproach to “closed”. That can be done globally or only for selected objects. We will choose the latter approach for now and apply it only to our academic users. This is how our improved Academic User Archetype looks like now:

 1. <archetypeoid="d2898b9b-5a31-4b7f-a971-1215f9b95b84">
 2.   <name>Academic User</name>
 3.   <description>Student, Teacher, Researchers, etc.</description>
 4.

 5.   <assignment>
 6.     <description>The archetype itself can be assigned only to roles</description>
 7.     <assignmentRelation>
 8.       <holderType>UserType</holderType>
 9.       <relation>org:default</relation>
10.     </assignmentRelation>
11.   </assignment>
12.

13.   <archetypePolicy>
14.     <display>
15.       <label>Academic user</label>
16.       <pluralLabel>Academic user</pluralLabel>
17.       <icon>
18.         <cssClass>fa fa-graduation-cap</cssClass>
19.         <color>RoyalBlue</color>
20.       </icon>
21.     </display>
22.     <assignmentHolderRelationApproach>closed</assignmentHolderRelationApproach>
23.   </archetypePolicy>
24.

25. </archetype>

Note that the “general” assignment button is not there anymore and only roles for academic users and roles for any users are offered. In this configuration, you are not able to assign an org. unit to users with academic user archetype. Therefore you shouldn’t use the closed assignmentHolderRelationApproach until you have all your archetypes in place.

When you click on one of new assignment buttons, you will get a filtered view.

The assignment restriction feature in archetypes is quite handy. It helps midPoint administrators to keep track of which objects are meant to be assigned to each other. Just bear in mind this is only a restriction in the GUI. You can still add any relation in automatic processes. Also, if you change the archetype to another one, the existing assignments won’t be affected even though they might not be allowed by the new archetype. For enforcing such rules, midPoint has the policy rules feature.

The last feature of archetypes is that they act as an abstract role. Therefore you can use them like any other role, meaning they can induce account construction or even other roles, org. units etc.

In summary, the archetypes are a powerful feature which helps you to improve user experience in the midPoint GUI. Proper archetypes configuration will help users who only need to use the midPoint GUI and don’t need to have knowledge about the detailed configuration of roles and other objects. You can deliver a custom look and feel for them, including custom views and most importantly make sure they will assign only objects that are meant to be assigned that way.

 

/We are welcoming feedback to this blog series. Also, we are open to suggestions for the next topics, as long as they fit the overall scope. Feel free to share your ideas in the comments, on midPoint mailing list or any other channels./

/Assistance with proofreading and readability improvements provided by Keith Hazelton of Internet2 was greatly appreciated./

/
/

/(Reposted from Evolveum blog <https://evolveum.com/data-provenance-milestone-2/>)/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20200829/7af10102/attachment.htm>


More information about the midPoint mailing list