I have written a OPA policy that creates the following output:
[
{
"permission": [
"module:get",
"workflow:get",
"ruletable:get"
],
"resource": "folder-2"
},
{
"permission": [
"module:get",
"workflow:get",
"ruletable:get"
],
"resource": "proj-1"
},
{
"permission": [
"module:get",
"workflow:get",
"ruletable:get",
"module:write",
"workflow:write",
"ruletable:write"
],
"resource": "folder-2"
}
The thing is in my structure, the object as I you can see the might have duplicate resource
key. And I only want one unique resource key with the permission being the union of all permissions for that resource key. Been fiddling this for a whole day, still couldn't figure it out.
how to manipulate this resource structure using OPA rego?