RestrictionService¶
- class RestrictionService[source]¶
Methods
Add a single IP range to a restriction.
Remove a single IP range from a restriction.
List all enrolled students with their entry counts and overrides.
Enter a restricted course, recording an entry event.
Get the full settings for a restriction (admin only).
Update restriction settings.
Get all IP ranges for a restriction.
Set or remove a per-student entry override for a restriction.
- put_allowed_ip(*, restriction_id, ip_range)[source]¶
Add a single IP range to a restriction.
- delete_allowed_ip(*, restriction_id, ip_range)[source]¶
Remove a single IP range from a restriction.
- get_all_entries(*, restriction_id, q='', page_size=50)[source]¶
List all enrolled students with their entry counts and overrides.
- Parameters:
- Returns:
A paginated list of entry overview entries per student.
- Return type:
Response[EntryOverviewEntry]
- enter(json_body, *, restriction_id)[source]¶
Enter a restricted course, recording an entry event.
Validates the password (if set), enforces the entry limit (if session_lockdown is set), records a :class:.RestrictionEntryEvent, and returns the caller’s existing access token enriched with any new restrictions. The same token is reused so the student is not locked out if the response is lost in transit.
- Parameters:
json_body (
EnterRestrictionData) – The body of the request. SeeEnterRestrictionDatafor information about the possible fields. You can provide this data as aEnterRestrictionDataor as a dictionary.restriction_id (
str) – The ID of the restriction.
- Returns:
A login response containing the (updated) access token.
- Return type:
- get(*, restriction_id)[source]¶
Get the full settings for a restriction (admin only).
- Parameters:
restriction_id (
str) – The id of the restriction.
- Returns:
The restriction object including the password.
- Return type:
- patch(json_body, *, restriction_id)[source]¶
Update restriction settings.
The request body mirrors the restriction JSON shape. All fields are optional; omitted fields are left unchanged.
- Parameters:
json_body (
PatchRestrictionData) – The body of the request. SeePatchRestrictionDatafor information about the possible fields. You can provide this data as aPatchRestrictionDataor as a dictionary.restriction_id (
str) – The id of the restriction.
- Returns:
The updated restriction.
- Return type:
- get_all_allowed_ips(*, restriction_id, page_size=50)[source]¶
Get all IP ranges for a restriction.
- patch_entry_override(json_body, *, restriction_id, user_id)[source]¶
Set or remove a per-student entry override for a restriction.
Sending null removes the override row entirely (the student falls back to the global session_lockdown limit). Sending a positive integer creates or updates the override for this student.
- Parameters:
json_body (
PatchEntryOverrideRestrictionData) – The body of the request. SeePatchEntryOverrideRestrictionDatafor information about the possible fields. You can provide this data as aPatchEntryOverrideRestrictionDataor as a dictionary.restriction_id (
str) – The ID of the restriction.user_id (
int) – The ID of the student.
- Returns:
The updated entry overview for this student.
- Return type: