OK... I've been hit by a late breaking requirement...
# spicedb
s
OK... I've been hit by a late breaking requirement that permissions have to be a function of the subject and azp claims in the JWT token. For example, normally if the subject is an investor, they don't have read access to deals they aren't invested in. But if the authorized party is a specific type of widget developed by us and administered by a client organization that owns that deal, the user does have read access. Any tips on modeling that without rewriting my model from scratch? I'm mostly thinking that that azp goes into userset namespace and the client has to make 2 spicedb calls; if either call returns
PERMISSIONSHIP_HAS_PERMISSION
the API proceeds.
The difficulty with that is in no case can a negative permission override a positive, and that's scary.
I also thought about making it the intersection of permissions, but there are deal sponsors that have unqualified access to the same resource, regardless of AZP.
j
yeah, you have two different subjects so that would be the way to do it for now
it's possible caveats could be an alternative in the future
s
another idea I had would be taking the cross join of AZP and user and making that into a resource
but that would tank our performance I think
j
yeah that would also work but that sounds awful, you would have to know what all of the azps are to add a user
and every time you added an azp you would have to backfill it everywhere
PTAL at caveats proposal and see if this would solve your AZP problem: https://github.com/authzed/spicedb/issues/386
s
Can I have it by 4/1? That's our in-production go-live 😅
j
no
that's an unqualified no
s
But I'm talking about qualified no's 💦
j
i mean... it's a no where there are no possible exceptions haha
s
We have triggers handling our spicedb population so that's not the worst thing, but insert performance would be felt.
j
insert performance should be fine because you can write all of the relationships in the cross product in a single
WriteRelationships
call
s
We can't use the API to write relationships
j
how many azps are there?
s
We have DMS inserting records from MySQL
Today? 1
j
how many do you expect there to ever be?
s
Hundreds?
Thousands if we're lucky?
j
sure, but these can also insert multiple relationships in one TX, right?
yeah, so this sounds like a short-term only solution, if you pursue it at all
s
Yep they can.
j
I would probably just do two calls until you have caveats
s
But the trigger thing is solved-ish. We have subsecond inserts which is fine.
j
for posterity: with caveats you would just write a relationship from the resource to
users:*
with the caveat that azp == "the whitelisted always allowed azp"
s
Yeah that sounds like it'll do what we need.... eventually