What is the way to use wildcards?
# spicedb
m
What is the way to use wildcards?
v
Wilcards have multiple uses, but it's really up to you. Some examples: - feature flagging using the intersection. You can do
permission view = viewer & feature_flag
, where feature flag is a relation used to enable / disable some behaviour using the wildcard (e.g.
relation feature_flag: user:*
) - they can be used to denote visibility levels. E.g. you can use it to implement
public
visibility in the GitHub repository model:
Copy code
`
definition repository {
  relation viewer: user
  relation public: user:*

  permission view = viewer + public
}
m
I am interested in how many edge will i have to traverse if i use a wildcard in the above repository example.
Lemme explain:
Now all the users have public edges with repository.
How many edges are traversed if i am checking if user X has view permission to repostiory (via the wildcard?)
v
user:* does not equate to "traverse all the user edges". It's one single edge, with a special treatment
son in this case you'll traverse 2 edges. That's it.
m
thanks
57 Views