Hi folks 👋, been using spicedb for a few months now and love it. Curious to hear how the community/experts handle more "generic" resource types like user groups? Or if any good docs on this!
At a super high level - my current design not only includes resources/relations that my apps own. But it also contains relations, reconciled from external sources of truth, that I do not own. That way I can use those (with reasonable lag boundaries) in my own permission check evaluations. Think of things like LDAP AD groups, or HRIS integrations like cost centers etc.
There is of course distinction in specific domains but all of that complexity is mostly encapsulated in my reconciliation process. For the most part in my spicedb schema, all I care about is a way to model "buckets of users". Given that, currently I'm using a generic resource definition in my schema "user_group". That way I get a lot of flexibility for granting access to things ie. Give user access, give users part of this ad group access, etc. I wanted to avoid having to copy+paste the same resource definition and unioning the types in these checks, so the generic resource seemed like a good bet. However with the simpler schema comes more complexity elsewhere ie. looking up user groups of a particular type a user is a part of etc. Also not sure about performance etc. Right now, I'm using prefixes to help differentiate types ie. "ad-group:
", "cost-center:
" etc. which helps a bit but just seems a bit weird. It also makes the reconciliation process be much more careful/strict to not add/remove relations for user groups it shouldnt be "managing" etc.