Scheduled access levels are a feature where users can assign access levels to a person for a specified amount of time. The Scheduled Access Level service runs on a schedule, and entails assigning and removing access levels for a person based on the Active On and Expires On values associated with the scheduled access level.
Although configured by the user (through the client or keep-proof), the actual assigning and removing of the access level itself is be done by the Scheduled Access Level Service.
When assigning a person a scheduled access level, the following must be specified:
Example on how to do this using the AssignConnectedObjectAsync API method:
DateTime? ActiveOn = new DateTime(2021, 08, 20);
DateTime ExpiresOn = new DateTime(2022, 12, 30);
await client.AssignConnectedObjectAsync(person, accessLevel, "ScheduledAccessLevel", false, new { ActiveOn, ExpiresOn });
The scheduled access level will then exist on the person object as an object link in the following format:
{
"ObjectLinks": [
{
"LinkedObjectId": "12345",
"CommonName": "Actual Access Level CommonName",
"Relation": "ScheduledAccessLevel",
"Metadata": {
"ActiveOn": "2021-08-20 12:00:00 AM",
"ExpiresOn": "2022-12-30 12:00:00 AM"
}
}
]
}
When the service finds a person with an object link with relation “ScheduledAccessLevel”, it checks the “ActiveOn” and “ExpiresOn” dates to determine if the actual access level object should be:
In the event that an access level should be activated, the service queries for the access level with the LinkedObjectId of the associated scheduled acces level and adds it as an Object link on the person (these keys will be the same). Both items will then exist on the person’s object links as so:
{
"ObjectLinks": [
{
"LinkedObjectId": "12345",
"CommonName": "Actual Access Level CommonName",
"Relation": "ScheduledAccessLevel",
"Metadata": {
"ActiveOn": "2021-08-27 12:00:00 AM",
"ExpiresOn": "2022-08-27 12:00:00 AM"
}
},
{
"LinkedObjectId": "12345",
"CommonName": "Actual Access Level CommonName",
"Relation": "AccessLevel",
}
]
}
Once the access level is added, the service then modifies the scheduled access level’s ActiveOn date to be null in order to prevent the service from matching that object again.
Lastly, when a scheduled access level expires, both object links will be removed from the person by the service.
The service only checks for scheduled access levels where ActiveOn <= now, or ExpiresOn <= now, as these are the only two scenarios where the actual access level will need to be added or removed.