Skip to main content
Version: 2.0.0

Condition Set Rule Examples

Example #1

Students that study at Stanford University and are not part of the part-time study scheme can rent University bicycles after 5pm.

First, lets define our conditions and actions.

User Set - Students who study at Stanford and are not part-time.
Action - Renting Bicycles.
Resource Set - All resources that are of type bicycle and can be rented after 5pm.

Now let's create a User Set and Resource Set through the API.

User Set

full_time_stanford_students
{
"key": "full_time_stanford_students",
"name": "Full-time Stanford Students",
"type": "userset",
"conditions": {
"allOf": [
{
"user.role": {
"equals": "student"
}
},
{
"user.education": {
"not": [
"part-time"
]
}
}
]
}
}

Resource Set

rent_bicycle_after_5
{
"key": "rent_bicycle_after_5",
"name": "Rent Bicycles After 5PM",
"type": "resourceset",
"conditions": {
"allOf": [
{
"resource.type": {
"equals": "bicycle"
}
},
{
"resource.availability": {
"greater-than-equals": [
"17"
]
}
}
]
}
}

Finally, let's define our condition rule:

{
"user_set": "full_time_stanford_students",
"permissions": [
"bicycle:rent"
],
"resource_set": "rent_bicycle_after_5"
}

Example #2

Coming Soon.