Skip to main content
Version: 2.0.0

Get user permissions

To get all user permissions irrespective of the tenant, you can use the permit.GetUserPermissions function. This function determines all user permissions for every registered resource across all tenants.

Simple Usage

The permit.GetUserPermissions function accepts a "User" as input and optionally a list of tenants to filter, and returns an object containing the details about the request for each assigned tenant, including the assigned tenant's attributes, and the allowed permissions:

const { Permit } = require("permitio");

const permit = new Permit({token: "<YOUR_API_KEY>", ...});
const userPermissions = await permit.getUserPermissions("john@doe.com");

EAP: Enabling ABAC in user permissions

The permit.GetUserPermissions function can also find all permitted objects based on attribute-based rules (ABAC condition sets), however this calculation is a bit more expensive to run performance wise. For that reason, you have to manually turn on this capabality when needed.

Not all SDKs are supporting this feature at this point in time, you can directly call the PDP API if your SDK is not supporting it yet.

Assuming localhost:7766 is the PDP address relative to the caller:

curl --location 'http://localhost:7766/user-permissions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <api key>' \
--data '{
"user": {
"key": "eddie"
},
"resource_types": [
"document",
"__tenant"
],
"context": {
"enable_abac_user_permissions": true
}
}'