Pouya Xo
08/14/2025, 7:45 AMtest-user5@test.com
• Assigned Role: Manager
• User Attributes:
◦ `location`: "USA"
◦ `department`: "Eng"
Resource Configuration
• Resource Type: Services
• Resource Attributes:
◦ `cost`: numeric value
◦ `hasApproval`: boolean
User Set Definition
Engineer Managers in USA:
{
"allOf": [
{
"allOf": [
{
"user.location": {
"equals": "USA"
}
},
{
"user.department": {
"equals": "Eng"
}
}
]
}
]
}
Resource Sets
Services Above $500:
{
"allOf": [
{
"allOf": [
{
"resource.hasApproval": {
"equals": true
}
},
{
"resource.cost": {
"greater-than-equals": 500
}
}
]
}
]
}
Services Below $500:
{
"allOf": [
{
"allOf": [
{
"resource.cost": {
"less-than": 500
}
},
{
"resource.hasApproval": {
"equals": true
}
}
]
}
]
}
Code Implementation
const serviceCost = 400;
const userEmail = "test-user5@test.com";
const userLocation = "USA";
const userDepartment = "Eng";
const serviceApproval = "true";
const checkPermission = async () => {
setIsLoading(true);
setError(null);
try {
const response = await fetch("/api/permit/check", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
user: {
key: userEmail,
attributes: {
location: userLocation,
department: userDepartment,
},
},
action: "subscribe",
resource: {
type: "services",
attributes: {
hasApproval: serviceApproval,
cost: serviceCost,
},
tenant: "default",
},
}),
});
if (!response.ok) {
throw new Error(HTTP error! status: ${response.status});
}
const result = await response.json();
setIsAllowedToSubscribe(result.permitted);
} catch (err) {
setError(
err instanceof Error ? err.message : "Failed to check permission",
);
} finally {
setIsLoading(false);
}
};
```
The Problem
Main Issue: Permission is always denied when using user sets and resource sets together. The system only works when I assign permissions directly to the user's role and specific resources.
Error Scenarios
Scenario 1: "No User Roles" Error
Sometimes I get this error even though the user IS assigned to a role:
{
"__data_use_debugger": true,
"__input_use_debugger": true,
"allow": false,
"allowing_sources": [],
"debug": {
"rbac": {
"allow": false,
"code": "no_user_roles",
"reason": "no roles assigned to user 'test-user5@test.com'",
"support_link": "https://docs.permit.io/errors/no_user_roles"
},
"request": {
"action": "subscribe",
"resource": {
"attributes": {
"cost": 400,
"hasApproval": "true",
"type": "services"
},
"type": "services"
},
"tenant": null,
"user": {
"attributes": {
"department": "Eng",
"location": "USA",
"roles": [],
"tenants": []
},
"key": "test-user5@test.com",
"synced": false
}
}
},
"debugger_activated": true
}
Workaround: Deleting and recreating the user with role assignment temporarily fixes this.
Scenario 2: "No Permission" Error
After recreating the user, I get this error indicating the system isn't matching the user to the user set:
{
"__data_use_debugger": true,
"__input_use_debugger": null,
"allow": false,
"allowing_sources": [],
"debug": {
"rbac": {
"allow": false,
"code": "no_permission",
"reason": "user 'test-user5@test.com' does not have any role that grants him the 'subscribe' permission on resources of type 'services'",
"support_link": "https://docs.permit.io/errors/no_permission"
},
"request": {
"action": "subscribe",
"resource": {
"attributes": {
"cost": 400,
"hasApproval": "true",
"type": "services"
},
"type": "services"
},
"tenant": null,
"user": {
"attributes": {
"department": "Eng",
"email": "test-user5@test.com",
"key": "test-user5@test.com",
"location": "USA",
"roles": [
"Admin"
],
"tenants": [
"default"
]
},
"key": "test-user5@test.com",
"synced": true
}
}
},
"debugger_activated": true
}
Environment
• PDP running on Docker
• Direct role-to-resource permissions work fine
• Issue only occurs with user set + resource set combinations
Questions
1. Is there a known issue with user sets and resource sets working together?
2. Why does the system sometimes not recognize assigned roles?
3. Are there any configuration steps I might be missing for ABAC setup?
4. Is there a way to debug why the user isn't being matched to the user set?
Any insights or suggestions would be greatly appreciated! Has anyone encountered similar issues with ABAC implementations?
Thanks in advance! 🙏Alon Boshi
08/14/2025, 7:49 AMOmer Zuarets
08/14/2025, 8:19 AMPouya Xo
08/14/2025, 9:16 AMAlon Boshi
08/14/2025, 11:28 AMPouya Xo
08/14/2025, 1:59 PMOmer Zuarets
08/14/2025, 5:30 PMserviceApproval as boolean instead of string.
As you can see in the response the policy engine gets it as string which makes your request result in false as true != "true"Pouya Xo
08/14/2025, 5:35 PM