Skip to main content

Policies

Policies define a specific set of access permissions, and are a composable unit that can be assigned to both roles and users.

The policies Object

Field NameTypeDescription
iduuidPrimary key of the policy (UUID format).
namestringName of the policy.
iconstringIcon for the policy. Displayed in the TrackVision UI.
descriptionstringDescription for the policy. Displayed in the TrackVision UI.
ip_accessstringCSV of IP addresses that this policy applies to. Allows you to configure an allowlist of IP addresses. If empty, no IP restrictions are applied.
enforce_tfabooleanWhether or not Two-Factor Authentication is required for users that have this policy.
admin_accessbooleanIf this policy grants the user admin access. This means that users with this policy have full permissions to everything.
app_accessbooleanWhether or not users with this policy have access to use the TrackVision UI.
usersarray of objectsThe users this policy is assigned to directly, this does not include users which receive this policy through a role. Many-to-many relationship to users via the trackvision_access junction collection.
rolesarray of objectsThe roles this policy is assigned to. Many-to-many relationship to roles via the trackvision_access junction collection.
permissionsarray of objectsThe permissions assigned to this policy. One-to-many relationship to permissions.

List Policies

List all policies that exist in TrackVision.

Request

GET /policies

SEARCH /policies

If using SEARCH you can provide a query object as the body of your request.

Learn more about SEARCH ->

Query Parameters

Supports all global query parameters.

Response

An array of up to limit policy objects. If no items are available, data will be an empty array.

Example

GET /policies

SEARCH /policies

Retrieve a Policy

List an existing policy by primary key.

GET /policies/:id

Query Parameters

Supports all global query parameters.

Response

Returns the requested policy object.

Example

GET /policies/b4cb3b64-8580-4ad9-a099-eade6da24302

Create a Policy

Create a new policy.

Request

POST /policies

Provide a policy object as the body of your request.

Query Parameters

Supports all global query parameters.

Request Body

A partial policy object.

Response

Returns the policy object for the created policy.

Example

POST /policies

{
"name": "Intern Policy",
"icon": "verified_user",
"description": null,
"admin_access": false,
"app_access": true
}

Create Multiple Policies

Create multiple new policies.

Request

POST /policies

Provide an array of policy objects as the body of your request.

Query Parameters

Supports all global query parameters.

Request Body

An array of partial policy objects.

Response

Returns the policy objects for the created policies.

Example

POST /policies

[
{
"name": "Intern Access",
"icon": "verified_user",
"description": null,
"admin_access": false,
"app_access": true
},
{
"name": "Customer Access",
"icon": "person",
"description": null,
"admin_access": false,
"app_access": false
}
]

Update a Policy

Update an existing policy.

Request

PATCH /policies/:id

Provide a partial policy object as the body of your request.

Query Parameters

Supports all global query parameters.

Request Body

A partial policy object.

Response

Returns the policy object for the updated policy.

Example

PATCH /policies/c86c2761-65d3-43c3-897f-6f74ad6a5bd7

{
"icon": "attractions"
}

Update Multiple Policies

Update multiple existing policies.

Request

PATCH /policies

{
"keys": policy_id_array,
"data": partial_policy_object
}

Query Parameters

Supports all global query parameters.

Request Body

keys Required
Array of primary keys of the policies you'd like to update.

data Required
Any of the policy object's properties.

Response

Returns the policy objects for the updated policies.

Example

PATCH /policies

{
"keys": ["c86c2761-65d3-43c3-897f-6f74ad6a5bd7", "6fc3d5d3-a37b-4da8-a2f4-ed62ad5abe03"],
"data": {
"icon": "attractions"
}
}

Delete a Policy

Delete an existing policy.

Request

DELETE /policies/:id

Response

Empty body.

Example

DELETE /policies/c86c2761-65d3-43c3-897f-6f74ad6a5bd7

Delete Multiple Policies

Delete multiple existing policies.

Request

DELETE /policies

Provide an array of policy IDs as the body of your request.

Request Body

An array of policy primary keys

Response

Empty body.

Example

DELETE /policies

["653925a9-970e-487a-bfc0-ab6c96affcdc", "c86c2761-65d3-43c3-897f-6f74ad6a5bd7"]