👋 Hello again folks! do u know if it's
# spicedb
p
👋 Hello again folks! do u know if it's possible currently to get the list of permissions a subject has to an object?
v
Hi - no, it's not possible. You'll need to: - use reflection to list the permissions of a resource - with that list, call
BulkCheckPermission
p
👍 that was my original plan, thx @vroldanbet I'm curious if there's a technical limitation? or just a feature that wasn't requested yet
v
under the hood it would effectively do the same.
BulkChecPermission
does already batching of the underlying subproblems if it sees fit. So such an API would add much on top of the proposed solution, other than the ergonomics
also please note that this is not the optimal use-case for bulk check: the batching of subproblems happens when you query "multiple resources for the same subject / permission". We may in the future also consider batching of the subject part.
p
I see I see, thx for the explaination!
v
just to be cristal clear: in this case
BulkCheckPermission
would be effectively similar to issuing N
CheckPermission
as there is no opportunity for batching
p
👍 you'd skip N-1 network hops, that's the only benefit of bulk in this case, right?
v
if you serially issue N check requests then yes. But gRPC supports multiplexing various requests over the same connection, so you could concurrently issue the check requests and it would be mostly the same. In fact one of the challenges with
BulkCheck
is that is not streaming, and thus you'll be making the request as slow as the sloweset of the items in the request, while with
CheckPermission
you can load the result in your application as soon as the result comes back (so it's more
async
friendly towards frontends).
BulkCheck
only pays off if you are checking the same permission over multiple resources.
j
we haven't added it as its own API because the use case for "all permissions" is very rarely, if ever, useful
y
@pepegar what is your use case?