Skip to content

Commit

Permalink
Update reading test auth model
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Jun 14, 2024
1 parent bcedeab commit e62081b
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions internal/jimmtest/openfga.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/fs"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"
"sync"

Expand Down Expand Up @@ -39,38 +35,7 @@ type testSetup struct {
}

func getAuthModelDefinition() (*sdk.AuthorizationModel, error) {
desiredFolder := "local"
authPath := ""
var pwd string
pwd, err := os.Getwd()
if err != nil {
return nil, err
}
for ok := true; ok; {
if pwd == "/" {
break
}
var files []fs.FileInfo
files, err = ioutil.ReadDir(pwd)
if err != nil {
return nil, err
}

for _, f := range files {
if f.Name() == desiredFolder {
ok = true
authPath = pwd
}
}
// Move up a directory
pwd = filepath.Dir(pwd)
}
if authPath == "" {
err = fmt.Errorf("auth path is empty")
return nil, err
}

b, err := os.ReadFile(path.Join(authPath, "/local/openfga/authorisation_model.json"))
b, err := os.ReadFile("../../openfga/authorisation_model.json")
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e62081b

Please sign in to comment.