Zanzana: Support sub resources (#98201)

* Create and use common ResourceInfo struct

* Add support for formatting group resource with subresource

* Add initial support for handling subresource

* Add test for checking subresource for generic resource

* Bump authlib
This commit is contained in:
Karl Persson
2025-01-07 15:16:14 +01:00
committed by GitHub
parent 9e3094d68e
commit 9ed4bf3cd2
17 changed files with 438 additions and 202 deletions
@@ -394,6 +394,19 @@ func rolePermissionsCollector(store db.DB) legacyTupleCollector {
tuples[tuple.Object] = make(map[string]*openfgav1.TupleKey)
}
// For resource actions on folders we need to merge the tuples into one with combined
// group_resources.
if zanzana.IsFolderResourceTuple(tuple) {
key := tupleStringWithoutCondition(tuple)
if t, ok := tuples[tuple.Object][key]; ok {
zanzana.MergeFolderResourceTuples(t, tuple)
} else {
tuples[tuple.Object][key] = tuple
}
continue
}
tuples[tuple.Object][tuple.String()] = tuple
}