gifted-gold-29282
02/02/2023, 1:54 AMimport * 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?steep-lamp-91158
steep-lamp-91158
steep-lamp-91158
Ory is the largest open source community in the world for cloud software application security. We maintain advanced open source security software solving authentication, authorization, access control, application network security, and delegation. Ory implements a variety of industry and best-practice standards including OAuth 2.0 / OAuth 2.1, OpenID Connect, Zero Trust Networking, Google Zanzibar Policy Framework, FIDO2 U2F, WebAuthn, TOTP, and more.
Powered by