Skip to content

Commit

Permalink
WIP OpenFGA
Browse files Browse the repository at this point in the history
  • Loading branch information
c-thiel committed Oct 7, 2024
1 parent 99f4a45 commit d68f393
Show file tree
Hide file tree
Showing 73 changed files with 8,551 additions and 2,519 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/authz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: AuthZ Unittests

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
CARGO_TERM_COLOR: always

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

jobs:
openfga:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install FGA CLI
run: |
wget https://github.com/openfga/cli/releases/download/v0.6.1/fga_0.6.1_linux_amd64.deb
sudo apt-get install -yqq ./fga_0.6.1_linux_amd64.deb
- name: Validate Collaboration Model
run: |
BASE_PATH=authz/openfga/collaboration_model
LAST_VERSION=$(ls $BASE_PATH | sort -r | head -n 1)
VALIDATION_OUTPUT=$(fga model validate --file $BASE_PATH/$LAST_VERSION/schema.fga)
echo $VALIDATION_OUTPUT | jq -e '.is_valid == true' > /dev/null || { echo "Validation failed"; exit 1; }
- name: Test Collaboration Model
run: |
BASE_PATH=authz/openfga/collaboration_model
LAST_VERSION=$(ls $BASE_PATH | sort -r | head -n 1)
fga model test --tests $BASE_PATH/$LAST_VERSION/store.fga.yaml
- name: Check json up-to-date
run: |
BASE_PATH=authz/openfga/collaboration_model
LAST_VERSION=$(ls $BASE_PATH | sort -r | head -n 1)
DESIRED_SCHEMA_JSON=$(fga model transform --file $BASE_PATH/$LAST_VERSION/schema.fga)
CURRENT_SCHEMA_JSON=$(cat $BASE_PATH/$LAST_VERSION/schema.json)
echo $DESIRED_SCHEMA_JSON | jq -e '. == '"$CURRENT_SCHEMA_JSON" > /dev/null || { echo "Schema json is not up-to-date"; exit 1; }
20 changes: 20 additions & 0 deletions .run/Run iceberg-catalog.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run iceberg-catalog" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="buildProfileId" value="dev" />
<option name="command" value="run --package iceberg-catalog-bin --bin iceberg-catalog" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
<option name="emulateTerminal" value="true" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="true" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<option name="isRedirectInput" value="false" />
<option name="redirectInputPath" value="" />
<method v="2">
<option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
</method>
</configuration>
</component>
20 changes: 20 additions & 0 deletions .run/Test iceberg-catalog.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test iceberg-catalog" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="buildProfileId" value="test" />
<option name="command" value="test --workspace" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
<option name="emulateTerminal" value="true" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="true" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<option name="isRedirectInput" value="false" />
<option name="redirectInputPath" value="" />
<method v="2">
<option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
</method>
</configuration>
</component>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d68f393

Please sign in to comment.