new

Policy Improvements 🧪

Integrations 🔗

GetUserPermissions()

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, and allows you to get all the objects (resource instances) the user can access in a single API call.
Example usage:
const { Permit } = require("permitio");
const permit = new Permit({token: "<YOUR_API_KEY>", ...});
const userPermissions = await permit.getUserPermissions("john@doe.com");
Example output:
{
"result": {
"__tenant:default": {
"permissions": [
"document:read",
"task:read"
],
"roles": [
"viewer"
],
"tenant": {
"attributes": {},
"key": "default",
"type": "__tenant"
}
},
"document:budget": {
"permissions": [
"document:read",
"document:update",
"document:delete"
],
"roles": [
"owner"
],
"resource": {
"attributes": {"finance": true},
"key": "budget",
"type": "document"
}
}
}
}