Zum Ende der Metadaten springen
Zum Anfang der Metadaten

Use of Expert Rules

In case of more complicated visibility or access rules you can also use the expert mode, thus enabling you to configure visibility and access of course elements as required. You can e.g. limit a course element's access to a specific user name. It is also possible to interrelate several restrictions to each other. Just click on "Display expert mode" in the tabs "Visibility" and "Access" in order to define your expert rules in the box provided.

Configuration of Expert Rules

Expert rules certify if there is an attribute with a specific value.

AttributeDescriptionExample Expert rule
isGuestaccessible only for guestsisGuest(0)
isCourseCoachavailable only for users coaching a groupisCourseCoach(0)
isUseravailable only for one specific userisUser("pmuster")

 

An extensive list of all relevant components needed for applying expert rules can be found in the following box.

 Functions, operators and other expert rule components
TypeSyntaxMeaning
Constantstrue or 1True
false or 0False
VariablenowActual time of server system
Functionsdate("[date]")Retrieve date
inLearningGroup("[string]")Generates TRUE for all members of the learning group [string]
inRightGroup("[string]")Generates TRUE for all group members with the same rights [string]
isLearningGroupFull("[string]")Generates the boolean TRUE (= full) or FALSE (= vacancies) for the learning group indicated.
isUser("[string]")Results in TRUE for users with the user name [string]
inLearningArea("[string]")Generates TRUE for all group members in the learning area [string]
isGlobalAuthor(0)Generates TRUE for all members of the OLAT author group
isCourseAdministrator(0)Generates TRUE for all owners of a course (learning resource)
isCourseCoach(0)Generates TRUE for all users supervising a learning group
isCourseParticipant(0)Returns TRUE for all participants of this course
isGuest(0)Generates TRUE for all users visiting OLAT as guests
hasAttribute("[AttrName]","[string]")Generates TRUE, if [string] corresponds to the relevant user's value of the AAI attribute [AttrName] .
isInAttribute("[AttrName]","[substring]")Generates TRUE, if [substring] corresponds to part of the relevant user's value of the AAI attribute [AttrName].
General information on AAI
AAI attributes
Specification of AAI attributes (pdf file)
getUserProperty("userPropertyname")Generates the value of a specific user attribute. By means of "=" this value can be compared to another fixed value.
getPassed("[integer]")Generates the Boolean TRUE (=Passed) or FALSE (=Failed) from a course element with specified ID
getScore("[integer]")Generates the score from a course element with specified ID
getAttempts("[integer]")Generates the number of completed attempts from a course element with specified ID. Can be applied to course elements of the type Test, Self-test, Questionnaire (possible return values 0 or 1) and Task (deprecated) (return value = number of files handed in).
getLastAttemptDate("[integer]")Generates the date of the last attempt from a course element with the specified ID. Can be applied like the getAttempts method.
getInitialEnrollmentDate("[integer]")Generates the date of the first registration of the relevant course participant from the course element Enrolment with specified ID.
getRecentEnrollmentDate("[integer]")Generates the date of the last registration of the relevant course participant from the course element Enrolment with specified ID.
getInitialCourseLaunchDate(0)Generates the date of a course participant's first course attendance.
getRecentCourseLaunchDate(0)Generates the date of a course participant's last course attendance.
getPassedWithCourseId("[integer-1]","[integer-2]")Generates the Boolean TRUE (=Passed) or FALSE (=Failed) from the course element ID=[integer-2] of the course ID=[integer-1]
getScoreWithCourseId("[integer-1]","[integer-2]")Generates the score from the course element ID=[integer-2] of the course ID=[integer-1]
UnitsminMinutes
hHours
dDays
wWeeks
mMonths
Operators=equal
>greater than
<less than
>=greater/equal
<=less/equal
*Multiplication
/Division
+Addition
-Subtraction
Booleans&Logical AND
|Logical OR

There are various options to interrelate single rules to each other. The two most important operators to combine attributes are:

  • AND conjunction: &
  • OR conjunction: |

Please note that an OR conjunction precedes an AND conjunction. In order to handle an AND conjunction first you have to use brackets.

Example: The expert rule (inGroup("Participants IntensiveCourse") & isCourseCoach(0)) means that either participants of an intensive course or all coaches of groups will have access to a course element.

Some examples are listed below in order to show you how to use the expert syntax.

 Examples of expert rules in the tabs «Visibility», «Access» and «Score» (structural elements)
isGuest(0) or isGuest(0)=1 or isGuest(0)=true
Only guests have access to this course element.

inLearningGroup("Amateur") = 0
With the exception of the group «Amateur» this course element is visible for all participants.

(now >= date("22.03.2004 12:00")) & (now <= date("23.08.2004 18:00")) | inLearningGroup("Tutor")
This course element is visible for all participants between 22-3-2004 and 23-8-2004. For members of the learning group «Tutor» it is always visible.

(now >= date("03.09.2004 00:00")) & (now <= date("13.10.2004 00:00")) & inRightGroup("Assessors")| isUser("Author")
This course element is visible for all participants of the right group «Assessors» between 3-9-2004 and 13-10-2004. For the person with the user name «Author» it is always visible.

hasAttribute("swissEduPersonStudyBranch3","6200")
Only students of human medicine have access to this course element.
See also:
AAI attributes
Specification of AAI attributes (pdf file)

hasAttribute("swissEduPersonHomeOrganization","uzh.ch")
Only students of the University of Zurich have access to this course element.
See also:
AAI attributes 
Specification of AAI attributes (pdf file)

isInAttribute("surname","Mue")
Generates TRUE for all persons whose attribute surname contains the letter sequence "Mue". E.g. gives TRUE for the value "Mueller" or "Muehlebacher"
See also:
AAI attributes 
Specification of AAI attributes (pdf file)

isInAttribute("eduPersonEntitlement","http://vam.uzh.ch")
Generates TRUE for all persons whose attribute eduPersonEntitlement contains the value "http://vam.uzh.ch". E.g. gives TRUE for the value "http://vam.uzh.ch/surgery"
See also:
AAI attributes 
Specification of AAI attributes (pdf file)

(getUserProperty("orgUnit") = "Sales")
Checks if a person is part of the organizational unit 'Sales.' This can be useful if e.g. data are automatedly transferred from LDAP.

(getPassed("69742969114730") | getPassed("69742969115733") | getPassed("69742969118009")) * 10
This rule is set in the tab «Score» -> «Processing score» of the course element Structure . The course element Structure shows 10 points if one of the tests (course element IDs "69742969114730", "69742969115733" or "69742969118009") was passed. Otherwise 0 points.

(getScore("69742969114730") + getScore("69742969115733") + getScore("69742969118009")) >= 140 | getPassed("69978845384688")
This rule is set in the tab «Score» -> «Passed if» of the course element Structure . The course element Structure shows «Passed», if a minimum of 140 points in all tests is achieved or if «Passed» is entered manually. (Element Assessment with ID "69978845384688").

getAttempts("70323786958847") > 0
Generates TRUE, as soon as the relevant course participant has completed the test with specified ID for the first time.

getAttempts("70323524635734") <= 3
Generates FALSE, as soon as the relevant course participant has put more than 3 files into the storage folder of the course element Task (deprecated) .

getLastAttemptDate("70323524635734") + 24h < now
Generates TRUE when the last test attempt is older than 24 hours

getInitialEnrollmentDate("70323786958847") <= date("26.5.2005 18:00")
Generates TRUE for those participants who enrolled in an available group before 6 p.m. on May 26th, 2005, by means of the course element Enrolment with specified ID.

getInitialEnrollmentDate("70323786958847") + 2h > now
Generates TRUE within two hours starting at the moment of registration for those participants who have enrolled in an available group by means of the course element Enrolment with specified ID. This way it is clear that every participant can only work on e.g. a script within a particular time frame.

(getInitialCourseLaunchDate(0) >= never) | (getInitialCourseLaunchDate(0) + 2h > now)
Generates TRUE if a course participant has not yet taken any courses or during the first two hours after taking a course. This way it is possible represent that each course participant can only see courses for a certain period of time.

(getRecentCourseLaunchDate(0) + 10min < now)
Generates TRUE if a user is active for more than 10 min within a course.

(getCourseBeginDate(0) <= today) & (getCourseEndDate(0) >= today)
Returns the value TRUE if today's date lies in between the start and end date of the execution period.

isAssessmentMode(0)
Returns the value TRUE if the course is within an assessment.
Please note that the IDs of the course elements mentioned above are only examples. To create your course, you have to make reference to the relevant numbers available on the first tab «Title and description» of the favored course element.

Use of AAI Attributes

If you are enrolled at swiss academia or any other institution with access to an AAI infrastructure, by means of AAI attributes you can set access rules within a course to make sure that only course participants with specific user attributes (e.g. members of a certain organization) will have access to your course material. AAI means "Authentication and Authorization Infrastructure" and allows university members to use systems of other participating institutions with only one user name and password. For further information on AAI please go to e.g. Switch or to Deutsches Forschungsnetz .

Available attributes and possible values are described in the AAI Attribute Specification on the Switch and the DFN-AAI site (in german). The two most common attributes at swiss universities can be found in the following table along with examples of their corresponding expert rules:

 

AttributeDescriptionExample Expert rule and Explication
swissEduPerson-HomeOrganizationUniversity or home organizationhasAttribute ("swissEduPersonHomeOrganization", "uzh.ch"): only members of the Zurich University will get access.
swissEduStudyBranch3Field of study, 3rd classificationhasAttribute ("swissEduPersonStudyBranch3","6400"): only veterinary medicine students will have access.

Utilization

You can retrieve AAI attributes by using the syntax
hasAttribute("[AttrName]","[string]") or
isInAttribute("[AttrName]","[substring]").

Where:

[AttrName] is the attribute name you can find in the following table and also in the Specification of AAI attributes (pdf file) (column LDAP names) on page 5.
[string]  is the value of the AAI attribute with the name [AttrName].
[substring]  is any part of [string] .
AAI retrievals for example: John Doe
 Values for John Doe
Variable
You can retrieve AAI attributes by using the syntax
hasAttribute("[AttrName]","[string]") or
isInAttribute("[AttrName]","[substring]").
Example value
[string]
Description
swissEduPersonUniqueID845938727494@uzh.chUnambiguous personal identification number
surnameDoeLast name
givenNameJohnFirst name
mailjohn.doe@uzh.chPreferred e-mail address
swissEduPersonHomeOrganizationuzh.chHome organisation/university
swissEduPersonHomeOrganizationTypeuniversityType of home organisation
eduPersonAffiliationstudentPosition within this organisation
swissEduPersonStudyBranch14Field of study 1st classification
swissEduPersonStudyBranch242 (=Natural sciences)Field of study 2nd classification
swissEduPersonStudyBranch34600 (=Chemistry)Field of study 3rd classification
swissEduPersonStudyLevel15Description of study level
eduPersonEntitlementhttp://vam.uzh.ch/surgeryAccess right to resource
employeeNumber01-234-567Registration number (only for students at Zurich university)
organizationalUnit1Unity of home organisation e.g. faculty (only for employees)
  For the example "John Doe" mentioned above the following retrievals would respectively produce:
isInAttribute("surname","ust")true
hasAttribute("swissEduPersonStudyBranch3","4600")true
hasAttribute("swissEduPersonStudyBranch3","1200")false
isInAttribute("eduPersonEntitlement","http://vam.uzh.ch")true
isInAttribute("eduPersonEntitlement","http://vam.uzh.ch/ophthalmology")false
hasAttribute("employeeNumber","01-234-567")true

You will find the link to a list of possible attribute values in the Specification of AAI attributes (pdf file) appendix, as of page 20. Specification of AAI attributes (pdf file)

For further information on attribute values or the application of AAI attributes in Switzerland please go to Switch, and for Germany go to Deutsches Forschungsnetz.

  • Keine Stichwörter