Skip to content

Commit

Permalink
fix: fix GitHub Action (#24)
Browse files Browse the repository at this point in the history
* fix: GitHub CI

* fix: GitHub CI

* fix: GitHub CI

* fix: GitHub CI

* fix: GitHub CI

* fix: GitHub CI

* fix: GitHub CI

* fix: GitHub CI
  • Loading branch information
PokIsemaine authored Jul 9, 2023
1 parent 6ef6ee6 commit e5227ce
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ jobs:
run: |
set -x
docker version
docker run -d -p 50051:50051 casbin/casbin-server
docker run -id -p 50051:50051 \
-e CONNECTION_CONFIG_PATH=/config/connection_config.json \
-v $GITHUB_WORKSPACE/config:/config \
-v $GITHUB_WORKSPACE/examples:/data/examples \
--name my-casbin-server-config \
-d casbin/casbin-server
- name: Go Test
run: go test ./...

Expand Down
3 changes: 2 additions & 1 deletion client/enforce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package client

import (
"context"
"google.golang.org/grpc"
"log"
"testing"
"time"

"google.golang.org/grpc"

"github.com/casbin/casbin/v2/util"
)

Expand Down
5 changes: 5 additions & 0 deletions config/connection_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"driver": "file",
"connection": "/data/examples/rbac_policy.csv",
"enforcer": "/data/examples/rbac_model.conf"
}
14 changes: 14 additions & 0 deletions examples/rbac_model.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[role_definition]
g = _, _

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
12 changes: 12 additions & 0 deletions examples/rbac_policy.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
p, alice, data1, read
p, bob, data2, write
p, data2_admin, data2, read
p, data2_admin, data2, write

g, alice, data2_admin

g, george, data3_admin
g, data3_admin, data4_admin

p, data3_admin, data3, admin
p, data4_admin, data4, read

0 comments on commit e5227ce

Please sign in to comment.