Moved from GitHub dgraph/4493
Posted by raxosiris:
Experience Report
Facets are a useful way to add properties to an edge instead of a node. We’d like to make full use of them but turns out only a limited set of types are supported which hinders our use case.
What you wanted to do
We wanted to contain the permission scopes (for example, for a particular slack channel) inside the user’s relationship (edge) to that channel.
What you actually did
For now, we are storing permissions as a jsonstring formatted list. E.g. instead of [“channel:write:user”, “channel:read”], we are storing ““channel:write:user”,“channel:read””
Why that wasn’t great, with examples
Making workarounds to store a more complex facet means that we have to manually parse the string into list format to send to our frontend.
Any external references to support your case
Slack has a similar use case where they assign permission scopes per channel/per workspace.
https://api.slack.com/scopes
Ours is a bit more complex, involving payment scopes, task scopes etc.