daniso
09/16/2022, 1:40 PMSam
09/16/2022, 3:25 PMAruna
09/17/2022, 4:30 AMconst client = v1.NewClient("somerandomkeyhere", "localhost:50051");
Thanks for your help.Joey
09/17/2022, 2:50 PMconst client = NewClient(
'somerandomkeyhere',
'localhost:50051',
ClientSecurity.INSECURE_LOCALHOST_ALLOWED
);
Aruna
09/18/2022, 4:38 AMconst client = v1.NewClient("somerandomkeyhere", "localhost:50051", 1);
Seems ClientSecurity is not exported by V1 API. Thanks!Singha1
09/18/2022, 9:39 AMJoey
09/18/2022, 4:02 PMIgor.Shmukler
09/18/2022, 6:15 PMwriteRelationships
from NodeJS SDK. I assumed that write relationships is an equivalent of zed relationship create ...
. However, it is NOT working for me, unlike zed
.
const subjectRef = v1.ObjectReference.create({
objectType: 'user',
objectId: `${userId}`
});
// zed relationship create organization:1 owner user:2
const orgRef = v1.ObjectReference.create({
objectType: 'organization',
// eslint-disable-next-line camelcase
objectId: reference_id
});
const writeRelationships = v1.WriteRelationshipsRequest.create({
resource: orgRef,
permission: role,
subject: v1.SubjectReference.create({
object: subjectRef
})
});
console.log(
// eslint-disable-next-line camelcase
`write ${role} relationship between organization:${reference_id} and user:${userId}`
);
const status = await writeRelationshipsPromise(writeRelationships);
console.log('write relationship status:', status);
When I execute my code, it prints:
write manage_billing relationship between organization:1 and user:5
write relationship status: { writtenAt: { token: 'GgQKAjM3' } }
Yet, the relationship is not there, or maybe SpiceDB started creating it and did not finish.
I checked out the actual database, and relation_tuple
does not have the new relationships, yet relation_tuple_transaction
does have something that seems like an unfinished transaction, MAYBE.Joey
09/18/2022, 6:17 PMWriteRelationshipsRequest
takes an Updates
arrayJoey
09/18/2022, 6:17 PMIgor.Shmukler
09/18/2022, 6:17 PMWriteRelationshipsRequest
?Igor.Shmukler
09/18/2022, 6:18 PMJoey
09/18/2022, 6:18 PMIgor.Shmukler
09/18/2022, 6:18 PMIgor.Shmukler
09/18/2022, 6:18 PMIgor.Shmukler
09/18/2022, 6:18 PMIgor.Shmukler
09/18/2022, 6:47 PM14 UNAVAILABLE
error from gRPCJoey
09/18/2022, 6:48 PMIgor.Shmukler
09/18/2022, 6:50 PMconst subjectRef = v1.ObjectReference.create({
objectType: 'user',
objectId: `${userId}`
});
// zed relationship create organization:1 owner user:2
const orgRef = v1.ObjectReference.create({
objectType: 'organization',
// eslint-disable-next-line camelcase
objectId: reference_id
});
const writeRelationships = v1.WriteRelationshipsRequest.create({
updates: [
RelationshipUpdate.create({
relationship: Relationship.create({
resource: orgRef,
relation: role,
subject: v1.SubjectReference.create({
object: subjectRef
})
})
})
]
});
console.log(
// eslint-disable-next-line camelcase
`write ${role} relationship between organization:${reference_id} and user:${userId}`
);
const status = await writeRelationshipsPromise(writeRelationships);
console.log('write relationship status:', status);
Joey
09/18/2022, 6:52 PMIgor.Shmukler
09/18/2022, 7:01 PMJoey
09/18/2022, 7:08 PMWrite
call showing up in the logs? otherwise, you might need to get the details of the error, if anyIgor.Shmukler
09/18/2022, 7:24 PMJoey
09/18/2022, 7:26 PMJoey
09/18/2022, 7:48 PMoperation: v1.RelationshipUpdate_Operation.CREATE
, but unsure if that's the root causeSingha1
09/19/2022, 10:43 AMandvla
09/19/2022, 10:59 AMdefinition unit {
relation administration_director: user
relation sales_director: user
permission manage = administration_director + sales_director
}
definition company {
relation unit: unit
}
definition order {
relation company: company
permission update = company->unit->manage
}
I have this schema, it is invalid due to no support for double arrows company->unit->manage
Is there a way for me to set permission on order level based on the permission in unit?Igor.Shmukler
09/19/2022, 2:51 PMDeleteRelationshipsRequest
and/or relationshipFilter
. I could not find an example in the NodeJS SDK. could someone please point to another SDK, or if there is a JavaScript example somewhere, it would be totally awesome.Singha1
09/19/2022, 5:18 PM