Hello everyone! We have been experimenting with self-serve Keto, Keto API and grpc library. We mana...
g
Hello everyone! We have been experimenting with self-serve Keto, Keto API and grpc library. We managed to work with the write and read APIs by using pre-defined namespaces in config. But when we migrated to Ory Permission Language by defining relations and Namespaces by ts types we faced errors - the created Namespaces were not found when using:
Copy code
import * as grpc from '@grpc/grpc-js';
import keto from '@ory/keto-grpc-client';

// Making user_id to have viewer relation to org_id organization.

const writeClient = new keto.writeService.WriteServiceClient(
  '127.0.0.1:4467',
  grpc.credentials.createInsecure()
);

const relationTuple = new keto.relationTuples.RelationTuple();
relationTuple.setNamespace('Organization');
relationTuple.setObject('org_id');
relationTuple.setRelation('viewer');

const subject = new keto.relationTuples.Subject();
subject.setId('user_id');

relationTuple.setSubject(subject);

const tupleDelta = new keto.write.RelationTupleDelta();
tupleDelta.setAction(keto.write.RelationTupleDelta.Action.ACTION_INSERT);
tupleDelta.setRelationTuple(relationTuple);

const writeRequest = new keto.write.TransactRelationTuplesRequest();
writeRequest.addRelationTupleDeltas(tupleDelta);

writeClient.transactRelationTuples(writeRequest, (error) => {
  if (error) {
    console.log('Encountered error', error);
  } else {
    console.log('Successfully created tuple');
  }
});
I am wondering if there are any examples on how this should work? Do we need to pre-register Orgs and Users with Tuples and cli command? Cannot understand why it keep saying that it cannot find Organization namespace. Any suggestions or advice?
s
you have to make sure it is written the same way in the new config as in the old config
so also capitalization
maybe you can provide both configs?