pdewilde
12/21/2022, 9:00 PMpdewilde
12/21/2022, 9:12 PMcount := 0
for resp, err := readClient.Recv(); ; {
log.Printf("loop %s %s\n", resp, err)
if err != nil && !errors.Is(err, io.EOF) {
log.Printf("Error in looking up sub damproto/user:%s relation to damproto/group:users : %s \n", sub, err.Error())
usersRelation = "ERROR"
break
}
if resp != nil && resp.Relationship != nil && resp.Relationship.Relation != "" {
usersRelation = usersRelation + resp.Relationship.Relation + " "
}
count++
if errors.Is(err, io.EOF) || count > 10 {
break
}
}
Outputs
2022/12/21 13:10:11 loop read_at:{token:"GhUKEzE2NzE2NTcwMTAwMDAwMDAwMDA="} relationship:{resource:{object_type:"damproto/group" object_id:"users"} relation:"admin" subject:{object:{object_type:"damproto/user" object_id:"2"}}} %!s(<nil>)
10 times then exits due to my count limitpdewilde
12/21/2022, 9:13 PMpdewilde
12/21/2022, 9:22 PMjzelinskie
12/21/2022, 9:29 PMfor err := stream.RecvMsg(msg); !errors.Is(err, io.EOF); err = stream.RecvMsg(msg) { ... }
Prchowdh
12/22/2022, 10:26 AMkubectl port-forward deployment/dev-spicedb 50051:50051
Error from server (NotFound): deployments.apps "dev-spicedb" not found
Am I doing anything wrong ? something missing in the document ?pj
12/22/2022, 10:52 AMdefinition patient {
relation owner: user
relation doctor: user
relation technician: user
permission read = owner + doctor + technician
permission write = owner + doctor + technician
}
But I would like to verify the user right inside the read / write permission.
I don't know if the right must be define in the user definition or somewhere else. Is there a design pattern for user right ?
thanksvroldanbet
12/22/2022, 11:00 AMvroldanbet
12/22/2022, 11:02 AMvshar178
12/23/2022, 4:58 AMPrchowdh
12/23/2022, 6:13 AMvroldanbet
12/23/2022, 12:16 PMmattw
12/24/2022, 1:57 AMio.grpc.StatusRuntimeException: UNAUTHENTICATED
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165)
at com.authzed.api.v1.SchemaServiceGrpc$SchemaServiceBlockingStub.writeSchema(SchemaServiceGrpc.java:255)
java
ManagedChannel channel = ManagedChannelBuilder
.forTarget("localhost:50051")
.usePlaintext()
.build();
BearerToken bearerToken = new BearerToken("foobar");
SchemaServiceGrpc.SchemaServiceBlockingStub schemaService = SchemaServiceGrpc.newBlockingStub(channel)
.withCallCredentials(bearerToken);
String schema = """
definition blog/user {}
definition blog/post {
relation reader: blog/user
relation writer: blog/user
permission read = reader + writer
permission write = writer
}
""";
WriteSchemaRequest request = WriteSchemaRequest.newBuilder()
.setSchema(schema)
.build();
WriteSchemaResponse response;
try {
response = schemaService.writeSchema(request);
} catch (Exception e) {
e.printStackTrace();
return;
}
System.out.println(response);
any help is much appreciated 🙂Joey
12/24/2022, 2:00 AMmattw
12/24/2022, 2:00 AM- "SPICEDB_GRPC_PRESHARED_KEY=foobar"
I started it with this ^, is there something else i am missing in the example?Joey
12/24/2022, 2:02 AMJoey
12/24/2022, 2:02 AMmattw
12/24/2022, 2:03 AMenv
of a compose filemattw
12/24/2022, 2:03 AMReceiver class io.grpc.netty.shaded.io.grpc.netty.NettyClientTransport does not define or inherit an implementation of the resolved method 'abstract io.grpc.internal.ClientStream newStream(io.grpc.MethodDescriptor, io.grpc.Metadata, io.grpc.CallOptions, io.grpc.ClientStreamTracer[])' of interface io.grpc.internal.ClientTransport.
, perhaps it is relatedJoey
12/24/2022, 2:04 AMzed
work against?mattw
12/24/2022, 2:04 AMmattw
12/24/2022, 2:04 AMmattw
12/24/2022, 2:04 AMJoey
12/24/2022, 2:04 AMzed schema read
mattw
12/24/2022, 2:05 AMError: rpc error: code = NotFound desc = No schema has been defined; please call WriteSchema to start
i guess it is connectingJoey
12/24/2022, 2:05 AMJoey
12/24/2022, 2:05 AMmattw
12/24/2022, 2:17 AMio.grpc:grpc-netty-shaded:1.51.1
)mattw
12/24/2022, 2:17 AMJoey
12/24/2022, 2:31 AM