File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 11import { v1 } from '@authzed/authzed-node' ;
2+ const { promises : promiseClient } = client ; // access client.promises
23// set up it on localhost like this:
34// const client = v1.NewClient('mytokenhere', 'localhost:50051', 1);
45const client = v1 . NewClient ( 'mytokenhere' ) ;
@@ -82,3 +83,26 @@ console.log(
8283 checkResult . permissionship ===
8384 v1 . CheckPermissionResponse_Permissionship . HAS_PERMISSION
8485) ;
86+
87+ // Lookup Resources
88+
89+ const lookupResourcesRequest = v1 . LookupResourcesRequest . create ( {
90+ consistency : v1 . Consistency . create ( {
91+ requirement : {
92+ oneofKind : 'fullyConsistent' ,
93+ fullyConsistent : true ,
94+ } ,
95+ } ) ,
96+ resourceObjectType : 'test/document' ,
97+ permission : 'view' ,
98+ subject : v1 . SubjectReference . create ( {
99+ object : v1 . ObjectReference . create ( {
100+ objectType : 'test/user' ,
101+ objectId : 'fred' ,
102+ } ) ,
103+ } ) ,
104+ } ) ;
105+
106+ const results = await promiseClient . lookupResources ( lookupResourcesRequest )
107+
108+ console . log ( results ) ;
You can’t perform that action at this time.
0 commit comments