Model and Relations

# Model

Entity permissions contain information about which User or Group has a specific Key in a specific Model (or table).

The fields of a permission are as follows:

Field Description Example Value
key The permission key progress
permission_entity Model type to grant the permission key for App\User or App\Department
permission_entity_id The id of permission_entity 25
target_entity Model type of the target content to grant the permission key for Modules\Tasks\Entities\Task
target_entity_id The id of target_entity 10

# Relations

Models provided by the intratool API that are Restrictable will always have a relation key entityPermissions that gives information about permissions attached to the content.

See Query Manipulation to learn how to retrieve this information by requesting our endpoints.

# Adding permissions

When creating or updating content by requesting the intratool API you can always add the fieldkey entity_permissions if the model the endpoint grants access to is Restrictable.

The entity_permissions value is expected to be an array with one or more permission definitions. The following structure is expected:

[
    {
        "key": "view",
        "target_entity": "App\User"
        "target_entity_id": 25
    },
    {
        "key": "view",
        "target_entity": "App\User"
        "target_entity_id": 27
    }
]
Last Updated: 02/22/2021