Spin-up an ephemeral docker instance.
docker pull openfga/openfga && docker run -p 8080:8080 -p 8081:8081 -p 3000:3000 openfga/openfga runIn another terminal, create a store.
fga store create --name "FGA Demo Store"Make note of your store ID for use in following commands, for example:
export STORE_ID=01J7MBWN53GQ7PD1JKFEBE83NQWrite the model.
fga --store-id=$STORE_ID model write --file model.fgaWrite a tuple for jack.
fga tuple write --store-id=$STORE_ID user:jack owner document:foobarAnd perform some checks for jack, noting that because he is an owner he's also a writer and editor.
fga query check --store-id=$STORE_ID user:jack owner document:foobar
fga query check --store-id=$STORE_ID user:jack writer document:foobar
fga query check --store-id=$STORE_ID user:jack reader document:foobarWrite a tuple for jane.
fga tuple write --store-id=$STORE_ID user:jane reader document:foobarAnd perform some checks, noting that she's only a reader.
fga query check --store-id=$STORE_ID user:jane owner document:foobar
fga query check --store-id=$STORE_ID user:jane writer document:foobar
fga query check --store-id=$STORE_ID user:jane reader document:foobar