Igor.Shmukler
09/12/2022, 2:37 PMradmongoose
09/12/2022, 4:16 PMspicedb
service account and there doesn't seem to be a way to override that.ecordell
09/12/2022, 4:21 PMecordell
09/12/2022, 4:23 PMAlsbury
09/12/2022, 9:57 PMJoey
09/12/2022, 10:14 PMjzelinskie
09/12/2022, 10:15 PMArash
09/12/2022, 10:21 PMmain.wasm
file. It always fails at around 3 MB.niodice
09/12/2022, 11:41 PMfoo
object and I am granting view
permissions on a foo
based on the visibility of the foo
(where visibility is an application logic, and could be only_me
, friends
, or everyone
. I have a sample schema that works
definition foo {
relation token: token
relation friends: foo
// representing the visibility settings of `foo`. Only 1 of these relations should be logically set at any given time.
relation viz_me: foo
relation viz_friends: foo
relation viz_everyone: token:*
// intermediary results
permission friends_tokens = friends->token
permission view = (viz_everyone + viz_me->token + viz_friends->friends_tokens)
}
But it is a little bit clunky. Suppose for example that a foo
is configured in the application as only_me
visibility -- meaning that only tokens with the token
relation can view it. If that changes to friends
, then I need to:
- Check if viz_me
or viz_everyone
is set, and un-set it
- Set viz_friends
relation
This pattern is common in our application and so I'm looking for a way to effectively work with this pattern. Ideally, I'd like to set just one relation and update it with something that represents the set of tokens. I think that this would be possible if I could write a statement like this:
definition foo {
relation token: token
relation friends: foo
relation viz_tokens: token
permission view = viz_tokens
}
And set the viz_tokens
, when writing the relationship, to something like token:*
, or $THIS->token
, or $THIS->friends->token
. That way I get an atomic update, and don't need to worry about managing the fact that Only 1 of these relations should be logically set at any given time.
Joey
09/12/2022, 11:48 PMJoey
09/12/2022, 11:49 PMJoey
09/12/2022, 11:49 PMJoey
09/13/2022, 12:06 AMvisibility
, create one per resource and choose which level based on the permission referencedniodice
09/13/2022, 12:39 AMniodice
09/13/2022, 12:39 AMniodice
09/13/2022, 1:03 AMdocument::visibility
and visibility::parent
relationships. Is there a way to avoid such a cyclic dependency?Joey
09/13/2022, 1:04 AMJoey
09/13/2022, 1:04 AMJoey
09/13/2022, 1:04 AMJoey
09/13/2022, 1:04 AMowner
, etc on the visibility itselfJoey
09/13/2022, 1:04 AMparent
Igor.Shmukler
09/13/2022, 2:13 AMv1.NewClient('somerandomkeyhere')
should take care of the shared secret. This is great. Where do i point my client to the server running SpiceDB? Either the examples do not have it, or I cannot find it.
I got other questions as well. The documentation for NodeJS package is limited. Got my draft schema close enough that checks with zed
are all working fine. Regular examples are pretty good.
Now, I want to map the zed permission check event:27 edit user:2
command to the NodeJS library and suddenly it
turns out to be a little complicated.Joey
09/13/2022, 2:14 AMIgor.Shmukler
09/13/2022, 2:15 AMIgor.Shmukler
09/13/2022, 3:04 AMzed permission check event:27 read user:2
and it returns true
. that is perfect for me.
following the example @Joey recommended, I was able to initialize the client. I don't get error, yet it is not working like zed
. my code:
const eventRef = v1.ObjectReference.create({
objectType: 'event',
objectId: `${id}`
});
const userRef = v1.ObjectReference.create({
objectType: 'user',
objectId: `${userId}`
});
const checkPermissionRequest = v1.CheckPermissionRequest.create({
resource: eventRef,
permission: 'read',
subject: v1.SubjectReference.create({
object: userRef
})
});
spiceDBclient.checkPermission(checkPermissionRequest, (err, response) => {
console.log('response:', response);
console.error(err);
});
The respond I am getting is not a true
or false
. It reads like: { permissionship: 2, checkedAt: { token: 'GgQKAjMx' } }
What am I doing wrong? What is the correct what of getting what I need?Joey
09/13/2022, 3:06 AMexpect(checkResponse?.permissionship).toBe(
CheckPermissionResponse_Permissionship.HAS_PERMISSION
);
Joey
09/13/2022, 3:07 AM.permissionship
of the response to CheckPermissionResponse_Permissionship.HAS_PERMISSION
user
09/13/2022, 12:29 PMvroldanbet
09/13/2022, 12:32 PMuser
09/13/2022, 12:43 PM