https://authzed.com logo
#spicedb
Title
# spicedb
i

Igor.Shmukler

09/18/2022, 6:50 PM
makes sense... what kind of information may i provide? i pretty much copied the example from tests. please see below:
Copy code
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({
          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);