Skip to content

Empty Caveat Context #224

@adel-chouchane

Description

@adel-chouchane

Hello,
I encountered a problem creating relationships with caveat context using the v1 api.
here is a snippet of my code

import protobuf from 'google-protobuf/google/protobuf/struct_pb.js';
const { Struct } = protobuf;

const context = {
      authorized_labels: ["confidential"]
  };
  const structContext = Struct.fromJavaScript(context);

  logger.debug(JSON.stringify(structContext.toJavaScript()))

  updates.push({
    relationship: Relationship.create({
      resource: ObjectReference.create({
        objectType: resourceType,
        objectId: resourceId,
      }),
      relation: "bindings",
      subject: SubjectReference.create({
        object: ObjectReference.create({
          objectType: "binding",
          objectId: bindingId,
        }),
      }),
      optionalCaveat: {
        caveatName: "my_caveat",
        context: structContext,
      },
    }),
    operation: RelationshipUpdate_Operation.TOUCH,
  });

when I execute a zed relationship read i get the caveatName set correctly but the context is empty object.
when i used zed to create the relationship with the caveat it worked very well.

Did I do something wrong or is there a limitation in the API and the caveat is not available yet ?
Thanks in advace 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions