A go library for interacting with OpenFGA - it is comprised of 2 packages, fgax
and entfga
.
- fgax: wrapper to interact with the OpenFGA go-sdk and client libraries
- entfga: an ent extension to create relationship tuples using ent Hooks
You can install fgax
by running the following command:
go get github.com/datumforge/fgax@latest
This package includes helper functions used heavily in datum.
For example, you can easily check for Read
access of an organization using
// create client
fgaClient, err := fgax.Client("https://fga-host.example.com")
if err != nil {
return false
}
// create access check
req := fgax.AccessCheck{
SubjectID: "user-id",
SubjectType: "user",
ObjectID: "organization-id",
}
allow, err := fgaClient.CheckOrgReadAccess(ctx, req)
if err != nil {
return false
}
See the README for details
Please read the contributing guide as well as the Developer Certificate of Origin. You will be required to sign all commits to the Datum project, so if you're unfamiliar with how to set that up, see github's documentation.
We take the security of our software products and services seriously, including all of the open source code repositories managed through our Github Organizations, such as datumforge. If you believe you have found a security vulnerability in any of our repositories, please report it to us through coordinated disclosure.
Please do NOT report security vulnerabilities through public github issues, discussions, or pull requests!
Instead, please send an email to [email protected]
with as much information as possible to best help us understand and resolve the issues. See the security policy attached to this repository for more details.
Open a github issue on this repository and we'll respond as soon as we're able!