Expert rules for checking user attributes

Last modified by Carina Enke on 15.01.2024

Expert rules let you evaluate the user attributes and thus control the visibility and the access to course sections or course element. To do this, use the expert rules hasAttribute, isInAttribute or getUserProperty.

All of the following example rules can be created for both the visibility and access of a course element. To simplify matters, only one scenario is described in each of the following examples. To learn more about the difference between visibility and access, see the page Publishing within courses (visibility and access).

 

General user attributes

The following user attributes are available in the learning platform and can be used for expert rules:

Attribut

Contains the user-specific value

firstName

First name

lastName

Last name

username / userid

User name

email

Email address

institutionalName

Institution / University

institutionalUserIdentifier

Matriculation number / User number at the institution

standort

Location

termsOfStudy

Term of study

studySubject

Study programme

studyGroup

Study group

orgUnit

Organisation unit

Institution-specific user attributes

Apart from the general user attributes, there are also institution-specific restrictions or extensions possible. Therefore, check which of the user attributes are available in your platform before using it. Please refer to the page Overview of OPAL Shibboleth Attributes for an overview of these usable attributes and corresponding example values.

Checking for a user attribute

Syntax in general

Example of an expert rule

Result of this rule

isInAttribute("[AttrName]","[string]")

isInAttribute("studySubject","Chemistry")

 

If this rule has been defined in the tab Access, the course element is accessible for all persons whose attribute Study programme contains the letter sequence "Chemistry".

This means that users with the study programme “Chemistry BA" or “Chemistry MA" can use the course element. Users with the study subject “Chemical water treatment”, however, cannot.

getUserProperty("[string]")

getUserProperty("orgUnit") = "Marketing"

 

Only users from the "Marketing" organisation unit can see the course element if this rule has been used in the Visibility tab..

hasAttribute("[AttrName]","[string]")

hasAttribute("email","muster.mann@opal.de")

Only a user with this email address will get access to the course section.

Create additional rules by using expert syntax. A tabular overview is provided on the page Expert syntax.