Modeling a grant by email address
# spicedb
a
šŸ‘‹ Hi everybody! šŸ‘‹ I'm building a permissions system based on SpiceDB, and would like to support API clients to share an artifact with others using email address (pretty unremarkable). Now, normally that relationship is to an entity with a UUID as its stable identifier, but that may not exist if a user is sharing an artifact with a user that's never logged into our system. ā“ Is there an established pattern for modeling this problem, of sharing to an identifier that doesn't exist yet?
I can see multiple solutions to this: 1. Just create an account with a UUID upon the share operation, and associate it with the email address as the authn mechanism. Doesn't involve SpiceDB at all. 2. Model the email as a different definition in the SpiceDB schema, and create the relationship between it and the artifact. Once the user signs up, create a relationship between the user account and the email. 3. Caveats??
y
my initial impulse is to add another definition to the system that represents those shares
second one is how i'd do it
at least at first blush
i'd definitely consider #1, but i'd be weighing its complexity/difficulty
a
can caveats help here @yetitwo ?
y
i wouldn't reach for them, no. the general rule of thumb is that if something can be modeled with a relationship it should, and this can definitely be modeled with relationships.
3 Views