Reiter

Unterpunkte

Creating a New Role

In some didactic scenarios it is necessary to create a new role with special permissions, e.g. a closed working area for authors should be offered where only members of a author role have access to. Instead of letting a user create a role and set the right permissions a didactical template can be used for this.
Before we explain the necessary elements for a template to create a new role we give an example of such a code snippet:
The following example shows parts of a template for ILIAS learning modules. The template creates a new author role and gives this role the necessary rights so that assigned users can edit the selected learning module.
<actions>
...
<localRoleAction>
<roleTemplate>
<role type="role">
<title>DTPL_LM_AUTHOR</title>
<operations>
<operation group="lm">visible</operation>
<operation group="lm">read</operation>
<operation group="lm">write</operation>
</operations>
</role>
</roleTemplate>
</localRoleAction>
...
</actions>
The elements for creating a new role (or role template) are:
  • The action for creating a new role is localRoleAction (only local roles can be created inside the repository).
  • The role definition is made within the element roleTemplate:
  • The role element defines the type of role that is created:
    • role type:"role": creates a role
    • role type:"rolt": creates a role template (and can be reused)
  • Each new role needs to have a title (we recommend to use a kind of pre-fix to easily identify roles that have been created by didactic templates, e.g. DTPL).
  • The element operations contains all permission settings - here called operation.
  • Each permission setting for every object type has to be defined in a separate operation element:
    • The related object type of the permission setting is defined by group="{object type shortcut}", e.g.: operation group=lm" for a permission of a learning module.
    • The permission itself is defined between the start and the end tag of the operation element.