Expert rules for checking user attributes
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.
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 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 |
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 general | Example of an expert rule | Result 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.