Shyamalan Chemmery
11/17/2025, 9:21 AMAsk Inkeep
11/17/2025, 9:21 AMAsk Inkeep
11/17/2025, 9:21 AMor operator, meaning access is granted if any one policy returns true (1) (2) .
To make ReBAC take precedence, you'll need to modify the evaluation logic in the root.rego file. The default configuration has separate allow blocks (1) :
allow {
policies.allow
}
allow {
custom.allow
}
You can change this to enforce custom logic by combining them with an and operator :
allow {
policies.allow
custom.allow
}
In your custom.rego file, you can then implement logic that checks which policy sources are allowing access. Here's how you can access the allowing sources :
package permit.custom
import <http://future.keywords.in|future.keywords.in>
import data.permit.policies
import data.permit.rbac
default allow := false
allow {
not "rbac" in policies.__allow_sources
}
The policies.__allow_sources contains information about which policy configurations (RBAC, ABAC, ReBAC) are granting access . You can use this to create custom logic that prioritizes ReBAC decisions over ABAC.
For debugging your custom policy, you can use the print function to see the allowing policies in PDP logs :
print(policies.__allow_sources)
This approach allows you to override Permit's default "any policy allows" behavior and implement your specific precedence requirement where ReBAC resource roles take priority over ABAC conditions.Ask Inkeep
11/17/2025, 9:21 AMAlon Boshi
11/17/2025, 9:25 AMShyamalan Chemmery
11/17/2025, 11:33 AMShyamalan Chemmery
11/17/2025, 11:59 AMAlon Boshi
11/17/2025, 12:02 PMAlon Boshi
11/19/2025, 1:02 PM"reason": "user 'michal@shell.com' has the 'readonly' permission on resource 'market_order:antoin01' in tenant 'default', granted by 'market_order:antoin01#viewer'"See this, and you added
"custom": {
"allow": true,
"code": "custom_policy"
So you can manage your custom policy to handle your needs