Expert rules for checking user attributes

Last modified by Anna Paul-Hasenfuss on 19.02.2026

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

Information

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

Warning

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

In general, 

  • hasAttribute is used to check whether a user has a specific attribute or not. The function returns true when the attribute exists, regardless of its value. This rule is suitable for simple existence checks.
  • ​isInAttribute is used when you want to pass on whether the attribute value is included in a list of permitted values. The rule checks multi-value lists or enumerations, e.g. roles or group memberships.
  • getUserProperty is used when the exact value of a user attribute needs to be retrieved and then compared with a condition. It is ideal for exact value comparisons or dynamic calculations with attribute values.
Syntax in generalExample of an expert ruleResult of this rule
isInAttribute("[AttrName]","[string]")isInAttribute("studySubject","Chemie")

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.

isInAttribute("language","de")If this rule has been entered in the Access tab, the course element is accessible to all persons whose user language is German.
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.

hasAttribute("language","en")Only persons with the selected user language ‘English’ will be granted access to the course section.

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