Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to provide an interface for batch checking, e.g. BatchCheck? #119

Open
Bob1008-Call opened this issue Dec 1, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Bob1008-Call
Copy link

No description provided.

@rhamzeh
Copy link
Member

rhamzeh commented Dec 1, 2023

Hey @caozongkai1008 - the API does not support BatchCheck at the moment, however all our supported SDKs do.

For example, in the JS SDK: https://github.com/openfga/js-sdk#batch-check

const options = {
  // if you'd like to override the authorization model id for this request
  authorizationModelId: "01GXSA8YR785C4FYS3C0RTG7B1",
}
const { responses } = await fgaClient.batchCheck([{
  user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
  relation: "viewer",
  object: "document:budget",
}, {
  user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
  relation: "member",
  object: "document:budget",
}, {
  user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
  relation: "viewer",
  object: "document:roadmap",
  contextual_tuples: [{
    user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation: "writer",
    object: "document:roadmap"
  }],
}], options);

/*
responses = [{
  allowed: false,
  _request: {
    user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation: "viewer",
    object: "document:budget",
  }
}, {
  allowed: false,
  _request: {
    user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation: "member",
    object: "document:budget",
  },
  err: <FgaError ...>
}, {
  allowed: true,
  _request: {
    user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation: "viewer",
    object: "document:roadmap",
    contextual_tuples: [{
      user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
      relation: "writer",
      object: "document:roadmap"
    }],
  }},
]
*/

Take a look and let us know what you think!

@Bob1008-Call
Copy link
Author

Thanks. I know sdk supports it.

@rhamzeh rhamzeh added the enhancement New feature or request label Dec 7, 2023
@rhamzeh
Copy link
Member

rhamzeh commented Dec 7, 2023

Can you give us your feedback on that interface? We add some features to the SDKs before the API to gather feedback for folks in order to iterate quicker and stabilize on an interface that works for everyone.

Any thoughts on the one in the SDKs? Anything you would like changed in that?

@Bob1008-Call
Copy link
Author

Bob1008-Call commented Dec 12, 2023

thanks, we use OpenFGA for access control (through GRPC), and the usage scenario involves batch check, so it would be great if there is such an interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants