The Rules Engine is used throughout the Wisetail LMS to specify collections of users across a wide variety of situations. The Rules Engine is used in everything from permissioning, to setting up enrollments, to specifying lists of users to apply bulk profile changes to, and much more.
The Rules Engine is based on each user's Profile Fields & Certifications. It takes a series of true/false statements to uniquely identify a collection of users. To give you an idea of the kinds of things you can do with the rules engine, this is an example that -translated into normal English- would read as follows:
"All users that are managers with a start date on or before 29 May 2021, and who are located in either Bozeman or Belgrade."
Which looks like this in the Rules Engine:
We include a compact Statement Preview to enable you to examine longer rules in a more condensed format:
- A User Attribute.
- A Logical Operator.
- A Value.
Multiple (sub)rules can be strung together with Selectors, or collected into Groups, which are in turn strung together with Selectors.
User Attributes are the basis for all rules. Most types of Profile Fields can be called upon as User Attributes in the Rules Engine, excluding Text type fields. In addition, some other things such as if a user has a particular Certification, is part of a User Group, Individual User, & Admin’s Value can be used as Attributes as well. The latter is useful if you want to, for example, create an Observation Checklist, and have each manager observe each of their employees, and no one else.
Logical Operators are the conditions applied against the User Attribute / Value pairs. For example, in the statement "If Harry Potter IS a student there will be trouble at school," the Logical Operator is IS. Depending on the Data Type in the profile field a subset of the following Logical Operators will be available:
- Is Before (date fields)
- Is On or Before (date fields)
- Is After (date fields)
- Is On or After (date fields)
Values are fairly self explanatory. The bold texts are the Value portions of each statement:
- "If the wizard is Harry Dresden"
- "If the date is 24 October 3018"
- "If the wizard is on the White Council"
Selectors (Any / All -- AKA: And / Or)
A Selector is another kind of Logical Operator, but is limited to the two Selector Types:
- ALL ARE TRUE (AND)
- ANY ARE TRUE (OR)
By selecting ALL ARE TRUE, you are creating an AND situation. It's like saying you must be 5'4" AND 12 years old to ride this ride; ALL of the rules must be true in order for the (sub)rule to apply. For example, let's say you want to require completion for your general managers in Helena. You could create two (sub)rules like:
- "Title IS General Manager"
- "Location IS Helena."
Whereas if you want all of your managers anywhere, plus everyone in your cooperate headquarters to have access to a module you could create permissions on it something like:
- "Title IS General Manager"
- "Location IS Global HQ"
Rules start out with by default with a single Rule Group. Rule Groups can be used to combine multiple smaller rules into complex, nested, sets of rules. (not to be confused with User Groups)
Once you have created a Rule in the Rules Engine, you can click the Preview Audience on the right-hand side of the page, which will generate a searchable list of all the users that the Rule applies to.
One important thing to note about the Rules Engine is that by default all users have access to all content such as modules, media, etc. By creating a set of permissions via the Rules Engine you immediately restrict the content exclusively to the users specified in the Rule.
Filtering & the Rules Engine
See this article for further details.